JingsongLi commented on a change in pull request #11011:
[FLINK-15658][table-planner-blink] Fix duplicate field names exception when
join on the same key multiple times
URL: https://github.com/apache/flink/pull/11011#discussion_r374497851
##########
File path:
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/utils/KeySelectorUtil.java
##########
@@ -44,20 +44,20 @@
public static BaseRowKeySelector getBaseRowSelector(int[] keyFields,
BaseRowTypeInfo rowType) {
if (keyFields.length > 0) {
LogicalType[] inputFieldTypes =
rowType.getLogicalTypes();
- String[] inputFieldNames = rowType.getFieldNames();
LogicalType[] keyFieldTypes = new
LogicalType[keyFields.length];
- String[] keyFieldNames = new String[keyFields.length];
for (int i = 0; i < keyFields.length; ++i) {
keyFieldTypes[i] =
inputFieldTypes[keyFields[i]];
- keyFieldNames[i] =
inputFieldNames[keyFields[i]];
}
- RowType returnType = RowType.of(keyFieldTypes,
keyFieldNames);
+ // do not provide field names for the result key type,
+ // because we may have duplicate key fields and the
field names may conflict
+ RowType returnType = RowType.of(keyFieldTypes);
RowType inputType = RowType.of(inputFieldTypes,
rowType.getFieldNames());
Review comment:
`rowType.toRowType()`
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services