morrySnow commented on code in PR #64027:
URL: https://github.com/apache/doris/pull/64027#discussion_r3345841535
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -297,7 +297,15 @@ public Expression visitElementAt(ElementAt elementAt,
ExpressionRewriteContext c
Expression right = elementAt.right().accept(this, context);
elementAt = (ElementAt) elementAt.withChildren(left, right);
Expression coerced = TypeCoercionUtils.processBoundFunction(elementAt);
- if (isEnableVariantSchemaAutoCast(context)) {
+ // element_at over a STRUCT must be rewritten into struct_element. The
subscript form `s['f']`
+ // / `s[idx]` is parsed directly into an ElementAt (not an
UnboundFunction), so it never reaches
+ // visitUnboundFunction where the named call `element_at(s,'f')` gets
this same rewrite. Apply the
+ // shared ElementAt.rewriteWhenAnalyze() here so both syntaxes behave
identically; otherwise the
+ // BE receives element_at(struct) and aborts.
+ if (coerced instanceof RewriteWhenAnalyze) {
Review Comment:
maybe we need merge element_at and struct_element into one function
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]