danny0405 commented on a change in pull request #10096: 
[FLINK-14623][table-api] Add computed column information into TableSc…
URL: https://github.com/apache/flink/pull/10096#discussion_r343459074
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java
 ##########
 @@ -346,22 +322,137 @@ public static Builder builder() {
                return new Builder();
        }
 
+       //~ Tools 
------------------------------------------------------------------
+
+       /**
+        * Tools method to transform arrays of table names and types
+        * into a {@link TableColumn} list.
+        */
+       private static List<TableColumn> createTableColumns(
+                       String[] fieldNames,
+                       TypeInformation<?>[] fieldTypes) {
+                       DataType[] fieldDataTypes = 
fromLegacyInfoToDataType(fieldTypes);
+                       validateFields(fieldNames, fieldDataTypes);
+                       List<TableColumn> columns = new ArrayList<>();
+               for (int i = 0; i < fieldNames.length; i++) {
+                       columns.add(TableColumn.of(fieldNames[i], 
fieldDataTypes[i]));
+               }
+               return columns;
+       }
+
+       /** Fields sanity check. */
+       private static void validateFields(String[] fieldNames, DataType[] 
fieldTypes) {
 
 Review comment:
   I would avoid to introduce a class just for some validation tools, different 
with DescriptorValidator, we only have one `TableSchema`

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