@@ -173,13 +173,10 @@ mod tests {
173173 use vortex_array:: arrays:: PrimitiveArray ;
174174 use vortex_array:: arrays:: VarBinViewArray ;
175175 use vortex_array:: arrays:: Variant ;
176- use vortex_array:: arrays:: VariantArray ;
177176 use vortex_array:: arrays:: extension:: ExtensionArrayExt ;
178177 use vortex_array:: arrays:: variant:: VariantArrayExt ;
179178 use vortex_array:: dtype:: Nullability ;
180179 use vortex_array:: dtype:: PType ;
181- use vortex_array:: expr:: Expression ;
182- use vortex_array:: expr:: proto:: ExprSerializeProtoExt ;
183180 use vortex_array:: expr:: root;
184181 use vortex_array:: scalar_fn:: fns:: variant_get:: VariantPath ;
185182 use vortex_array:: scalar_fn:: fns:: variant_get:: VariantPathElement ;
@@ -205,12 +202,6 @@ mod tests {
205202 ) )
206203 }
207204
208- fn execute_variant_to_json ( input : ArrayRef ) -> VortexResult < ArrayRef > {
209- input
210- . apply ( & variant_to_json ( root ( ) ) ) ?
211- . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) )
212- }
213-
214205 fn json_strings ( array : & ArrayRef ) -> VortexResult < Vec < Option < String > > > {
215206 let mut ctx = SESSION . create_execution_ctx ( ) ;
216207 let ext = array. clone ( ) . execute :: < ExtensionArray > ( & mut ctx) ?;
@@ -245,55 +236,6 @@ mod tests {
245236 . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) )
246237 }
247238
248- #[ test]
249- fn expression_roundtrip_serialization ( ) -> VortexResult < ( ) > {
250- let expr: Expression = variant_to_json ( root ( ) ) ;
251- let proto = expr. serialize_proto ( ) ?;
252- let actual = Expression :: from_proto ( & proto, & SESSION ) ?;
253-
254- assert_eq ! ( actual, expr) ;
255- Ok ( ( ) )
256- }
257-
258- #[ test]
259- fn return_dtype_is_json_extension ( ) -> VortexResult < ( ) > {
260- let expr = variant_to_json ( root ( ) ) ;
261- assert_eq ! (
262- expr. return_dtype( & DType :: Variant ( Nullability :: NonNullable ) ) ?,
263- json_dtype( Nullability :: NonNullable ) ?
264- ) ;
265- assert_eq ! (
266- expr. return_dtype( & DType :: Variant ( Nullability :: Nullable ) ) ?,
267- json_dtype( Nullability :: Nullable ) ?
268- ) ;
269- Ok ( ( ) )
270- }
271-
272- #[ test]
273- fn return_dtype_rejects_non_variant_input ( ) {
274- let expr = variant_to_json ( root ( ) ) ;
275- let err = expr
276- . return_dtype ( & DType :: Utf8 ( Nullability :: NonNullable ) )
277- . unwrap_err ( ) ;
278- assert ! (
279- err. to_string( )
280- . contains( "VariantToJson input must be Variant" ) ,
281- "unexpected error: {err}"
282- ) ;
283- }
284-
285- #[ test]
286- fn formats_sql ( ) {
287- let expr = variant_to_json ( root ( ) ) ;
288- assert_eq ! ( expr. to_string( ) , "variant_to_json($)" ) ;
289- }
290-
291- #[ test]
292- fn is_fallible ( ) {
293- let expr = variant_to_json ( root ( ) ) ;
294- assert ! ( expr. signature( ) . is_fallible( ) ) ;
295- }
296-
297239 #[ test]
298240 fn renders_unshredded_values ( ) -> VortexResult < ( ) > {
299241 let input = unshredded_variant ( [
@@ -303,7 +245,9 @@ mod tests {
303245 PqVariant :: Null ,
304246 ] ) ?;
305247
306- let result = execute_variant_to_json ( input) ?;
248+ let result = input
249+ . apply ( & variant_to_json ( root ( ) ) ) ?
250+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?;
307251
308252 assert_eq ! ( result. dtype( ) , & json_dtype( Nullability :: NonNullable ) ?) ;
309253 assert_eq ! (
@@ -323,7 +267,9 @@ mod tests {
323267 let input =
324268 json_rows_to_variant ( vec ! [ Some ( "1" ) , None , Some ( "null" ) ] , ShreddingSpec :: empty ( ) ) ?;
325269
326- let result = execute_variant_to_json ( input) ?;
270+ let result = input
271+ . apply ( & variant_to_json ( root ( ) ) ) ?
272+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?;
327273
328274 assert_eq ! ( result. dtype( ) , & json_dtype( Nullability :: Nullable ) ?) ;
329275 assert_eq ! (
@@ -351,7 +297,12 @@ mod tests {
351297
352298 #[ test]
353299 fn unshreds_typed_value_only_storage ( ) -> VortexResult < ( ) > {
354- let result = execute_variant_to_json ( typed_value_only_variant ( ) ?) ?;
300+ let result = {
301+ let input = typed_value_only_variant ( ) ?;
302+ input
303+ . apply ( & variant_to_json ( root ( ) ) ) ?
304+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) )
305+ } ?;
355306
356307 assert_eq ! (
357308 json_strings( & result) ?,
@@ -383,7 +334,9 @@ mod tests {
383334 "fixture must be shredded"
384335 ) ;
385336
386- let result = execute_variant_to_json ( input) ?;
337+ let result = input
338+ . apply ( & variant_to_json ( root ( ) ) ) ?
339+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?;
387340
388341 assert_eq ! (
389342 json_strings( & result) ?,
@@ -396,30 +349,6 @@ mod tests {
396349 Ok ( ( ) )
397350 }
398351
399- #[ test]
400- fn renders_canonical_variant_with_shredded_child ( ) -> VortexResult < ( ) > {
401- let mut ctx = SESSION . create_execution_ctx ( ) ;
402- let canonical = typed_value_only_variant ( ) ?
403- . execute :: < VariantArray > ( & mut ctx) ?
404- . into_array ( ) ;
405- assert ! (
406- canonical. as_:: <Variant >( ) . shredded( ) . is_some( ) ,
407- "fixture must carry a canonical shredded child"
408- ) ;
409-
410- let result = execute_variant_to_json ( canonical) ?;
411-
412- assert_eq ! (
413- json_strings( & result) ?,
414- vec![
415- Some ( "10" . to_string( ) ) ,
416- Some ( "20" . to_string( ) ) ,
417- Some ( "30" . to_string( ) ) ,
418- ]
419- ) ;
420- Ok ( ( ) )
421- }
422-
423352 /// Shreds `rows` per `spec`, then canonicalizes so the typed values are lifted into a logical
424353 /// shredded child (as a file read-back would produce).
425354 fn canonical_shredded ( rows : Vec < Option < & str > > , spec : ShreddingSpec ) -> VortexResult < ArrayRef > {
@@ -439,14 +368,22 @@ mod tests {
439368 spec : ShreddingSpec ,
440369 ) -> VortexResult < ( ) > {
441370 let unshredded = json_rows_to_variant ( rows. clone ( ) , ShreddingSpec :: empty ( ) ) ?;
442- let want = json_strings ( & execute_variant_to_json ( unshredded) ?) ?;
371+ let want = json_strings (
372+ & unshredded
373+ . apply ( & variant_to_json ( root ( ) ) ) ?
374+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?,
375+ ) ?;
443376
444377 let canonical = canonical_shredded ( rows, spec) ?;
445378 assert ! (
446379 canonical. as_:: <Variant >( ) . shredded( ) . is_some( ) ,
447380 "fixture must carry a canonical shredded child"
448381 ) ;
449- let got = json_strings ( & execute_variant_to_json ( canonical) ?) ?;
382+ let got = json_strings (
383+ & canonical
384+ . apply ( & variant_to_json ( root ( ) ) ) ?
385+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?,
386+ ) ?;
450387
451388 assert_eq ! ( got, want) ;
452389 Ok ( ( ) )
@@ -474,7 +411,9 @@ mod tests {
474411 "fixture must carry a canonical shredded child"
475412 ) ;
476413
477- let result = execute_variant_to_json ( canonical) ?;
414+ let result = canonical
415+ . apply ( & variant_to_json ( root ( ) ) ) ?
416+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?;
478417
479418 assert_eq ! (
480419 json_strings( & result) ?,
@@ -525,32 +464,15 @@ mod tests {
525464 )
526465 }
527466
528- #[ test]
529- fn json_round_trip_normalizes_whitespace_and_key_order ( ) -> VortexResult < ( ) > {
530- let input = json_rows_to_variant (
531- vec ! [ Some ( r#"{ "b" : 1 , "a" : 2 }"# ) , Some ( "[ 1 , 2 , 3 ]" ) ] ,
532- ShreddingSpec :: empty ( ) ,
533- ) ?;
534-
535- let result = execute_variant_to_json ( input) ?;
536-
537- assert_eq ! (
538- json_strings( & result) ?,
539- vec![
540- Some ( r#"{"a":2,"b":1}"# . to_string( ) ) ,
541- Some ( "[1,2,3]" . to_string( ) ) ,
542- ]
543- ) ;
544- Ok ( ( ) )
545- }
546-
547467 #[ test]
548468 fn variant_only_types_are_stringified_so_reparsing_loses_types ( ) -> VortexResult < ( ) > {
549469 let date =
550470 NaiveDate :: from_ymd_opt ( 2026 , 6 , 11 ) . ok_or_else ( || vortex_err ! ( "invalid test date" ) ) ?;
551471 let input = unshredded_variant ( [ PqVariant :: from ( date) ] ) ?;
552472
553- let rendered = execute_variant_to_json ( input) ?;
473+ let rendered = input
474+ . apply ( & variant_to_json ( root ( ) ) ) ?
475+ . execute :: < ArrayRef > ( & mut SESSION . create_execution_ctx ( ) ) ?;
554476 let json = json_strings ( & rendered) ?;
555477 assert_eq ! ( json, vec![ Some ( r#""2026-06-11""# . to_string( ) ) ] ) ;
556478
0 commit comments