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


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/materializedtable/SqlCreateOrAlterMaterializedTableConverter.java:
##########
@@ -173,6 +178,13 @@ protected MergeContext getMergeContext(
                     
SqlCreateOrAlterMaterializedTableConverter.this.getQueryResolvedSchema(
                             sqlCreateMaterializedTable, context);
 
+            @Override
+            public boolean hasSchemaDefinition() {
+                final SqlNodeList sqlNodeList = 
sqlCreateMaterializedTable.getColumnList();
+                return !sqlNodeList.getList().isEmpty()
+                        && sqlNodeList.getList().get(0) instanceof 
SqlRegularColumn;

Review Comment:
   I am curious about this new method. Are there cases when the materialized 
table does not have columns? 
   Is it possible for the first column to be a metadata column? I assume the 
computed column would need to refer to an already defined regular column.
   
   I see the return of this turns into variable schemaDefinedInQuery - I am 
checking my understanding - does this mean that `a as `a1``  in your example. 
Would  a better name be `schemaDerivedInQuery,` as the schema is actually 
defined in the columns associated with the table not the select (query)  
   
   CREATE OR ALTER MATERIALIZED TABLE mt (
   `a` BIGINT NOT NULL, `b` STRING, `c` INT, `d` STRING, `a1` BIGINT NOT NULL) 
   AS SELECT a, b, c, d, a as `a1` FROM t3  



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