LadyForest opened a new pull request, #21507:
URL: https://github.com/apache/flink/pull/21507
## What is the purpose of the change
This pull request aims to fix the issue that the column constraint lacks the
not enforced check.
```sql
CREATE TABLE foo (
a INT PRIMARY KEY, -- currently this passes the validation, but it should
be `a INT PRIMARY KEY NOT ENFORCED`
b STRING
) WITH (...)
```
## Brief change log
Currently, the constraint check(on the duplicate primary key, unique key,
and enforced mode) spreads over the parse and conversion phase(see
`SqlCreateTable#validate` and
`SqlToOperatoinConverter#validateTableConstraint`).
To improve this, introduce a `SqlConstraintValidator` to perform the unified
check for both column and table constraints.
The logic of`SqlToOperatoinConverter#validateTableConstraint` is moved to
`SqlConstraintValidator`.
## Verifying this change
This change added tests and can be verified as follows:
- FlinkSqlParserImplTest
- SqlToOperationConverterTest
- HBaseConnectorITCase
- HiveServer2EndpointITCase
## 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 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 introduces a new feature? no
- If yes, how is the feature documented? not applicable
--
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]