@@ -34,12 +34,14 @@ use test_utils::{read_scan, test_table_setup_mt, write_batch_to_table};
3434#[ tokio:: test( flavor = "multi_thread" ) ]
3535async fn test_write_partitioned_normal_values_roundtrip (
3636 #[ case] cm_mode : ColumnMappingMode ,
37+ #[ values( true , false ) ] write_partition_values_parsed : bool ,
3738) -> Result < ( ) , Box < dyn std:: error:: Error > > {
3839 // ===== Step 1: Create table and write one row with normal partition values. =====
3940 let ( _tmp_dir, table_path, snapshot, engine) = setup_and_write (
4041 all_types_schema ( ) ,
4142 PARTITION_COLS ,
4243 cm_mode,
44+ write_partition_values_parsed,
4345 normal_arrow_columns ( ) ,
4446 normal_partition_values ( ) ?,
4547 )
@@ -123,12 +125,14 @@ async fn test_write_partitioned_normal_values_roundtrip(
123125#[ tokio:: test( flavor = "multi_thread" ) ]
124126async fn test_write_partitioned_null_values_roundtrip (
125127 #[ case] cm_mode : ColumnMappingMode ,
128+ #[ values( true , false ) ] write_partition_values_parsed : bool ,
126129) -> Result < ( ) , Box < dyn std:: error:: Error > > {
127130 // ===== Step 1: Create table and write one row with all-null partition values. =====
128131 let ( _tmp_dir, table_path, snapshot, engine) = setup_and_write (
129132 all_types_schema ( ) ,
130133 PARTITION_COLS ,
131134 cm_mode,
135+ write_partition_values_parsed,
132136 null_arrow_columns ( ) ,
133137 null_partition_values ( ) ?,
134138 )
@@ -241,6 +245,7 @@ async fn test_write_partitioned_path_encodes_special_chars(
241245 schema,
242246 & [ "p" ] ,
243247 cm_mode,
248+ true , // write_partition_values_parsed
244249 vec ! [
245250 Arc :: new( Int32Array :: from( vec![ 1 ] ) ) ,
246251 Arc :: new( StringArray :: from( vec![ value] ) ) as ArrayRef ,
@@ -567,9 +572,15 @@ fn create_partitioned_table(
567572 schema : Arc < StructType > ,
568573 partition_cols : & [ & str ] ,
569574 cm_mode : ColumnMappingMode ,
575+ write_partition_values_parsed : bool ,
570576) -> Result < Arc < Snapshot > , Box < dyn std:: error:: Error > > {
577+ // `delta.checkpoint.writeStatsAsStruct` is what turns on `partitionValues_parsed`.
571578 let mut builder = create_table ( table_path, schema, "test/1.0" )
572- . with_data_layout ( DataLayout :: partitioned ( partition_cols) ) ;
579+ . with_data_layout ( DataLayout :: partitioned ( partition_cols) )
580+ . with_table_properties ( [ (
581+ "delta.checkpoint.writeStatsAsStruct" ,
582+ write_partition_values_parsed. to_string ( ) ,
583+ ) ] ) ;
573584 if cm_mode != ColumnMappingMode :: None {
574585 builder =
575586 builder. with_table_properties ( [ ( "delta.columnMapping.mode" , cm_mode_str ( cm_mode) ) ] ) ;
@@ -635,6 +646,7 @@ async fn setup_and_write(
635646 schema : Arc < StructType > ,
636647 partition_cols : & [ & str ] ,
637648 cm_mode : ColumnMappingMode ,
649+ write_partition_values_parsed : bool ,
638650 arrow_columns : Vec < ArrayRef > ,
639651 partition_values : HashMap < String , Scalar > ,
640652) -> Result <
@@ -654,6 +666,7 @@ async fn setup_and_write(
654666 schema,
655667 partition_cols,
656668 cm_mode,
669+ write_partition_values_parsed,
657670 ) ?;
658671
659672 let batch = RecordBatch :: try_new ( arrow_schema, arrow_columns) ?;
0 commit comments