dawidwys opened a new pull request #11981:
URL: https://github.com/apache/flink/pull/11981
## What is the purpose of the change
This PR implements the logic behind `CREATE TABLE ... LIKE` clause. It does
not add a specific option/parameters to the `Operation` stack. The clause is
evaluated into a plain `CreateTableOperation` when converting from
`SqlCreateTable`.
## Brief change log
- Added `INCLUDING/EXCLUDING/OVERWRITING WATERMARKS` option.
The reason to separate the watermarks from generated columns is because
we support only a single watermark in a table. This becomes troublesome when
user wants to have a watermark on a different column than the source table. The
only way this can be achieved without watermarks is to `EXCLUDE GENERATED`.
That approach results in dropping the generated columns which might not be
intended. I think having a separate WATERMARKS option gives a more fine grained
control over the end table.
- Moved the validation from `SqlCreateTable#validate` to
`SqlToOperationConverter`.
With the `LIKE` clause `SqlCreateTable` is not self contained any more.
`SqlCreateTable` can e.g. define computed columns on columns inherited from the
source table. The validation can be performed only after merging valid features
which happens in the `SqlToOperationConverter`.
- Throw exception in the legacy planner if the CREATE TABLE ... LIKE is
present.
We do not support majority of the features that the CREATE TABLE ... LIKE
applies to. Therefore in order not to duplicate too much of the code I decided
not to support this clause in the old planner.
## Verifying this change
Added tests:
* MergeTableLikeUtilTest - tests the merging logic
* Tests in SqlToOperationConverterTest - tests supporting the like clause in
`SqlToOperationConverter`
* Added validation tests in `SqlToOperationConverterTest`
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / **no** / don't know)
- The runtime per-record code paths (performance sensitive): (yes / **no**
/ don't know)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** /
don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (**yes** / no)
- If yes, how is the feature documented? (not applicable / docs /
**JavaDocs** / not documented) -> docs to be done FLINK-17004
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]