Repository navigation
[datafusion] Support persistent CREATE TABLE AS SELECT - #1448
SteNicholas wants to merge 1 commit into
Conversation
5224a29 to
750c4d4
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
Persistent CTAS has end-to-end value. All 19 CTAS cases and 103 related DataFusion cases passed locally. The filesystem catalog change below blocks ordinary table creation on existing backends.
750c4d4 to
178d008
Compare
|
@JingsongLi, thanks for running the CTAS and DataFusion suites. I fixed the ordinary All 19 CTAS tests passed on this revision. The catalog regression test disables conditional write and rename on a local filesystem operator, registers an existing Parquet file as a Format Table, and reads its rows back. Regression test Rebased |
JingsongLi
left a comment
There was a problem hiding this comment.
Persistent CTAS has end-to-end value. I reran the ordinary CREATE regression with conditional writes and renames disabled, along with the strict creation race and conditional rename error tests. All 48 filesystem catalog tests, the REST create case, 19 existing CTAS tests and 92 related DataFusion tests passed. The additional existing-target probe found the no-op issue below.
e487175 to
f78635d
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
Reviewed f78635d4 for CTAS correctness and SQL compatibility.
f78635d to
da3a947
Compare
da3a947 to
690b10e
Compare
|
Thanks for the review, @JingsongLi. All four fixes are in
|
JingsongLi
left a comment
There was a problem hiding this comment.
Persistent CTAS addresses the materialization workflow in #1425. On 8aa3030c, 123 DataFusion tests, 172 REST catalog tests, and targeted conditional-publication tests passed, including lost S3 responses. One ordinary CREATE compatibility issue remains.
690b10e to
d1314eb
Compare
|
Thanks for reviewing and running the tests, @JingsongLi. The ordinary On the updated head, 1,095 focused tests passed on Rust 1.98.0 (594 DataFusion, 328 core with S3 enabled, and 173 REST catalog), including the lost S3 response and mount fallback regressions. Formatting and |
JingsongLi
left a comment
There was a problem hiding this comment.
Persistent CTAS covers the durable materialization workflow in #1425. On d1314eb3, I reran 41 existing CTAS, time-travel, and read_files tests, 26 matching core publication tests, and 25 existing S3 tests. The native mount fallback and S3 lost-response cases pass locally. I reproduced a wrong result in an existing snapshot join and a compatibility failure in ordinary filesystem CREATE TABLE against an S3 mock. The Windows unit job also fails both new native publication tests. Windows CI
0f32e5a to
c0e1c68
Compare
|
Thanks for reproducing these issues, @JingsongLi. The three fixes are on the updated PR head. Review · Commit
Before the CI dependency fixes, 400 focused tests passed on macOS with Rust 1.98.0 (41 DataFusion, 185 core with S3 enabled, and 174 REST catalog). The standalone GCS compilation check, formatting and The amended commit also adds the missing |
Materializing query results required separate CREATE and INSERT statements. Persistent CTAS derives the destination schema and rows from one analyzed query. Exclusive creation establishes ownership before population. A lost create response leaves ownership uncertain. - Infer and populate native Paimon tables from bounded queries. Preserve output types and nullability for empty results and apply table options, comments and keys, addressing apache#1425. - Resolve sources and SQL functions in the session namespace. Preserve quoted identifiers and snapshot scopes, register time-travel prepared statements in the caller's session and reject unsafe LATERAL references. - Check target metadata and skip existing targets and definite conflicts with IF NOT EXISTS. Require exclusive creation, verify REST completion and conditional upload responses, and preserve ordinary CREATE on storage without conditional publication. - Retain the table after population failure, discard owned uncommitted files, and finish in-flight commits after caller cancellation. Keep prepared files when snapshot publication may have succeeded.
c0e1c68 to
b5efd68
Compare
Purpose
Closes #1425.
Materialize a bounded, read-only DataFusion query as a persistent native Paimon table. The query defines the destination schema even when it returns no rows.
scoresresolves in the session's current catalog and database, independently of the destination namespace.Brief change log
IF NOT EXISTSskips existing targets and definite create conflicts. Uncertain publication outcomes propagate as errors.Tests
On Rust 1.98.0, 400 focused tests passed on macOS for the code in
c0e1c689.read_files, including the fully qualified snapshot/live join and its persisted result.storage-s3enabled, including native mount fallback, direct S3 HTTP 501 fallback, lost responses, redirects and mismatched storage error responses.The standalone
storage-gcscompilation check, formatting andgit diff --checkalso passed.API and Format
Catalog::check_table_existsdefaults toload_table. Filesystem and REST catalogs check metadata without opening the table's data backend.Catalog::create_table_exclusivedefaults toError::Unsupported. Filesystem CTAS requires atomic, no-overwrite publication ofschema-0. REST CTAS requires server-enforced exclusive creation and a direct completion response.CREATE TABLEcan fall back to a plain write when conditional publication is definitively unsupported, including on writable mounts or after a first-attempt S3 HTTP 501. A conditional object upload counts as a definite conflict only when the HTTP status and storage error agree and there was no replay.CTAS writes the existing Paimon schema, snapshot and data-file formats. It rejects explicit column declarations,
OR REPLACEandTIMEoutputs finer than milliseconds.Documentation
The SQL reference describes syntax, supported types, concurrency and recovery after an uncertain create or commit. The DataFusion README includes a session-namespace example.
SQL reference · DataFusion README
🤖 Assisted with Codex.