You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Xurenhe (Jira)" <ji...@apache.org> on 2021/09/05 08:39:00 UTC
[jira] [Updated] (CALCITE-4736) There are some unreasonable process
of SubstitutionVisitor
[ https://issues.apache.org/jira/browse/CALCITE-4736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xurenhe updated CALCITE-4736:
-----------------------------
Description:
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) = '20' "
+ "group by \"deptno\"";
final String mv2 = ""
+ "select count(1) as cnt "
+ "from \"emps\" "
+ "where cast(\"commission\" as varchar) = '10' "
+ "group by \"deptno\"";
final String query = ""
+ "select count(1) as cnt "
+ "from \"emps\" "
+ "where cast(\"commission\" as varchar) = '10' "
+ "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!
was:
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!
> 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
> Assignee: Xurenhe
> Priority: Major
> 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) = '20' "
> + "group by \"deptno\"";
> final String mv2 = ""
> + "select count(1) as cnt "
> + "from \"emps\" "
> + "where cast(\"commission\" as varchar) = '10' "
> + "group by \"deptno\"";
> final String query = ""
> + "select count(1) as cnt "
> + "from \"emps\" "
> + "where cast(\"commission\" as varchar) = '10' "
> + "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)