feat(stage): support ORC unload#20123
Merged
youngsofun merged 3 commits intoJul 13, 2026
Merged
Conversation
6199da0 to
21fb58b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ORC support for COPY INTO unload in the stage storage subsystem, reusing a shared “columnar unload” writer flow alongside existing Arrow/Parquet handling while keeping ORC-specific schema/type validation and Arrow-compat conversions local to the stage crate.
Changes:
- Add ORC unload pipeline + writer processor built on
orc-rust::ArrowWriter, including Databend-type validation and Arrow view-array compatibility conversions. - Refactor Arrow + Parquet unload writers to share a new generic
ColumnarFileWriter/ColumnarFileEncoderabstraction. - Add logic tests for ORC unload roundtrip, max_file_size behavior, and unsupported-type reporting; expand metadata-format coverage.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/nox/suites/copy/test_orc.py | Adds ORC unload logic tests (roundtrip, max_file_size, unsupported type error). |
| tests/nox/suites/copy/test_metadata.py | Includes ORC/Avro in metadata-column validation matrix; adjusts column reference logic and query types. |
| src/query/storages/stage/src/append/stage_sink_table.rs | Routes ORC format to a new ORC append pipeline during unload. |
| src/query/storages/stage/src/append/parquet_file/writer_processor.rs | Refactors Parquet unload writer to use the shared columnar writer abstraction. |
| src/query/storages/stage/src/append/orc_file/writer_processor.rs | Implements ORC encoder/writer processor, including schema validation and Arrow compatibility conversions. |
| src/query/storages/stage/src/append/orc_file/pipeline.rs | Adds ORC unload pipeline wiring with file-size limiting integration. |
| src/query/storages/stage/src/append/orc_file/mod.rs | Introduces the ORC append module and exports the pipeline entrypoint. |
| src/query/storages/stage/src/append/mod.rs | Registers the new ORC module and re-exports its append function. |
| src/query/storages/stage/src/append/column_based/mod.rs | Exposes the new shared columnar file-writer module. |
| src/query/storages/stage/src/append/column_based/file_writer.rs | Introduces shared ColumnarFileWriter processor + ColumnarFileEncoder trait for columnar unload formats. |
| src/query/storages/stage/src/append/arrow_file/writer_processor.rs | Refactors Arrow IPC unload writer to use the shared columnar writer abstraction. |
| src/query/storages/stage/Cargo.toml | Adds orc-rust dependency to the stage storage crate. |
| src/query/formats/src/file_format_type.rs | Treats ORC like Parquet for stage format MIME typing (application/octet-stream). |
| Cargo.lock | Locks the new orc-rust dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sundy-li
approved these changes
Jul 10, 2026
21fb58b to
2d83561
Compare
Member
Author
|
Error: [LicenseManager] Feature 'private_task' requires Databend Enterprise Edition license. License key expired for tenant: test_tenant. Learn more at https://docs.databend.com/guides/products/dee/ |
Merged
via the queue into
databendlabs:main
with commit Jul 13, 2026
22a7627
176 of 178 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
Add ORC support for
COPY INTOunload.This is needed so users can write stage output as ORC in addition to existing columnar formats. The implementation reuses the shared columnar unload processor logic for Arrow, Parquet, and ORC, while keeping ORC-specific encoding and type validation local to the stage storage crate.
The ORC writer currently follows the supported write path of
orc-rust::ArrowWriter, not the full ORC specification type matrix. Unsupported Databend types return a user-facingUnimplementederror before Arrow schema conversion. String and binary view arrays are converted to ORC-writer-compatible Arrow arrays before writing.Tests
Validated with:
cargo fmt --checkcargo check -p databend-common-storages-stageenv PYTHONPYCACHEPREFIX=/private/tmp/databend_pycache python3 -m py_compile tests/nox/suites/copy/test_orc.py tests/nox/suites/copy/test_metadata.py tests/nox/suites/copy/test_avro.pyType of change
This change is