You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "takaaki7 (via GitHub)" <gi...@apache.org> on 2026/05/23 15:20:16 UTC
[PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
takaaki7 opened a new pull request, #4962:
URL: https://github.com/apache/calcite/pull/4962
## Summary
- Fixes [CALCITE-7546](https://issues.apache.org/jira/browse/CALCITE-7546): `SqlToRelConverter` throws `NullPointerException: fieldNames` for `UNNEST(<array>) AS <alias>` (no column list) under a conformance whose `allowAliasUnnestItems()` returns true (`SqlConformanceEnum.PRESTO`, plus user conformances overriding the flag).
- `convertFrom`'s `AS` branch passes `fieldNames=null` to `convertUnnest` when the AS clause omits a column list. The PRESTO-only branch then called `requireNonNull(fieldNames, "fieldNames")` and threw NPE.
- Fall back to default item aliases derived from `SqlUtil#deriveAliasFromOrdinal`, matching the names that `SqlUnnestOperator#inferReturnType` uses during validation. This keeps the relational row type aligned with the validator's underlying namespace, so both struct (e.g. `UNNEST(d.employees) AS e` → `e.empno`) and scalar element types (e.g. `UNNEST(d.admins) AS a` → `a`) resolve correctly.
## Test plan
- [x] Added `testAliasUnnestArrayPlanWithoutColumnList` (struct array, PRESTO) — reproduces the NPE on `main`, passes after the fix.
- [x] Added `testAliasUnnestScalarArrayPlanWithoutColumnList` (scalar varchar array, PRESTO).
- [x] Existing PRESTO/UNNEST regression tests still pass: `testAliasUnnestArrayPlanWithSingleColumn`, `testAliasUnnestArrayPlanWithDoubleColumn`, `testUnnestArrayPlan`, `testUnnestArrayPlanAs`.
- [x] Full `SqlToRelConverterTest` (663) and `RelToSqlConverterTest` (579) suites pass.
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4530264229
We may need to wait for the 1.43 release to merge this
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "takaaki7 (via GitHub)" <gi...@apache.org>.
takaaki7 commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4832177088
@mihaibudiu ptal
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4793834411
@takaaki7 let's finalize this: can you please fix the conflicts and squash the commits?
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4529551254
Please squash the commits so we can merge this
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "takaaki7 (via GitHub)" <gi...@apache.org>.
takaaki7 commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4796702749
Squashed.
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4525842764
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962)
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4962:
URL: https://github.com/apache/calcite/pull/4962#discussion_r3293843014
##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -1939,6 +1939,26 @@ public static void checkActualAndReferenceFiles() {
sql(sql).withConformance(SqlConformanceEnum.PRESTO).ok();
}
+ /**
+ * Test case for
+ * <a href="https://issues.apache.org/jira/browse/CALCITE-7546">[CALCITE-7546]
+ * NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under
+ * conformance with allowAliasUnnestItems=true</a>.
+ */
+ @Test void testAliasUnnestArrayPlanWithoutColumnList() {
Review Comment:
Neither of the test cases here matches the one in the issue, but they look close enough.
I hope that you have validated that the test in the issue passes as well.
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4803563581
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962)
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "takaaki7 (via GitHub)" <gi...@apache.org>.
takaaki7 commented on code in PR #4962:
URL: https://github.com/apache/calcite/pull/4962#discussion_r3294053409
##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -1939,6 +1939,26 @@ public static void checkActualAndReferenceFiles() {
sql(sql).withConformance(SqlConformanceEnum.PRESTO).ok();
}
+ /**
+ * Test case for
+ * <a href="https://issues.apache.org/jira/browse/CALCITE-7546">[CALCITE-7546]
+ * NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under
+ * conformance with allowAliasUnnestItems=true</a>.
+ */
+ @Test void testAliasUnnestArrayPlanWithoutColumnList() {
Review Comment:
Thanks, I've added the test.
--
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
Re: [PR] [CALCITE-7546] NullPointerException in SqlToRelConverter for UNNEST(array) AS alias under conformance with allowAliasUnnestItems=true [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4962:
URL: https://github.com/apache/calcite/pull/4962#issuecomment-4527720602
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4962&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4962&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4962&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4962)
--
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