sbroeder commented on code in PR #5271:
URL: https://github.com/apache/calcite/pull/5271#discussion_r4135781934
##########
core/src/main/java/org/apache/calcite/sql/validate/AliasNamespace.java:
##########
@@ -162,6 +163,25 @@ protected AliasNamespace(
}
}
+ /**
+ * Returns whether an UNNEST call's array operand has a struct element type.
+ *
+ * <p>{@link SqlUnnestOperator#inferReturnType} produces a 1-field row for
+ * both struct arrays and scalar arrays. Only the structs have a real field
+ * name worth preserving.
+ */
+ private boolean isUnnestOfStructArray(SqlCall unnestCall) {
+ if (unnestCall.operandCount() != 1) {
+ return false;
+ }
+ if (validator.config().conformance().allowAliasUnnestItems()) {
+ return false;
+ }
+ final RelDataType operandType =
validator.getValidatedNodeType(unnestCall.operand(0));
+ final RelDataType componentType = operandType.getComponentType();
+ return componentType != null && componentType.isStruct();
Review Comment:
Ack. Both addressed.
--
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]