Dongming Liu created CALCITE-1961:
-------------------------------------
Summary: RelToSqlConverter error when join with NOT equals conditon
Key: CALCITE-1961
URL: https://issues.apache.org/jira/browse/CALCITE-1961
Project: Calcite
Issue Type: Bug
Affects Versions: 1.11.0
Reporter: Dongming Liu
Assignee: Julian Hyde
For SQL:
{code:java}
select c_custkey from customer join orders on c_custkey = o_custkey and
o_comment not like '%unusual%accounts%';
{code}
Its RelNode has a JOIN that condition as follow:
{code:java}
condition = {RexCall@7367} "AND(=($0, $9), $17)"
op = {SqlBinaryOperator@7377} "AND"
operands = {RegularImmutableList@7378} size = 2
0 = {RexCall@7383} "=($0, $9)"
1 = {RexInputRef@7384} "$17"
type = {BasicSqlType@7379} "BOOLEAN"
digest = "AND(=($0, $9), $17)"
{code}
The second operand of AND is a RexInputRef.
When I call the RelToSqlConverter to convert the RelNode to SqlNode, I have
exception as follows:
{code:java}
java.lang.AssertionError: Internal error: While invoking method 'public
org.apache.calcite.rel.rel2sql.SqlImplementor$Result
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:795)
~[classes/:na]
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
~[classes/:na]
at
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:88)
~[classes/:na]
at
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:92)
~[classes/:na]
{code}
*convertConditionToSqlNode* be called to build the join condition by
RelToSqlConverter, and it has follow code:
{code:java}
if (!(node instanceof RexCall)) {
throw new AssertionError(node);
}
{code}
RexInputRef is obviously not a RexCall.
Is this a bug? And is there any methods to convert RelNode like this to SqlNode?
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)