[ 
https://issues.apache.org/jira/browse/CALCITE-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16759553#comment-16759553
 ] 

Vladimir Sitnikov commented on CALCITE-2223:
--------------------------------------------

By the way,  https://github.com/vlsi/calcite/tree/rule_constructors + 
https://github.com/vlsi/drill/tree/CALCITE-pull1019 seem to be in a quite good 
shape.

{noformat}[ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time 
elapsed: 14.371 s <<< FAILURE! - in org.apache.drill.TestCTASPartitionFilter
[ERROR] Tests run: 22, Failures: 0, Errors: 1, Skipped: 6, Time elapsed: 18.313 
s <<< FAILURE! - in org.apache.drill.TestTpchSingleMode
[ERROR] Tests run: 20, Failures: 1, Errors: 0, Skipped: 5, Time elapsed: 9.265 
s <<< FAILURE! - in org.apache.drill.TestProjectPushDown
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.411 
s <<< FAILURE! - in 
org.apache.drill.exec.work.prepare.TestLimit0VsRegularQueriesMetadata
[ERROR] Tests run: 12, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.771 
s <<< FAILURE! - in org.apache.drill.exec.TestEmptyInputSql
[ERROR] Tests run: 16, Failures: 5, Errors: 0, Skipped: 5, Time elapsed: 6.741 
s <<< FAILURE! - in 
org.apache.drill.exec.store.parquet.TestParquetFilterPushdownWithTransitivePredicates
[ERROR] Tests run: 47, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 12.592 
s <<< FAILURE! - in org.apache.drill.exec.sql.TestViewSupport
[ERROR] Tests run: 23, Failures: 0, Errors: 1, Skipped: 3, Time elapsed: 21.031 
s <<< FAILURE! - in org.apache.drill.TestTpchDistributed
[ERROR] Tests run: 3723, Failures: 9, Errors: 3, Skipped: 157

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Drill Root POM 1.16.0-SNAPSHOT .............. SUCCESS [  5.209 s]
[INFO] tools/Parent Pom ................................... SUCCESS [  0.582 s]
[INFO] tools/freemarker codegen tooling ................... SUCCESS [ 10.845 s]
[INFO] Drill Protocol ..................................... SUCCESS [  0.916 s]
[INFO] Common (Logical Plan, Base expressions) ............ SUCCESS [  5.313 s]
[INFO] Logical Plan, Base expressions ..................... SUCCESS [  5.124 s]
[INFO] exec/Parent Pom .................................... SUCCESS [  0.689 s]
[INFO] exec/memory/Parent Pom ............................. SUCCESS [  0.550 s]
[INFO] exec/memory/base ................................... SUCCESS [  3.185 s]
[INFO] exec/rpc ........................................... SUCCESS [  1.553 s]
[INFO] exec/Vectors ....................................... SUCCESS [  5.913 s]
[INFO] contrib/Parent Pom ................................. SUCCESS [  0.690 s]
[INFO] contrib/data/Parent Pom ............................ SUCCESS [  0.548 s]
[INFO] contrib/data/tpch-sample-data ...................... SUCCESS [  2.507 s]
[INFO] exec/Java Execution Engine ......................... FAILURE [16:00 min]
{noformat}

> 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)

Reply via email to