Repository navigation
[fix](iceberg) Support GZIP for iceberg/hive Parquet writers. - #68854
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
The BE Parquet writers only accepted PLAIN/SNAPPY/ZSTD/LZ4 and rejected the GZ codec that Iceberg's write.parquet.compression-codec=gzip (and Hive's parquet.compression=GZIP) map to, so INSERT/DELETE failed with 'Unsupported compress type GZ with parquet' while Spark/Trino wrote the same table fine. Factor the whole TFileCompressType -> TParquetCompressionType mapping into ParquetBuildHelper (GZ -> GZIP included) so the Iceberg data-file writer, the Iceberg delete-file writer and the Hive Parquet writer share one definition instead of three copies of the switch, and accept gzip in the Hive CREATE TABLE parquet compression allow-list.
749af5f to
500cad6
Compare
|
run buildall |
|
/review |
There was a problem hiding this comment.
Complete static review of PR #68854 at head 500cad6 after two converged review rounds. One low-priority test-standard finding is inline; no production correctness defect or existing P0/P1 thread was confirmed. There were no additional user focus points.
Critical checkpoints:
- Goal and proof: Hive CREATE accepts Parquet gzip; FE sends the existing GZ enum, and BE selects Arrow Parquet GZIP for Hive, Iceberg data, and format-v2 position-delete files. Added FE unit and external regression cases cover this intent, but this review did not execute them.
- Scope and parallel paths: The shared helper preserves PLAIN, SNAPPY, ZSTD, and LZ4 mappings. Iceberg INSERT/OVERWRITE/REWRITE, DELETE, and UPDATE/MERGE use the appropriate table, delete, and merge sink fields; no omitted parallel codec path was found.
- Concurrency and lifecycle: The change adds no shared mutable state, thread, lock, or static initializer. Existing writer open/close, created-file cleanup, commit-data reporting, and failure propagation were traced; no newly reachable leak, deadlock, or invalid commit was substantiated.
- Configuration, compatibility, and persistence: No new config, thrift/protobuf field, FE-to-BE variable, edit-log state, or transaction protocol is introduced. The existing GZ wire value and standard Parquet GZIP codec are used; no new mixed-version data-corruption path was found.
- Conditions, errors, and data writes: Unsupported codecs still return non-OK status; valid gzip reaches the existing atomic write/commit flow. The ORC gzip regression case is intentionally excluded because ORC uses zlib.
- Tests and results: The new SQL checks read rows and inspect Parquet footer codec. Their deterministic expected results use assertions instead of generated .out cases; the inline P3 asks for the repository-required oracle. No changed expected-output file was presented as executed evidence.
- Observability, memory, and performance: The mapping runs once per file, adds no hot-row work or new significant allocation, and existing status/log paths are sufficient. No new external request or dynamic artifact loading was introduced.
Review was static by the runner contract: no builds, tests, or source modifications were performed. The final sweep covered all 10 changed paths and found no unresolved candidate.
| "mode" = "parquet_metadata" | ||
| ) | ||
| """ | ||
| assertEquals("GZIP", gzipCodec[0][0].toString().toUpperCase()) |
There was a problem hiding this comment.
[P3] Record deterministic GZIP query results in generated .out files
These new row and footer checks use assertEquals for fixed SQL results, but the repository's regression-test standard requires qt/order_qt cases with .out generated by the test runner. The neighboring LZ4 codec checks already use that pattern. Please convert this Hive GZIP check and the new Iceberg GZIP row/footer checks to recorded queries, with ORDER BY where needed, and generate their expected outputs through the regression script.
TPC-H: Total hot run time: 29256 ms |
TPC-DS: Total hot run time: 151855 ms |
ClickBench: Total hot run time: 24.75 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage `` 🎉 |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
…#68854) Issue Number: N/A Related PR: apache#64723 Problem Summary: Iceberg tables with `write.parquet.compression-codec = gzip` (the default before Iceberg 1.4) and Hive tables with `parquet.compression = GZIP` could not be written by Doris: the BE Parquet writers only accepted PLAIN/SNAPPY/ZSTD/LZ4 and failed with `[INTERNAL_ERROR]Unsupported compress type GZ with parquet`, while Spark/Trino wrote the same table fine. - BE: map `TFileCompressType.GZ` to `TParquetCompressionType.GZIP`, and move the whole `TFileCompressType` -> `TParquetCompressionType` mapping into `ParquetBuildHelper` so the Iceberg data-file writer, the Iceberg delete-file writer and the Hive Parquet writer share one copy. - FE: accept `gzip` for Parquet in the Hive `CREATE TABLE` compression allow-list. Tests: the Iceberg Parquet-compression suite now writes and reads gzip data and merge-on-read delete files and checks the codec with `parquet_meta()`; the Hive DDL suite adds gzip to the Parquet compression matrix; FE unit tests cover the gzip allow-list and the codec mapping. None - Test <!-- At least one of them must be included. --> - [x] Regression test - [x] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [x] Yes. <!-- Explain the behavior change --> Iceberg/Hive Parquet writes with GZIP no longer fail; the file is written with the standard Parquet GZIP codec, the same codec Spark/Trino write for that table property. - Does this need documentation? - [x] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
### What problem does this PR solve? Issue Number: N/A Related PR: apache#66348, apache#68854, apache#69376 Problem Summary: Partition writers call open before registering a new writer in the partition map. If the output file is created but the Parquet or ORC transformer then fails to open, the table writer cannot reach that writer through its close path. Clean up the created file at the open failure boundary so the error cannot leave an orphan, matching the lifecycle hardening introduced on master by apache#66348. ### Release note None ### Check List (For Author) - Test - [ ] Regression test - [ ] Unit Test - [x] Manual test: repository clang-format check and direct compilation of the modified BE writer translation unit passed. - Behavior changed: - [x] No. - Does this need documentation? - [x] No.
Issue Number: N/A Related PR: apache#68854, apache#69338 Problem Summary: The Iceberg data, position-delete, and Hive Parquet writers created their output file before validating the requested Parquet compression codec. For an unsupported codec, the Iceberg data writer then attempted to delete an open file, while the other writers returned after creating the file. This made error cleanup depend on filesystem behavior and could leave an orphan file. Resolve the codec before calling create_file so invalid codecs fail without creating any output file, and add a regression test for the failure path. None - Test - [x] Unit Test: added UnsupportedParquetCodecDoesNotCreateFile; not executed locally per request, CI will run it. - [ ] Regression test - [ ] Manual test - [ ] No need to test or manual test. Explain why - Behavior changed: - [x] No. - Does this need documentation? - [x] No.
Issue Number: N/A Related PR: apache#68854, apache#69338 Problem Summary: The Iceberg data, position-delete, and Hive Parquet writers created their output file before validating the requested Parquet compression codec. For an unsupported codec, the Iceberg data writer then attempted to delete an open file, while the other writers returned after creating the file. This made error cleanup depend on filesystem behavior and could leave an orphan file. Resolve the codec before calling create_file so invalid codecs fail without creating any output file, and add a regression test for the failure path. None - Test - [x] Unit Test: added UnsupportedParquetCodecDoesNotCreateFile; not executed locally per request, CI will run it. - [ ] Regression test - [ ] Manual test - [ ] No need to test or manual test. Explain why - Behavior changed: - [x] No. - Does this need documentation? - [x] No.
Issue Number: N/A Related PR: apache#68854, apache#69338 Problem Summary: The Iceberg data, position-delete, and Hive Parquet writers created their output file before validating the requested Parquet compression codec. For an unsupported codec, the Iceberg data writer then attempted to delete an open file, while the other writers returned after creating the file. This made error cleanup depend on filesystem behavior and could leave an orphan file. Resolve the codec before calling create_file so invalid codecs fail without creating any output file, and add a regression test for the failure path. None - Test - [x] Unit Test: added UnsupportedParquetCodecDoesNotCreateFile; not executed locally per request, CI will run it. - [ ] Regression test - [ ] Manual test - [ ] No need to test or manual test. Explain why - Behavior changed: - [x] No. - Does this need documentation? - [x] No.
Issue Number: N/A Related PR: apache#68854, apache#69338 Problem Summary: The Iceberg data, position-delete, and Hive Parquet writers created their output file before validating the requested Parquet compression codec. For an unsupported codec, the Iceberg data writer then attempted to delete an open file, while the other writers returned after creating the file. This made error cleanup depend on filesystem behavior and could leave an orphan file. Resolve the codec before calling create_file so invalid codecs fail without creating any output file, and add a regression test for the failure path. None - Test - [x] Unit Test: added UnsupportedParquetCodecDoesNotCreateFile; not executed locally per request, CI will run it. - [ ] Regression test - [ ] Manual test - [ ] No need to test or manual test. Explain why - Behavior changed: - [x] No. - Does this need documentation? - [x] No.
) ### What problem does this PR solve? Issue Number: N/A Related PR: #68854, #69338 Problem Summary: The Iceberg data, position-delete, and Hive Parquet writers created their output file before validating the requested Parquet compression codec. For an unsupported codec, the Iceberg data writer then attempted to delete an open file, while the other writers returned after creating the file. This made error cleanup depend on filesystem behavior and could leave an orphan file. Resolve the codec before calling `create_file` so invalid codecs fail without creating any output file, and add a regression test for the failure path. ### Release note None ### Check List (For Author) - Test - [ ] Regression test - [x] Unit Test: added `UnsupportedParquetCodecDoesNotCreateFile`; CI will run it. - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason - Behavior changed: - [x] No. - [ ] Yes. - Does this need documentation? - [x] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label
What problem does this PR solve?
Issue Number: N/A
Related PR: #64723
Problem Summary:
Iceberg tables with
write.parquet.compression-codec = gzip(the default before Iceberg 1.4) and Hivetables with
parquet.compression = GZIPcould not be written by Doris: the BE Parquet writers onlyaccepted PLAIN/SNAPPY/ZSTD/LZ4 and failed with
[INTERNAL_ERROR]Unsupported compress type GZ with parquet, while Spark/Trino wrote the same table fine.TFileCompressType.GZtoTParquetCompressionType.GZIP, and move the wholeTFileCompressType->TParquetCompressionTypemapping intoParquetBuildHelperso the Icebergdata-file writer, the Iceberg delete-file writer and the Hive Parquet writer share one copy.
gzipfor Parquet in the HiveCREATE TABLEcompression allow-list.Tests: the Iceberg Parquet-compression suite now writes and reads gzip data and merge-on-read delete
files and checks the codec with
parquet_meta(); the Hive DDL suite adds gzip to the Parquetcompression matrix; FE unit tests cover the gzip allow-list and the codec mapping.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)