danny0405 commented on code in PR #9133:
URL: https://github.com/apache/hudi/pull/9133#discussion_r1255288699


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/CastMap.java:
##########
@@ -165,21 +192,132 @@ void add(int pos, LogicalType fromType, LogicalType 
toType) {
         }
         break;
       }
+      case ARRAY: {
+        if (from == ARRAY) {
+          LogicalType fromElementType =  fromType.getChildren().get(0);
+          LogicalType toElementType = toType.getChildren().get(0);
+          return array -> doArrayConversion((ArrayData) array, 
fromElementType, toElementType);
+        }
+        break;
+      }
+      case MAP: {
+        if (from == MAP) {
+          return map -> doMapConversion((MapData) map, fromType, toType);
+        }
+        break;
+      }
+      case ROW: {
+        if (from == ROW) {
+          // Assumption: InternalSchemaManager should produce a cast that is 
of the same size
+          return row -> doRowConversion((RowData) row, fromType, toType);
+        }
+        break;
+      }
       default:
     }
-    return null;
+    throw new IllegalArgumentException(String.format("Unsupported conversion 
for %s => %s", fromType, toType));

Review Comment:
   Do not throw `RuntimeException` in nested calling code path, it is very 
obscure for the invoker to get the perception of exceptions. Either throws a 
checked exception or return null as of before.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to