[
https://issues.apache.org/jira/browse/CALCITE-2404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16566184#comment-16566184
]
Julian Hyde commented on CALCITE-2404:
--------------------------------------
I agree that DOT should not be used in RexNode land. The following patch can
enforce this:
{noformat}
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlDotOperator.java
b/core/src/main/java/org/apache/calcite/sql/fun/SqlDotOperator.java
index 08786249a..e10ba4ca5 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlDotOperator.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlDotOperator.java
@@ -39,6 +39,7 @@
import org.apache.calcite.sql.validate.SqlValidator;
import org.apache.calcite.sql.validate.SqlValidatorScope;
import org.apache.calcite.sql.validate.SqlValidatorUtil;
+import org.apache.calcite.util.Litmus;
import org.apache.calcite.util.Static;
import java.util.Arrays;
@@ -145,6 +146,10 @@ private SqlSingleOperandTypeChecker getChecker(RelDataType
operandType) {
}
}
+ @Override public boolean validRexOperands(int count, Litmus litmus) {
+ return false; // DOT is valid only for SqlCall not for RexCall
+ }
+
@Override public String getAllowedSignatures(String name) {
return "<A>.<B>";
}
{noformat}
That said, after your change, DOT is no longer used in RexCall;
{{testArrayOfRecord}} is failing because of an ITEM operator. ITEM should be
allowed in both SqlCall and RexCall.
> Accessing structured-types is not implemented by the runtime
> ------------------------------------------------------------
>
> Key: CALCITE-2404
> URL: https://issues.apache.org/jira/browse/CALCITE-2404
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: Stamatis Zampetakis
> Assignee: Julian Hyde
> Priority: Blocker
>
> Queries on tables containing structured types cannot be executed by the
> Calcite runtime. A plan like the one that follows (taken from CALCITE-2220)
> can be translated to neither Bindable nor EnumerableConvention.
>
> {noformat}
> LogicalProject(EXPR$0=[$0])
> LogicalProject(EXPR$0$0=[ITEM($6, 1).EMPNO], EXPR$0$1=[ITEM($6, 1).ENAME],
> EXPR$0$2=[ITEM($6, 1).DETAIL])
> LogicalProject(DEPTNO=[$0], NAME=[$1], TYPE=[$2.TYPE], DESC=[$2.DESC],
> A=[$2.OTHERS.A], B=[$2.OTHERS.B], EMPLOYEES=[$3])
> LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]])
> {noformat}
>
> More precisely, if a logical plan contains a RexFieldAccess expression that
> does not refer to a RexCorrelVariable it cannot be handled by the
> RexToLixTranslator. The translation will fail when calling
> [RexToLixTranslator#translate0|[https://github.com/apache/calcite/blob/5bbc501a565494442784f65870a20cd65a5016f4/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java#L686]].
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)