wuchong commented on a change in pull request #11493: 
[FLINK-16160][table-common] Support computed column, proctime and watermark in 
Schema descriptor
URL: https://github.com/apache/flink/pull/11493#discussion_r399106947
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java
 ##########
 @@ -85,11 +111,25 @@ public Schema schema(TableSchema schema) {
         * @param fieldType the type information of the field
         */
        public Schema field(String fieldName, DataType fieldType) {
-               addField(fieldName, 
fieldType.getLogicalType().asSerializableString());
-               return this;
+               return field(fieldName, fieldType, null);
        }
 
 
+       /**
+        * Adds a field with the field name and the data type. Required.
+        * This method can be called multiple times. The call order of this 
method defines
+        * also the order of the fields in a row.
+        *
+        * @param fieldName the field name
+        * @param fieldType the type information of the field
+        * @param fieldExpr Computed column expression, it should be a 
SQL-style expression whose
+        *                  identifiers should be all quoted and expanded.
+        */
+       public Schema field(String fieldName, DataType fieldType, String 
fieldExpr) {
 
 Review comment:
   The `Schema` descriptor API should follow the DDL pattern, i.e. we shouldn't 
force users to give a quoted expression and an expression result type. 
   
   It is hard to determin what the result type is of `myfunc(myfunc1(a), b, 
c)`. 
   It is hard to write a quoted expression, e.g.
   ```
   `myfunc`(`myfunc1`(`a`), `b`, `c`)
   ```
   
   Could the planner to quote the expression and derive data type?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to