lihaosky opened a new pull request, #28222:
URL: https://github.com/apache/flink/pull/28222

   ## What is the purpose of the change
   
   Adds parser support for an optional `USING CONNECTION <identifier>` clause 
in `CREATE TABLE` and `CREATE TABLE ... LIKE` statements, per 
[FLIP-529](https://cwiki.apache.org/confluence/display/FLINK/FLIP-529%3A+Connections+in+Flink+SQL+and+TableAPI).
 This lets a table reference a previously registered connection (catalog 
object) for connector configuration:
   
   ```sql
   CREATE TABLE orders (
       order_id INT,
       customer_id INT,
       amount DECIMAL(10, 2)
   ) USING CONNECTION mycat.mydb.mysql_prod
   WITH (
       'connector' = 'jdbc',
       'tables' = 'orders'
   );
   ```
   
   The clause is intentionally not allowed with CTAS / RTAS — those raise a 
parser error.
   
   ## Brief change log
   
   - Grammar: added optional `[ <USING> <CONNECTION> CompoundIdentifier() ]` 
between `PARTITIONED BY` and `WITH` in the `SqlCreateTable` production.
   - `SqlCreateTable` / `SqlCreateTableLike`: new optional `connection` field, 
constructor parameter, `getConnection()` getter, `getOperandList()` entry, and 
`unparse` output.
   - `SqlCreateTableAs` / `SqlReplaceTableAs`: explicitly pass `null` for 
`connection`; parser rejects `USING CONNECTION` combined with `AS` via a new 
`ParserResource#usingConnectionWithAsUnsupported` message.
   - Tests: positive cases for plain `CREATE TABLE`, `CREATE TABLE` with 
partition/distribution, and `CREATE TABLE ... LIKE`; negative case for CTAS.
   
   ## Verifying this change
   
   This change is covered by unit tests in `FlinkSqlParserImplTest`:
   - `testCreateTableUsingConnection`
   - `testCreateTableUsingConnectionWithPartitionAndDistribution`
   - `testCreateTableLikeUsingConnection`
   - `testCreateTableAsWithUsingConnectionFails`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes, parser-level 
syntax addition; planner / runtime wiring will come in follow-up subtasks of 
FLIP-529)
     - If yes, how is the feature documented? (not documented yet — user-facing 
docs to follow once the planner/runtime side lands)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to