You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Xurenhe (Jira)" <ji...@apache.org> on 2021/08/13 08:08:00 UTC

[jira] [Created] (CALCITE-4736) There are some unreasonable process of SubstitutionVisitor

Xurenhe created CALCITE-4736:
--------------------------------

             Summary: There are some unreasonable process of SubstitutionVisitor
                 Key: CALCITE-4736
                 URL: https://issues.apache.org/jira/browse/CALCITE-4736
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: Xurenhe
         Attachments: image-2021-08-13-16-05-37-881.png, image-2021-08-13-16-06-52-136.png

Hello everyone.
There are some unreasonable process in SubstitutionVisitor#go.
For example:
I define two mvs, and one of them can be using during query-write.
First of them throw RuntimeException, but second of then should be using, during query-rewrite.
Code as follow:

{code:java}
  @Test void testQueryRewriteFlowFail() {
    final String mv1 = ""
        + "select count(1) as cnt "
        + "from \"emps\" "
        + "where cast(\"commission\" as varchar) = 'a10' "
        + "group by \"deptno\"";
    final String mv2 = ""
        + "select count(1) as cnt "
        + "from \"emps\" "
        + "where cast(\"commission\" as varchar) = 'b10' "
        + "group by \"deptno\"";
    final String query = ""
        + "select count(1) as cnt "
        + "from \"emps\" "
        + "where cast(\"commission\" as varchar) = 'b10' "
        + "group by \"deptno\"";
    sql(ImmutableList.of(mv1, mv2), query).ok();
  }
{code}
 !image-2021-08-13-16-05-37-881.png! 

Using two mvs, test-cast is fail, but using one right mv, test-case pass.
 !image-2021-08-13-16-06-52-136.png! 






--
This message was sent by Atlassian Jira
(v8.3.4#803005)