From f8a790005fff7942bf2f7c398d6709e4d201d9bd Mon Sep 17 00:00:00 2001 From: Josh Pschorr Date: Wed, 5 Feb 2025 14:10:14 -0800 Subject: [PATCH] Minor test cleanup --- .../partiql-extension-ion/resources/test/test.ion | 3 ++- extension/partiql-extension-ion/src/boxed_ion.rs | 10 +--------- .../tests/snapshots/test__all_types_owned.snap | 7 ++++++- .../tests/snapshots/test__all_types_ref.snap | 7 ++++++- .../test__nulls_eq_nans_eq_SingleTlvBinary.snap | 2 ++ .../test__nulls_eq_nans_eq_SingleTlvText.snap | 2 ++ .../snapshots/test__nulls_eq_nans_eq_StreamBinary.snap | 2 ++ .../snapshots/test__nulls_eq_nans_eq_StreamText.snap | 2 ++ .../test__nulls_eq_nans_neq_SingleTlvBinary.snap | 2 ++ .../test__nulls_eq_nans_neq_SingleTlvText.snap | 2 ++ .../test__nulls_eq_nans_neq_StreamBinary.snap | 2 ++ .../snapshots/test__nulls_eq_nans_neq_StreamText.snap | 2 ++ .../test__nulls_neq_nans_eq_SingleTlvBinary.snap | 1 + .../test__nulls_neq_nans_eq_SingleTlvText.snap | 1 + .../test__nulls_neq_nans_eq_StreamBinary.snap | 1 + .../snapshots/test__nulls_neq_nans_eq_StreamText.snap | 1 + .../test__nulls_neq_nans_neq_SingleTlvBinary.snap | 1 + .../test__nulls_neq_nans_neq_SingleTlvText.snap | 1 + .../test__nulls_neq_nans_neq_StreamBinary.snap | 1 + .../snapshots/test__nulls_neq_nans_neq_StreamText.snap | 1 + extension/partiql-extension-ion/tests/test.rs | 2 +- 21 files changed, 40 insertions(+), 13 deletions(-) diff --git a/extension/partiql-extension-ion/resources/test/test.ion b/extension/partiql-extension-ion/resources/test/test.ion index 054a47a2..2f056d43 100644 --- a/extension/partiql-extension-ion/resources/test/test.ion +++ b/extension/partiql-extension-ion/resources/test/test.ion @@ -216,5 +216,6 @@ degrees::'celsius'::100 // You can have multiple annotaions on { field: some_annotation::value } // Field's name must precede annotations of its value - +bool :: null.int // A very misleading annotation on the integer null +'' :: 1 // An empty annotation diff --git a/extension/partiql-extension-ion/src/boxed_ion.rs b/extension/partiql-extension-ion/src/boxed_ion.rs index a2de1375..ed0b60aa 100644 --- a/extension/partiql-extension-ion/src/boxed_ion.rs +++ b/extension/partiql-extension-ion/src/boxed_ion.rs @@ -573,15 +573,7 @@ impl BoxedIon { } else if let BoxedIonValue::Sequence(seq) = &self.doc { Element::from(ion_rs::Value::List(seq.clone())) } else { - todo!() - /* - let mut elts = Vec::new(); - for ion in self.try_into_iter()? { - elts.push(ion?.try_into_element()?); - } - Element::from(ion_rs::Value::List(elts.into())) - - */ + todo!("try_into_element for &BoxedIon") }; Ok(elt) } diff --git a/extension/partiql-extension-ion/tests/snapshots/test__all_types_owned.snap b/extension/partiql-extension-ion/tests/snapshots/test__all_types_owned.snap index 41a15e38..5447a72a 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__all_types_owned.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__all_types_owned.snap @@ -1,6 +1,6 @@ --- source: extension/partiql-extension-ion/tests/test.rs -expression: dump_owned(read()) +expression: "dump_owned(read(IonDataFormat::StreamText))" --- `null` 「is_null:true, is_missing:false, is_absent:true, is_present:false, is_sequence:false, is_ordered:false」 @@ -455,3 +455,8 @@ expression: dump_owned(read()) 「len:1, is_empty:false」 ↳ field: `some_annotation::value` 「is_null:false, is_missing:false, is_absent:false, is_present:true, is_sequence:false, is_ordered:false」 +`bool::null.int` + 「is_null:true, is_missing:false, is_absent:true, is_present:false, is_sequence:false, is_ordered:false」 + ↳ NULL +`''::1` + 「is_null:false, is_missing:false, is_absent:false, is_present:true, is_sequence:false, is_ordered:false」 diff --git a/extension/partiql-extension-ion/tests/snapshots/test__all_types_ref.snap b/extension/partiql-extension-ion/tests/snapshots/test__all_types_ref.snap index abd87153..d09b555e 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__all_types_ref.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__all_types_ref.snap @@ -1,6 +1,6 @@ --- source: extension/partiql-extension-ion/tests/test.rs -expression: dump_ref(read()) +expression: "dump_ref(read(IonDataFormat::StreamText))" --- `null` 「is_null:true, is_missing:false, is_absent:true, is_present:false, is_sequence:false, is_ordered:false」 @@ -455,3 +455,8 @@ expression: dump_ref(read()) 「len:1, is_empty:false」 ↳ field: `some_annotation::value` 「is_null:false, is_missing:false, is_absent:false, is_present:true, is_sequence:false, is_ordered:false」 +`bool::null.int` + 「is_null:true, is_missing:false, is_absent:true, is_present:false, is_sequence:false, is_ordered:false」 + ↳ NULL +`''::1` + 「is_null:false, is_missing:false, is_absent:false, is_present:true, is_sequence:false, is_ordered:false」 diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvBinary.snap index b9fd8b27..27b7050c 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvBinary.snap @@ -980,3 +980,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvText.snap index 5801d470..346b57fa 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_SingleTlvText.snap @@ -972,3 +972,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamBinary.snap index b9fd8b27..27b7050c 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamBinary.snap @@ -980,3 +980,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamText.snap index 5801d470..346b57fa 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_eq_StreamText.snap @@ -972,3 +972,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvBinary.snap index 7ad583c8..56d3f6ca 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvBinary.snap @@ -979,3 +979,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvText.snap index 021468bd..cdf38be0 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_SingleTlvText.snap @@ -971,3 +971,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamBinary.snap index 7ad583c8..56d3f6ca 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamBinary.snap @@ -979,3 +979,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamText.snap index 021468bd..cdf38be0 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_eq_nans_neq_StreamText.snap @@ -971,3 +971,5 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`bool::null.int` = `bool::null.int` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvBinary.snap index 4c61b53b..934d440b 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvBinary.snap @@ -196,3 +196,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvText.snap index bdd84ff6..2a907e6e 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_SingleTlvText.snap @@ -188,3 +188,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamBinary.snap index 4c61b53b..934d440b 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamBinary.snap @@ -196,3 +196,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamText.snap index bdd84ff6..2a907e6e 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_eq_StreamText.snap @@ -188,3 +188,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvBinary.snap index c946595e..11f89cb7 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvBinary.snap @@ -195,3 +195,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvText.snap index a52e6827..e9dc84f4 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_SingleTlvText.snap @@ -187,3 +187,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamBinary.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamBinary.snap index c946595e..11f89cb7 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamBinary.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamBinary.snap @@ -195,3 +195,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamText.snap b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamText.snap index a52e6827..e9dc84f4 100644 --- a/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamText.snap +++ b/extension/partiql-extension-ion/tests/snapshots/test__nulls_neq_nans_neq_StreamText.snap @@ -187,3 +187,4 @@ expression: "dump_eq::(fmt)" `degrees::celsius::100` = `degrees::celsius::100` → true `'my.custom.type'::{x: 12, y: -1}` = `'my.custom.type'::{x: 12, y: -1}` → true `{field: some_annotation::value}` = `{field: some_annotation::value}` → true +`''::1` = `''::1` → true diff --git a/extension/partiql-extension-ion/tests/test.rs b/extension/partiql-extension-ion/tests/test.rs index 2ef26558..3d132f2c 100644 --- a/extension/partiql-extension-ion/tests/test.rs +++ b/extension/partiql-extension-ion/tests/test.rs @@ -424,7 +424,7 @@ fn encode_ion_text(value: &Value, encoding: Encoding) -> Result