Repository navigation
[datafusion] Support persistent CREATE TABLE AS SELECT - #1448
Open
SteNicholas wants to merge 1 commit into
Open
SteNicholas wants to merge 1 commit into
SteNicholas wants to merge 1 commit into
Conversation
JingsongLi
reviewed
Nov 19, 2026
JingsongLi
reviewed
Nov 19, 2026
Materializing a query in a persistent Paimon table requires an explicit schema and a separate INSERT. CTAS must infer and populate the target from one resolved source plan, preserving session name resolution and handling creation races and uncertain publication. - Infer native CTAS schemas from analyzed query output, including empty results. Preserve nullability and geospatial metadata, and validate partition keys, table options and comments, addressing apache#1425. - Resolve source tables and SQL functions in the session namespace, preserving quoted names and qualified time-travel references. Reuse the analyzed plan and normalize scalar and nested Arrow layouts. - Skip existing targets with IF NOT EXISTS before source planning. Use strict catalog creation and publish initial schemas atomically to leave a concurrent creator's table and rows untouched. - Retain the table after population errors. Clean up owned output on pre-commit failures and cancellation, finish commits already started and retain prepared files when publication may have succeeded.
SteNicholas
force-pushed
the
PAIMON-1425
branch
from
November 19, 2026 12:35
5224a29 to
750c4d4
Compare
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.
Purpose
Linked issue: closes #1425
Materializing a query in a persistent Paimon table currently requires an explicit schema and a separate INSERT. Add native
CREATE TABLE AS SELECTto the DataFusion SQL context, deriving the schema and rows from one resolved source plan.Brief change log
IF NOT EXISTSbefore source planning. Use strict catalog creation and atomic initial-schema publication so a concurrent creator's table is never overwritten or populated.Tests
--all-targets --features vortex -- -D warningsusing Rust 1.98.0.API and Format
CTAS uses the existing catalog, table write and commit APIs; public Rust APIs and stored schema, snapshot and data-file formats are unchanged. Filesystem table creation now requires atomic publication of the initial schema. As with ordinary INSERT, callers must coordinate DROP, RENAME and table replacement with active writers. New CTAS destinations are native Paimon tables;
OR REPLACEand external-engine CTAS remain unsupported.Documentation
Update
docs/src/sql.mdand the DataFusion README with CTAS syntax, inference, namespace resolution,IF NOT EXISTS, supported types and precision, concurrent DDL requirements, and recovery after failure or cancellation.🤖 Assisted with Codex.