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

[jira] [Created] (CALCITE-5211) Stack overflow when using HBO for materialized view rewriting

wangrenjie created CALCITE-5211:
-----------------------------------

             Summary: Stack overflow when using HBO for materialized view rewriting
                 Key: CALCITE-5211
                 URL: https://issues.apache.org/jira/browse/CALCITE-5211
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.30.0
         Environment: JAVA 17 and calicte 1.30
            Reporter: wangrenjie


I want to use the HBO optimizer for materialized view rewriting, but when I use the 

MaterializedViewRules.FILTER rule, a stack overflow error occurs.The following code is my query sql and materialized view definition sql

 
{code:java}
String sql
        = "select attr1,attr2 from opttable where attr1 > 1"; 

String mvsql =
        "create materialized view if not exists optmv as select attr1,attr2 from opttable where attr1 >10";{code}
Then I added the materialized view for HepPlanner, the code is as follows:
{code:java}
//add materialized view
RelBuilder relBuilder = RelFactories.LOGICAL_BUILDER.create(cluster, calciteCatalogReader);
RelNode tabelRel=relBuilder.scan("OPT_MV").build();
RelNode queryRel=sqlToRelConverter.convertQuery(mvValidated,false,true).rel;
RelOptMaterialization materialization=new RelOptMaterialization(tabelRel,queryRel,null, ImmutableList.of("opt_mv"));
planner.addMaterialization(materialization);

        root = root.withRel(sqlToRelConverter.flattenTypes(root.rel, true));
final RelBuilder relBuilder1 = config.getRelBuilderFactory().create(cluster, null);
root = root.withRel(RelDecorrelator.decorrelateQuery(root.rel, relBuilder1));
RelNode relNode = root.rel;

planner.setRoot(relNode);
relNode = planner.findBestExp(); {code}
But when I execute the program, a stack overflow error occurs
{code:java}
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.StackOverflowError
    at org.apache.calcite.plan.MulticastRelOptListener.relChosen(MulticastRelOptListener.java:74)
    at org.apache.calcite.plan.AbstractRelOptPlanner.notifyChosen(AbstractRelOptPlanner.java:387)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:942)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953)
    at org.apache.calcite.plan.hep.HepPlanner.buildFinalPlan(HepPlanner.java:953) {code}
When I debugged it, I found that the FITLER operator and the UNION operator are children of each other,How should I solve this problem?Thanks you very much.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)