@@ -3669,6 +3669,58 @@ class CometIcebergWriteActionSuite
36693669 }
36703670 }
36713671
3672+ // parquet-java leaves a column chunk's statistics out of the file it writes when the chunk's min
3673+ // and max together take 4096 bytes or more (`ParquetMetadataConverter.MAX_STATS_SIZE`), but
3674+ // iceberg-java takes its manifest metrics from the footer it still holds in memory, which keeps
3675+ // them. The native path reads the footer back from the file, where parquet-rs keeps statistics
3676+ // of any size, so both commit the same counts and bounds. A single 2047-byte value stays under
3677+ // the limit (2047 + 2047); a 2048-byte value reaches it (2048 + 2048). Under `full` the bounds
3678+ // are the whole values, which pins that the native footer keeps its statistics untruncated.
3679+ test(" native acceleration: string and binary bounds past parquet-java's 4 KiB stats limit" ) {
3680+ assumeNativeAcceleration()
3681+ withIcebergCatalog { _ =>
3682+ val (native, jvm) = manifestMetricsParity(
3683+ " stats_limit" ,
3684+ t => Seq (s """
3685+ CREATE TABLE $t (id INT, under STRING, over STRING, bin_over BINARY, over_full STRING)
3686+ USING iceberg
3687+ TBLPROPERTIES ('write.metadata.metrics.column.over_full'='full')
3688+ """ ),
3689+ t => s """
3690+ INSERT INTO $t VALUES
3691+ (1, repeat('a', 2047), repeat('b', 2048), CAST(repeat('c', 2048) AS BINARY),
3692+ repeat('d', 2048)),
3693+ (2, NULL, NULL, NULL, NULL)
3694+ """ ,
3695+ f => s """
3696+ SELECT
3697+ sum(readable_metrics.under.value_count),
3698+ sum(readable_metrics.under.null_value_count),
3699+ min(readable_metrics.under.lower_bound),
3700+ max(readable_metrics.under.upper_bound),
3701+ sum(readable_metrics.over.value_count),
3702+ sum(readable_metrics.over.null_value_count),
3703+ min(readable_metrics.over.lower_bound),
3704+ max(readable_metrics.over.upper_bound),
3705+ sum(readable_metrics.bin_over.value_count),
3706+ sum(readable_metrics.bin_over.null_value_count),
3707+ hex(min(readable_metrics.bin_over.lower_bound)),
3708+ hex(max(readable_metrics.bin_over.upper_bound)),
3709+ sum(readable_metrics.over_full.value_count),
3710+ sum(readable_metrics.over_full.null_value_count),
3711+ length(min(readable_metrics.over_full.lower_bound)),
3712+ md5(min(readable_metrics.over_full.lower_bound)),
3713+ md5(max(readable_metrics.over_full.upper_bound))
3714+ FROM $f
3715+ """ )
3716+ assert(
3717+ Seq (2 , 3 , 6 , 7 , 10 , 11 , 15 , 16 ).forall(i => ! jvm.isNullAt(i)),
3718+ s " expected iceberg-java to keep bounds for every column, got $jvm" )
3719+ assert(jvm.getInt(14 ) == 2048 , s " expected the whole value as the `full` bound, got $jvm" )
3720+ assert(native == jvm, s " native $native != jvm $jvm" )
3721+ }
3722+ }
3723+
36723724 // iceberg-java's `PartitionSpec.partitionToPath` runs every partition name and value through
36733725 // `URLEncoder.encode`, and iceberg-rust's `partition_to_path` uses the same
36743726 // application/x-www-form-urlencoded table (apache/iceberg-rust#2875). Readers resolve files
0 commit comments