alessandro-nori opened a new issue, #7771:
URL: https://github.com/apache/datafusion-comet/issues/7771

   ### What is the problem the feature request solves?
   
   This is a file-size/performance follow-up to #6114 / #6241, not a 
correctness report. I reproduced it on `apache/datafusion-comet` main at 
`f67d51d24aa9cac69a428df2a7b6655e4b042456` (parquet-rs 59.3.2) using the native 
Iceberg write task. The comparison is the JVM Iceberg 1.11.0 writer (parquet-mr 
1.17.1).
   
   **Repro.** Write 800 rows in order, one unpartitioned file and one row 
group. Use V1 Parquet, Zstd level 3, 1 MiB pages, 20,000 rows/page, 2 MiB 
dictionaries, and 128 MiB row groups. Both list columns are 768 values wide. 
For each row `r` and element `j`, let `i = r*768+j`. Use `float32(((i % 
120000)*199999+3) % 16777216)` for the first list and `float64(i)` for the 
second. Keep the second list: it changes when parquet-mr checks page sizes.
   
   | FLOAT leaf | Data pages (row starts, zero-based) | Dictionary page | 
Compressed chunk bytes | Uncompressed chunk bytes |
   |---|---|---|---:|---:|
   | JVM Iceberg | 2 × `PLAIN_DICTIONARY` (0, 400) | yes | 963,292 | 1,790,929 |
   | Comet main native | 3 × `PLAIN` (0, 342, 684) | no | 1,173,249 | 2,461,707 
|
   
   Comet evaluates the first row over its 90%-of-page raw-value threshold, row 
308. At that point dictionary + ids cost 983,127 bytes vs. 946,176 plain.
   
   parquet-mr shares size checks across columns and checks at rows 100, 200, 
300 and 400. It crosses the threshold at row 307 if levels are included, but 
only tests dictionary profitability when the first FLOAT page closes at row 
400. There, the same 480,000-byte dictionary plus ids costs 1,133,411 bytes vs. 
1,228,800 plain.
   
   Both implementations give the same answer at the same prefix. The result 
first flips at row 334. Removing the DOUBLE column moves the JVM's first FLOAT 
page boundary to row 320 and both writers choose plain. No reuse across files 
or row groups is needed to reproduce this.
   
   The [user 
guide](https://github.com/apache/datafusion-comet/blob/f67d51d24aa9cac69a428df2a7b6655e4b042456/docs/source/user-guide/latest/iceberg.md#L871-L888)
 already documents that close decisions can flip. This example shows that a 
close first-page decision can still change full-chunk size appreciably. Can we 
try a bounded second check for near-cutoff decisions, or better approximate 
parquet-mr's next check, without losing #6114's selective-read benefit? #6937 
preserves the chooser's behavior. #6954 concerns non-default settings, not this 
case. apache/arrow-rs#11384 tracks upstreaming a sampling helper, which by 
itself does not change the sample Comet chooses.
   
   ### Describe the potential solution
   
   _No response_
   
   ### Additional context
   
   Reproduce the measurements with the attached test-only `repro-main.patch` 
and `repro-jvm.py`. In a fresh clone:
   
   ```sh
   git checkout --detach f67d51d24aa9cac69a428df2a7b6655e4b042456
   git apply /path/to/repro-main.patch
   cd native
   CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 \
     cargo +1.96.1 test --locked --no-default-features -p datafusion-comet \
     --lib synthetic_nested_float_boundary -- --nocapture
   ```
   
   For the JVM measurement (Spark 4.1.3):
   
   ```sh
   JAR=iceberg-spark-runtime-4.1_2.13-1.11.0.jar
   curl -fsSLO 
"https://repo.maven.apache.org/maven2/org/apache/iceberg/iceberg-spark-runtime-4.1_2.13/1.11.0/$JAR";
   SPARK_LOCAL_IP=127.0.0.1 spark-submit --master 'local[1]' \
     --driver-class-path "$JAR" --jars "$JAR" --conf spark.ui.enabled=false \
     --conf spark.sql.adaptive.enabled=false --conf 
spark.sql.shuffle.partitions=1 repro-jvm.py
   ```
   
   
   ### Willingness to contribute
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to