Skip to content

Commit 5f635f9

Browse files
fix(stdlib): make nullable timestamp and tags fields in parse_influxdb function (#1011)
* fix: make nullable timestamp and tags fields * Add changelog entry Signed-off-by: Jesse Szwedko <[email protected]> --------- Signed-off-by: Jesse Szwedko <[email protected]> Co-authored-by: Jesse Szwedko <[email protected]>
1 parent b63e099 commit 5f635f9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

changelog.d/1011.fix.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
For the `parse_influxdb` function the `timestamp` and `tags` fields of returned objects are now
2+
correctly marked as nullable.
3+
4+
authors: jorgehermo9

src/stdlib/parse_influxdb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl FunctionExpression for ParseInfluxDBFn {
240240
}
241241

242242
fn tags_kind() -> Kind {
243-
Kind::object(Collection::from_unknown(Kind::bytes()))
243+
Kind::object(Collection::from_unknown(Kind::bytes())) | Kind::null()
244244
}
245245

246246
fn gauge_kind() -> Kind {
@@ -253,7 +253,7 @@ fn metric_kind() -> BTreeMap<Field, Kind> {
253253
btreemap! {
254254
"name" => Kind::bytes(),
255255
"tags" => tags_kind(),
256-
"timestamp" => Kind::timestamp(),
256+
"timestamp" => Kind::timestamp() | Kind::null(),
257257
"kind" => Kind::bytes(),
258258
"gauge" => gauge_kind(),
259259
}
@@ -276,7 +276,7 @@ mod test {
276276
parse_influxdb => ParseInfluxDB;
277277

278278
influxdb_valid {
279-
args: func_args![ value: format!("cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000") ],
279+
args: func_args![ value: "cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000" ],
280280
want: Ok(Value::from(vec![
281281
Value::from(btreemap! {
282282
"name" => "cpu_usage_system",
@@ -373,7 +373,7 @@ mod test {
373373
}
374374

375375
influxdb_valid_no_tags {
376-
args: func_args![ value: format!("cpu usage_system=64i,usage_user=10i 1590488773254420000") ],
376+
args: func_args![ value: "cpu usage_system=64i,usage_user=10i 1590488773254420000" ],
377377
want: Ok(Value::from(vec![
378378
Value::from(btreemap! {
379379
"name" => "cpu_usage_system",

0 commit comments

Comments
 (0)