Skip to content

Commit

Permalink
add support for f64 for concat fields (#5369)
Browse files Browse the repository at this point in the history
* add support for f64 for concat fields

* add f64 conversion
  • Loading branch information
PSeitz authored Aug 30, 2024
1 parent c00dd57 commit 489c9d6
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ impl LeafType {
let val = u64::from_json_to_self(&json_val, numeric_options.coerce)?;
Ok(OneOrIter::one((val).into()))
}
LeafType::F64(_) => Err("unsupported concat type: f64".to_string()),
LeafType::F64(numeric_options) => {
let val = f64::from_json_to_self(&json_val, numeric_options.coerce)?;
Ok(OneOrIter::one((val).into()))
}
LeafType::Bool(_) => {
if let JsonValue::Bool(val) = json_val {
Ok(OneOrIter::one((val).into()))
Expand All @@ -294,9 +297,7 @@ impl LeafType {
LeafType::DateTime(_date_time_options) => {
Err("unsupported concat type: DateTime".to_string())
}
LeafType::Bytes(_binary_options) => {
Err("unsupported concat type: DateTime".to_string())
}
LeafType::Bytes(_binary_options) => Err("unsupported concat type: Bytes".to_string()),
LeafType::Json(_) => {
if let JsonValue::Object(json_obj) = json_val {
Ok(OneOrIter::Iter(
Expand All @@ -314,14 +315,13 @@ impl LeafType {

fn supported_for_concat(&self) -> bool {
use LeafType::*;
matches!(self, Text(_) | U64(_) | I64(_) | Bool(_) | Json(_))
matches!(self, Text(_) | U64(_) | I64(_) | F64(_) | Bool(_) | Json(_))
/*
// will be supported if possible
DateTime(_),
// Since concat is a JSON field, anything that JSON supports can be supported
DateTime(_), // Could be supported if the date is converted to Rfc3339
IpAddr(_),
// won't be supported
Bytes(_),
F64(_),
*/
}
}
Expand Down

0 comments on commit 489c9d6

Please sign in to comment.