andygrove opened a new pull request, #7053:
URL: https://github.com/apache/datafusion-comet/pull/7053

   ## Which issue does this PR close?
   
   Closes #3427.
   
   ## Rationale for this change
   
   Spark's `ParquetWriteSupport` records the Spark version in each file's 
footer as `org.apache.spark.version`. Spark's datetime rebase logic reads it 
back to tell files written by Spark 3.0+ from older ones, and `ParquetIOSuite` 
asserts that it is present. The native Parquet writer built its writer 
properties with only the compression codec, so its files had no such key and 
"Write Spark version into Parquet metadata" failed when the native writer was 
enabled.
   
   ## What changes are included in this PR?
   
   - Add an optional `spark_version` field to the `ParquetWriter` proto message.
   - Both Scala serde paths (`CometDataWritingCommand` for Spark 3.x and 
`CometWriteFiles` for Spark 4.0+) set it to `SPARK_VERSION_SHORT`.
   - `ParquetWriterExec` writes it to the footer as `org.apache.spark.version` 
when present, and keeps it across `with_new_children`. A plan serialized 
without the field writes no key, as before.
   
   ## How are these changes tested?
   
   - New Rust test `test_parquet_writer_records_spark_version_in_footer` covers 
both the present and absent cases.
   - New Scala test `parquet write records the Spark version in the footer` in 
`CometParquetWriterSuite` does a native write and checks the footer against 
`SPARK_VERSION_SHORT`. It passes on the default Spark profile.
   - The native `parquet_writer` tests, clippy and `cargo fmt --check` are 
clean.
   - I have not run the Spark SQL test suite or the Spark 3.4/3.5 profiles.


-- 
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