LadyForest commented on code in PR #20652:
URL: https://github.com/apache/flink/pull/20652#discussion_r1045862045


##########
flink-connectors/flink-connector-hbase-1.4/src/test/java/org/apache/flink/connector/hbase1/HBaseConnectorITCase.java:
##########
@@ -152,7 +152,7 @@ public void testTableSourceFieldOrder() {
 
         tEnv.executeSql(
                 "CREATE TABLE hTable ("
-                        + " rowkey INT PRIMARY KEY,"
+                        + " rowkey INT PRIMARY KEY NOT ENFORCED,"

Review Comment:
   > Why need to modify this? Is it a break change?
   
   Yes. The current 'NOT ENFORCED' constraint only performs on the table 
constraint, leave column constraint unchecked. This is found at testing phase.
   E.g. test on flink-1.16
   ```sql
   Flink SQL> create table T (f0 int not null primary key, f1 string) with 
('connector' = 'datagen');
   [INFO] Execute statement succeed.
   
   Flink SQL> explain select * from T;
   == Abstract Syntax Tree ==
   LogicalProject(f0=[$0], f1=[$1])
   +- LogicalTableScan(table=[[default_catalog, default_database, T]])
   
   == Optimized Physical Plan ==
   TableSourceScan(table=[[default_catalog, default_database, T]], fields=[f0, 
f1])
   
   == Optimized Execution Plan ==
   TableSourceScan(table=[[default_catalog, default_database, T]], fields=[f0, 
f1])
   
   
   Flink SQL> create table S (f0 int not null, f1 string, primary key(f0)) with 
('connector' = 'datagen');
   [ERROR] Could not execute SQL statement. Reason:
   org.apache.flink.table.api.ValidationException: Flink doesn't support 
ENFORCED mode for PRIMARY KEY constraint. ENFORCED/NOT ENFORCED  controls if 
the constraint checks are performed on the incoming/outgoing data. Flink does 
not own the data therefore the only supported mode is the NOT ENFORCED mode
   ```



-- 
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