[FLINK-39726][table] Support USING CONNECTION clause in CREATE TABLE#28222
Open
lihaosky wants to merge 2 commits into
Open
[FLINK-39726][table] Support USING CONNECTION clause in CREATE TABLE#28222lihaosky wants to merge 2 commits into
lihaosky wants to merge 2 commits into
Conversation
Add an optional 'USING CONNECTION <identifier>' clause to the CREATE TABLE grammar (FLIP-529), parsed between PARTITIONED BY and WITH. The parsed identifier is carried on SqlCreateTable and SqlCreateTableLike via a new optional connection field that round-trips through unparse. The clause is intentionally restricted to plain CREATE TABLE and CREATE TABLE ... LIKE; using it with CTAS / RTAS raises a parser error (usingConnectionWithAsUnsupported).
Collaborator
snuyanzin
reviewed
May 22, 2026
…d tests Move the USING CONNECTION unparse logic to SqlUnparseUtils.unparseUsingConnection and emit USING / CONNECTION as separate SqlWriter.keyword calls. Add negative tests covering REPLACE TABLE AS and CREATE OR REPLACE TABLE AS, and tighten the failure-message regexes to match the exact resource string / line+column.
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.
What is the purpose of the change
Adds parser support for an optional
USING CONNECTION <identifier>clause inCREATE TABLEandCREATE TABLE ... LIKEstatements, per FLIP-529. This lets a table reference a previously registered connection (catalog object) for connector configuration:The clause is intentionally not allowed with CTAS / RTAS — those raise a parser error.
Brief change log
[ <USING> <CONNECTION> CompoundIdentifier() ]betweenPARTITIONED BYandWITHin theSqlCreateTableproduction.SqlCreateTable/SqlCreateTableLike: new optionalconnectionfield, constructor parameter,getConnection()getter,getOperandList()entry, andunparseoutput.SqlCreateTableAs/SqlReplaceTableAs: explicitly passnullforconnection; parser rejectsUSING CONNECTIONcombined withASvia a newParserResource#usingConnectionWithAsUnsupportedmessage.CREATE TABLE,CREATE TABLEwith partition/distribution, andCREATE TABLE ... LIKE; negative case for CTAS.Verifying this change
This change is covered by unit tests in
FlinkSqlParserImplTest:testCreateTableUsingConnectiontestCreateTableUsingConnectionWithPartitionAndDistributiontestCreateTableLikeUsingConnectiontestCreateTableAsWithUsingConnectionFailsDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation