@@ -876,7 +876,7 @@ mod tests {
876876 Some ( expected_variant) => {
877877 assert ! ( fallback_value. is_valid( idx) ) ;
878878 let metadata_bytes =
879- binary_array_value ( fallback_metadata. as_ref ( ) , idx) ;
879+ binary_array_value ( fallback_metadata. as_ref ( ) , idx) . unwrap ( ) ;
880880 let metadata_bytes =
881881 if fallback_metadata. is_valid ( idx) && !metadata_bytes. is_empty ( ) {
882882 metadata_bytes
@@ -886,7 +886,7 @@ mod tests {
886886 assert_eq ! (
887887 Variant :: new(
888888 metadata_bytes,
889- binary_array_value( fallback_value. as_ref( ) , idx)
889+ binary_array_value( fallback_value. as_ref( ) , idx) . unwrap ( )
890890 ) ,
891891 expected_variant. clone( )
892892 ) ;
@@ -952,7 +952,7 @@ mod tests {
952952 assert_eq ! (
953953 Variant :: new(
954954 EMPTY_VARIANT_METADATA_BYTES ,
955- binary_array_value( element_fallbacks. as_ref( ) , idx)
955+ binary_array_value( element_fallbacks. as_ref( ) , idx) . unwrap ( )
956956 ) ,
957957 expected_variant. clone( )
958958 ) ;
@@ -1099,8 +1099,8 @@ mod tests {
10991099 assert ! ( typed_value_field. is_null( 1 ) ) ; // typed_value should be null
11001100 assert_eq ! (
11011101 Variant :: new(
1102- binary_array_value( metadata_field. as_ref( ) , 1 ) ,
1103- binary_array_value( value_field. as_ref( ) , 1 )
1102+ binary_array_value( metadata_field. as_ref( ) , 1 ) . unwrap ( ) ,
1103+ binary_array_value( value_field. as_ref( ) , 1 ) . unwrap ( )
11041104 ) ,
11051105 Variant :: from( "hello" )
11061106 ) ;
@@ -1118,8 +1118,8 @@ mod tests {
11181118 assert ! ( !value_field. is_null( 4 ) ) ; // should contain Variant::Null
11191119 assert_eq ! (
11201120 Variant :: new(
1121- binary_array_value( metadata_field. as_ref( ) , 4 ) ,
1122- binary_array_value( value_field. as_ref( ) , 4 )
1121+ binary_array_value( metadata_field. as_ref( ) , 4 ) . unwrap ( ) ,
1122+ binary_array_value( value_field. as_ref( ) , 4 ) . unwrap ( )
11231123 ) ,
11241124 Variant :: Null
11251125 ) ;
@@ -1198,8 +1198,8 @@ mod tests {
11981198 assert ! ( typed_value. is_null( 1 ) ) ;
11991199 assert_eq ! (
12001200 Variant :: new(
1201- binary_array_value( metadata. as_ref( ) , 1 ) ,
1202- binary_array_value( value. as_ref( ) , 1 )
1201+ binary_array_value( metadata. as_ref( ) , 1 ) . unwrap ( ) ,
1202+ binary_array_value( value. as_ref( ) , 1 ) . unwrap ( )
12031203 ) ,
12041204 Variant :: from( 42i64 )
12051205 ) ;
@@ -1215,8 +1215,8 @@ mod tests {
12151215 assert ! ( typed_value. is_null( 3 ) ) ;
12161216 assert_eq ! (
12171217 Variant :: new(
1218- binary_array_value( metadata. as_ref( ) , 3 ) ,
1219- binary_array_value( value. as_ref( ) , 3 )
1218+ binary_array_value( metadata. as_ref( ) , 3 ) . unwrap ( ) ,
1219+ binary_array_value( value. as_ref( ) , 3 ) . unwrap ( )
12201220 ) ,
12211221 Variant :: Null
12221222 ) ;
@@ -1260,8 +1260,8 @@ mod tests {
12601260 assert ! ( typed_value. is_null( 1 ) ) ;
12611261 assert_eq ! (
12621262 Variant :: new(
1263- binary_array_value( metadata. as_ref( ) , 1 ) ,
1264- binary_array_value( value. as_ref( ) , 1 )
1263+ binary_array_value( metadata. as_ref( ) , 1 ) . unwrap ( ) ,
1264+ binary_array_value( value. as_ref( ) , 1 ) . unwrap ( )
12651265 ) ,
12661266 Variant :: from( "not_binary" )
12671267 ) ;
@@ -1277,8 +1277,8 @@ mod tests {
12771277 assert ! ( typed_value. is_null( 3 ) ) ;
12781278 assert_eq ! (
12791279 Variant :: new(
1280- binary_array_value( metadata. as_ref( ) , 3 ) ,
1281- binary_array_value( value. as_ref( ) , 3 )
1280+ binary_array_value( metadata. as_ref( ) , 3 ) . unwrap ( ) ,
1281+ binary_array_value( value. as_ref( ) , 3 ) . unwrap ( )
12821282 ) ,
12831283 Variant :: Null
12841284 ) ;
@@ -1684,7 +1684,7 @@ mod tests {
16841684 assert_eq ! (
16851685 Variant :: new(
16861686 EMPTY_VARIANT_METADATA_BYTES ,
1687- binary_array_value( id_values. as_ref( ) , 1 )
1687+ binary_array_value( id_values. as_ref( ) , 1 ) . unwrap ( )
16881688 ) ,
16891689 Variant :: Null
16901690 ) ;
@@ -1804,8 +1804,8 @@ mod tests {
18041804 value : & ' v dyn Array ,
18051805 ) -> Variant < ' m , ' v > {
18061806 Variant :: new (
1807- binary_array_value ( metadata, i) ,
1808- binary_array_value ( value, i) ,
1807+ binary_array_value ( metadata, i) . unwrap ( ) ,
1808+ binary_array_value ( value, i) . unwrap ( ) ,
18091809 )
18101810 }
18111811 let expect = |i, expected_result : Option < ShreddedValue < ShreddedStruct > > | {
@@ -2002,7 +2002,7 @@ mod tests {
20022002 // Helper to correctly create a variant object using a row's existing metadata
20032003 let object_with_foo_field = |i| {
20042004 use parquet_variant:: { ParentState , ValueBuilder , VariantMetadata } ;
2005- let metadata = VariantMetadata :: new ( binary_array_value ( metadata. as_ref ( ) , i) ) ;
2005+ let metadata = VariantMetadata :: new ( binary_array_value ( metadata. as_ref ( ) , i) . unwrap ( ) ) ;
20062006 let mut metadata_builder = ReadOnlyMetadataBuilder :: new ( & metadata) ;
20072007 let mut value_builder = ValueBuilder :: new ( ) ;
20082008 let state = ParentState :: variant ( & mut value_builder, & mut metadata_builder) ;
@@ -2102,8 +2102,8 @@ mod tests {
21022102 assert ! ( value_field. is_valid( 3 ) ) ;
21032103 assert_eq ! (
21042104 Variant :: new(
2105- binary_array_value( result. metadata_field( ) . as_ref( ) , 3 ) ,
2106- binary_array_value( value_field. as_ref( ) , 3 )
2105+ binary_array_value( result. metadata_field( ) . as_ref( ) , 3 ) . unwrap ( ) ,
2106+ binary_array_value( value_field. as_ref( ) , 3 ) . unwrap ( )
21072107 ) ,
21082108 Variant :: from( "not an object" )
21092109 ) ;
@@ -2292,8 +2292,8 @@ mod tests {
22922292
22932293 // Verify the value field contains the name field
22942294 let row_1_variant = Variant :: new (
2295- binary_array_value ( metadata. as_ref ( ) , 1 ) ,
2296- binary_array_value ( value. as_ref ( ) , 1 ) ,
2295+ binary_array_value ( metadata. as_ref ( ) , 1 ) . unwrap ( ) ,
2296+ binary_array_value ( value. as_ref ( ) , 1 ) . unwrap ( ) ,
22972297 ) ;
22982298 let Variant :: Object ( obj) = row_1_variant else {
22992299 panic ! ( "Expected object" ) ;
@@ -2327,8 +2327,8 @@ mod tests {
23272327 assert ! ( session_id_value. is_valid( 3 ) ) ; // type mismatch, stored in value
23282328 assert ! ( session_id_typed_value. is_null( 3 ) ) ;
23292329 let session_id_variant = Variant :: new (
2330- binary_array_value ( metadata. as_ref ( ) , 3 ) ,
2331- binary_array_value ( session_id_value. as_ref ( ) , 3 ) ,
2330+ binary_array_value ( metadata. as_ref ( ) , 3 ) . unwrap ( ) ,
2331+ binary_array_value ( session_id_value. as_ref ( ) , 3 ) . unwrap ( ) ,
23322332 ) ;
23332333 assert_eq ! ( session_id_variant, Variant :: from( "not-a-uuid" ) ) ;
23342334
@@ -2341,8 +2341,8 @@ mod tests {
23412341 assert ! ( id_value. is_valid( 4 ) ) ; // type mismatch, stored in value
23422342 assert ! ( id_typed_value. is_null( 4 ) ) ;
23432343 let id_variant = Variant :: new (
2344- binary_array_value ( metadata. as_ref ( ) , 4 ) ,
2345- binary_array_value ( id_value. as_ref ( ) , 4 ) ,
2344+ binary_array_value ( metadata. as_ref ( ) , 4 ) . unwrap ( ) ,
2345+ binary_array_value ( id_value. as_ref ( ) , 4 ) . unwrap ( ) ,
23462346 ) ;
23472347 assert_eq ! ( id_variant, Variant :: from( 12345i64 ) ) ;
23482348
0 commit comments