normanj-bitquill commented on code in PR #3802: URL: https://github.com/apache/calcite/pull/3802#discussion_r1635144310
########## core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java: ########## @@ -736,7 +737,7 @@ private boolean expandStar(List<SqlNode> selectItems, Set<String> aliases, if (!hasDynamicStruct || Bug.CALCITE_2400_FIXED) { // If some fields before star identifier, // we should move offset. - int offset = calculatePermuteOffset(selectItems); + int offset = Math.min(calculatePermuteOffset(selectItems), originalSize); Review Comment: @mihaibudiu It was possible to get an `IndexOutOfBoundsException` when correcting the field order (for CALCITE-2400). We need to make sure that the offset is not beyond the `selectItems` list. -- 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...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org