danny0405 commented on code in PR #11031:
URL: https://github.com/apache/hudi/pull/11031#discussion_r1568440953
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/mor/MergeOnReadTableState.java:
##########
@@ -83,11 +96,20 @@ public int getOperationPos() {
}
public int[] getRequiredPositions() {
- final List<String> fieldNames = rowType.getFieldNames();
- return requiredRowType.getFieldNames().stream()
- .map(fieldNames::indexOf)
- .mapToInt(i -> i)
- .toArray();
+ List<String> fieldNames = rowType.getFieldNames();
+ List<String> expColumns = new ArrayList<>();
+ int[] pos = requiredRowType.getFieldNames().stream()
+ .mapToInt(fn -> {
+ if (!fieldNames.contains(fn.toLowerCase())) {
+ expColumns.add(fn);
+ }
+ return fieldNames.indexOf(fn.toLowerCase());
+ })
+ .toArray();
+ if (!expColumns.isEmpty()) {
+ throw new HoodieException("Column(s) " + String.join(", ", expColumns) +
" does not exists in the hudi table " + this.tableName + ".");
+ }
Review Comment:
Should we move the check into `HoodieTableFactory#createDynamicTableSource` ?
--
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]