[
https://issues.apache.org/jira/browse/CALCITE-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17347364#comment-17347364
]
Vladimir Sitnikov commented on CALCITE-4610:
--------------------------------------------
{quote} you'll find and log a bunch of bugs but you won't fix any of them. And
they'll land on my shoulders.{quote}
Not sure why you say that. I did file several issues re Sarg, however, you were
in way better position to assess and fix them, because, well, you introduced
Sarg in the same release cycle.
I do not say you are to support Sarg in the foreseeable future, however, it
would be nice if you could assist with the issues detected during the cycle you
introduced Sarg.
What I say here is it is hard to predict how features would interfere so it
might be worth trying to implement an automatic bug detector. I've filed
CALCITE-4612 to avoid off-topic here.
I've no idea how much time would it take to implement Rel fuzzer (it even
requires tables and other schema objects to work with :-/ ), but it would be
nice to get there one day.
> Sarg in JOIN -> AssertionError in RelToSqlConverter
> ---------------------------------------------------
>
> Key: CALCITE-4610
> URL: https://issues.apache.org/jira/browse/CALCITE-4610
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Steven Talbot
> Assignee: Julian Hyde
> Priority: Blocker
> Fix For: 1.27.0
>
>
>
> {code:java}
> @Test void testSargGeneratingJoinCondition() {
> final String sql = "SELECT v1.deptno, v2.deptno\n"
> + "FROM dept v1 LEFT JOIN emp v2 ON v1.deptno = v2.deptno AND v1.deptno
> < 15 AND v1.deptno > 10\n"
> + "WHERE v2.job LIKE 'PRESIDENT'";
> // note: not quite the right expected SQL, but the point is this test just
> blows up
> final String expected = "SELECT \"DEPT\".\"DEPTNO\","
> + " \"EMP\".\"DEPTNO\" AS \"DEPTNO0\"\n"
> + "FROM \"SCOTT\".\"DEPT\"\n"
> + "LEFT JOIN \"SCOTT\".\"EMP\""
> + " ON \"DEPT\".\"DEPTNO\" = \"EMP\".\"DEPTNO\"\n"
> + "WHERE \"EMP\".\"JOB\" LIKE 'PRESIDENT'";
> sql(sql)
> .schema(CalciteAssert.SchemaSpec.JDBC_SCOTT)
> .ok(expected);
> }
> {code}
> ^^ test in RelToSqlConverterTest.java
> I'm not entirely sure where in the flow between the parse into RelNode and
> the conversion from RelNode->SqlNode the Sarg is supposed to be expanded, but
> clearly, by the time it hits the RelToSqlConverter, it's too late.
>
> Stack trace:
>
> {noformat}
> SEARCH($0, Sarg[(10..15)])SEARCH($0, Sarg[(10..15)])java.lang.AssertionError:
> SEARCH($0, Sarg[(10..15)]) at
> org.apache.calcite.rel.rel2sql.SqlImplementor.convertConditionToSqlNode(SqlImplementor.java:379)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.convertConditionToSqlNode(SqlImplementor.java:320)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:215)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:525) at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:131)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:139)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:186)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:180)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:326)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:525) at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:131)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:139)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:186)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:180)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:336)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:525) at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:131)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitInput(RelToSqlConverter.java:139)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:186)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitInput(SqlImplementor.java:174)
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor.visitRoot(SqlImplementor.java:154)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.toSql(RelToSqlConverterTest.java:197)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.access$300(RelToSqlConverterTest.java:99)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverterTest$Sql.exec(RelToSqlConverterTest.java:5723)
> at
> org.apache.calcite.rel.rel2sql.RelToSqlConverterTest$Sql.ok(RelToSqlConverterTest.java:5693){noformat}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)