danny0405 commented on a change in pull request #9843: [FLINK-14296] [Table 
SQL] Use Optional for optional parameters in parser module
URL: https://github.com/apache/flink/pull/9843#discussion_r334222975
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/operations/SqlToOperationConverter.java
 ##########
 @@ -107,29 +106,21 @@ private Operation convertCreateTable(SqlCreateTable 
sqlCreateTable) {
                }
 
                // set with properties
-               SqlNodeList propertyList = sqlCreateTable.getPropertyList();
                Map<String, String> properties = new HashMap<>();
-               if (propertyList != null) {
-                       propertyList.getList().forEach(p ->
-                               properties.put(((SqlTableOption) 
p).getKeyString().toLowerCase(),
-                                       ((SqlTableOption) p).getValueString()));
-               }
+               sqlCreateTable.getPropertyList().getList().forEach(p ->
+                       properties.put(((SqlTableOption) 
p).getKeyString().toLowerCase(),
+                               ((SqlTableOption) p).getValueString()));
 
                TableSchema tableSchema = createTableSchema(sqlCreateTable);
-               String tableComment = "";
-               if (sqlCreateTable.getComment() != null) {
-                       tableComment = 
sqlCreateTable.getComment().getNlsString().getValue();
-               }
+               String tableComment = sqlCreateTable.getComment().map(comment ->
+                       comment.getNlsString().getValue()).orElse("");
 
 Review comment:
   Well, i think we should keep it null as the default value.

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