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

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

Finally it works. [~vvysotskyi], would you please review? I  wonder if you have 
"deactivated" rules.

 

I've performed the following changes in order to get Drill tests running:
{noformat}
- private static final String customHostName = System.getenv("DRILL_HOST_NAME");
+ private static final String customHostName = 
System.getProperty("DRILL_HOST_NAME", "localhost");

...

+ -Duser.language=en
+ -Duser.region=US{noformat}
 
{noformat}
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Drill Root POM 1.16.0-SNAPSHOT .............. SUCCESS [ 5.915 s]
[INFO] tools/Parent Pom ................................... SUCCESS [ 0.811 s]
[INFO] tools/freemarker codegen tooling ................... SUCCESS [ 5.416 s]
[INFO] Drill Protocol ..................................... SUCCESS [ 1.960 s]
[INFO] Common (Logical Plan, Base expressions) ............ SUCCESS [ 6.915 s]
[INFO] Logical Plan, Base expressions ..................... SUCCESS [ 5.840 s]
[INFO] exec/Parent Pom .................................... SUCCESS [ 0.706 s]
[INFO] exec/memory/Parent Pom ............................. SUCCESS [ 0.691 s]
[INFO] exec/memory/base ................................... SUCCESS [ 3.806 s]
[INFO] exec/rpc ........................................... SUCCESS [ 2.022 s]
[INFO] exec/Vectors ....................................... SUCCESS [ 7.131 s]
[INFO] contrib/Parent Pom ................................. SUCCESS [ 0.660 s]
[INFO] contrib/data/Parent Pom ............................ SUCCESS [ 0.564 s]
[INFO] contrib/data/tpch-sample-data ...................... SUCCESS [ 4.788 s]
[INFO] exec/Java Execution Engine ......................... SUCCESS [24:30 min]
[INFO] exec/JDBC Driver using dependencies ................ SUCCESS [01:55 min]
[INFO] JDBC JAR with all dependencies ..................... SUCCESS [ 30.962 s]
[INFO] Drill-on-YARN ...................................... SUCCESS [ 9.898 s]
[INFO] contrib/kudu-storage-plugin ........................ SUCCESS [ 13.660 s]
[INFO] contrib/opentsdb-storage-plugin .................... SUCCESS [ 14.182 s]
[INFO] contrib/mongo-storage-plugin ....................... SUCCESS [01:12 min]
[INFO] contrib/hbase-storage-plugin ....................... SUCCESS [01:34 min]
[INFO] contrib/jdbc-storage-plugin ........................ SUCCESS [01:01 min]
[INFO] contrib/hive-storage-plugin/Parent Pom ............. SUCCESS [ 1.281 s]
[INFO] contrib/hive-storage-plugin/hive-exec-shaded ....... SUCCESS [ 35.372 s]
[INFO] contrib/hive-storage-plugin/core ................... SUCCESS [06:13 min]
[INFO] contrib/kafka-storage-plugin ....................... SUCCESS [03:49 min]
[INFO] contrib/drill-udfs ................................. SUCCESS [ 29.687 s]
[INFO] Packaging and Distribution Assembly ................ SUCCESS [01:00 min]
[INFO] contrib/mapr-format-plugin 1.16.0-SNAPSHOT ......... SUCCESS [ 15.432 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44:37 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