You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2019/02/01 22:38:00 UTC
[jira] [Commented] (CALCITE-2223) ProjectMergeRule is infinitely
matched when is applied after ProjectReduceExpressionsRule
[ https://issues.apache.org/jira/browse/CALCITE-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16758732#comment-16758732 ]
Vladimir Sitnikov commented on CALCITE-2223:
--------------------------------------------
[~vvysotskyi], I've tried to apply Calcite 1.18-drill + https://github.com/apache/calcite/pull/1019 to Drill.
Drill changes are here: https://github.com/vlsi/drill/compare/956d7a3db6ef4508e0fbcbc590782c927beb8322..CALCITE-pull1019
The result is as follows:
{noformat}[ERROR] Errors:
[ERROR] TestExampleQueries.testMultipleComparisonWithSingleValueSubQuery:1199->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR] TestTpchDistributed.tpch08 » UserRemote UNSUPPORTED_OPERATION ERROR: This quer...
[ERROR] TestTpchDistributed.tpch09 » UserRemote UNSUPPORTED_OPERATION ERROR: This quer...
[ERROR] TestTpchDistributedStreaming.tpch08 » UserRemote UNSUPPORTED_OPERATION ERROR: ...
[ERROR] TestTpchDistributedStreaming.tpch09 » UserRemote UNSUPPORTED_OPERATION ERROR: ...
[ERROR] TestTpchExplain.tpch08 » UserRemote UNSUPPORTED_OPERATION ERROR: This query ca...
[ERROR] TestTpchExplain.tpch09 » UserRemote UNSUPPORTED_OPERATION ERROR: This query ca...
[ERROR] TestTpchSingleMode.tpch08 » UserRemote UNSUPPORTED_OPERATION ERROR: This query...
[ERROR] TestTpchSingleMode.tpch09 » UserRemote UNSUPPORTED_OPERATION ERROR: This query...
[ERROR] TestJoinEmptyDirTable.testNestedLoopRightJoinWithLeftEmptyDirTable:295->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341 » Rpc
[INFO]
[ERROR] Tests run: 3723, Failures: 20, Errors: 10, Skipped: 157
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] exec/Java Execution Engine 1.16.0-SNAPSHOT ......... FAILURE [21:18 min]
[INFO] exec/JDBC Driver using dependencies ................ SKIPPED{noformat}
It looks like it is not that bad, and it seems to heal infinite planning issues as well. Any thoughts regarding pull/1019 and relevant Drill changes?
> ProjectMergeRule is infinitely matched when is applied after ProjectReduceExpressionsRule
> -----------------------------------------------------------------------------------------
>
> Key: CALCITE-2223
> URL: https://issues.apache.org/jira/browse/CALCITE-2223
> Project: Calcite
> Issue Type: Bug
> Reporter: Volodymyr Vysotskyi
> Assignee: Julian Hyde
> Priority: Critical
> Attachments: TestLimitWithExchanges_testPushLimitPastUnionExchange.png, heap_overview.png, provenance_contents.png
>
>
> For queries like this:
> {code:sql}
> select t1.f from (select cast(f as int) f, f from (select cast(f as int) f from (values('1')) t(f))) as t1
> {code}
> OOM is thrown when {{ProjectMergeRule}} is applied before applying {{ProjectReduceExpressionsRule}} in VolcanoPlanner.
> A simple test to reproduce this issue (in {{RelOptRulesTest}}):
> {code:java}
> @Test public void testOomProjectMergeRule() {
> RelBuilder relBuilder = RelBuilder.create(RelBuilderTest.config().build());
> RelNode relNode = relBuilder
> .values(new String[]{"f"}, "1")
> .project(
> relBuilder.alias(
> relBuilder.cast(relBuilder.field(0), SqlTypeName.INTEGER),
> "f"))
> .project(
> relBuilder.alias(
> relBuilder.cast(relBuilder.field(0), SqlTypeName.INTEGER),
> "f0"),
> relBuilder.alias(relBuilder.field(0), "f"))
> .project(
> relBuilder.alias(relBuilder.field(0), "f"))
> .build();
> RelOptPlanner planner = relNode.getCluster().getPlanner();
> RuleSet ruleSet =
> RuleSets.ofList(
> ReduceExpressionsRule.PROJECT_INSTANCE,
> new ProjectMergeRuleWithLongerName(),
> EnumerableRules.ENUMERABLE_PROJECT_RULE,
> EnumerableRules.ENUMERABLE_VALUES_RULE);
> Program program = Programs.of(ruleSet);
> RelTraitSet toTraits =
> relNode.getCluster().traitSet()
> .replace(0, EnumerableConvention.INSTANCE);
> RelNode output = program.run(planner, relNode, toTraits,
> ImmutableList.<RelOptMaterialization>of(), ImmutableList.<RelOptLattice>of());
> // check for output
> }
> /**
> * ProjectMergeRule inheritor which has
> * class name greater than ProjectReduceExpressionsRule class name (String.compareTo()).
> *
> * It is needed for RuleQueue.popMatch() method
> * to apply this rule before ProjectReduceExpressionsRule.
> */
> private static class ProjectMergeRuleWithLongerName extends ProjectMergeRule {
> public ProjectMergeRuleWithLongerName() {
> super(true, RelFactories.LOGICAL_BUILDER);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)