davidradl commented on code in PR #27222:
URL: https://github.com/apache/flink/pull/27222#discussion_r2513568045


##########
flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlCreateMaterializedTable.java:
##########
@@ -150,20 +170,33 @@ public SqlNode getAsQuery() {
         return asQuery;
     }
 
+    /** Returns the column constraints plus the table constraints. */
+    public List<SqlTableConstraint> getFullConstraints() {
+        return SqlConstraintValidator.getFullConstraints(tableConstraints, 
columnList);
+    }
+
+    @Override
+    public void validate() throws SqlValidateException {
+        if (!isSchemaWithColumnsIdentifiersOnly()) {
+            
SqlConstraintValidator.validateAndChangeColumnNullability(tableConstraints, 
columnList);
+        }
+    }
+
+    public boolean isSchemaWithColumnsIdentifiersOnly() {
+        // CREATE MATERIALIZED TABLE supports passing only column identifiers 
in the column list. If
+        // the first column in the list is an identifier, then we assume the 
rest of the
+        // columns are identifiers as well.
+        return !getColumnList().isEmpty() && getColumnList().get(0) instanceof 
SqlIdentifier;
+    }
+
     @Override
     public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
         writer.keyword("CREATE MATERIALIZED TABLE");
         tableName.unparse(writer, leftPrec, rightPrec);
 
-        if (tableConstraint != null) {
-            writer.newlineAndIndent();
+        if (!columnList.isEmpty() || !tableConstraints.isEmpty() || watermark 
!= null) {

Review Comment:
   I am curious - can we have a watermark when there are no columns?



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