You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "YiwenWu (via GitHub)" <gi...@apache.org> on 2024/06/01 06:55:57 UTC
Re: [PR] [CALCITE-6369] Expanding "star" gives ArrayIndexOutOfBoundsException … [calcite]
YiwenWu commented on code in PR #3802:
URL: https://github.com/apache/calcite/pull/3802#discussion_r1623163032
##########
core/src/main/java/org/apache/calcite/sql/validate/DelegatingScope.java:
##########
@@ -297,8 +298,17 @@ protected void addColumnNames(
namespace = map.get(tableName).namespace;
break;
default:
- throw validator.newValidationError(identifier,
- RESOURCE.columnAmbiguous(columnName));
+ // Allow if all namespaces are the same and the tables are not null
Review Comment:
I think that when this PR is merged, the column ambiguous problem will be solved, so no changes are needed here.
https://github.com/apache/calcite/pull/3797
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -633,6 +633,7 @@ private boolean expandStar(List<SqlNode> selectItems, Set<String> aliases,
if (!identifier.isStar()) {
return false;
}
+ final int offset = selectItems.size();
Review Comment:
If `offset` is judged here, then all fields before * will not permutation.
I recommend improving the `calculatePermuteOffset` method. like
```
int originSize = selectItems.size();
......
int offset = Math.min(calculatePermuteOffset(selectItems), originSize);
```
--
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-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org