Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class StructInfo {
public static final ScanPlanPatternChecker SCAN_PLAN_PATTERN_CHECKER = new ScanPlanPatternChecker();
// struct info splitter
public static final PlanSplitter PLAN_SPLITTER = new PlanSplitter();
private static final RelationCollector RELATION_COLLECTOR = new RelationCollector();
private static final PredicateCollector PREDICATE_COLLECTOR = new PredicateCollector();
// source data
private final Plan originalPlan;
Expand Down Expand Up @@ -477,23 +476,15 @@ public String toString() {
return "StructInfo{ originalPlanId = " + originalPlanId + ", relations = " + relations + '}';
}

private static class RelationCollector extends DefaultPlanVisitor<Void, List<CatalogRelation>> {
@Override
public Void visit(Plan plan, List<CatalogRelation> collectedRelations) {
if (plan instanceof CatalogRelation) {
collectedRelations.add((CatalogRelation) plan);
}
return super.visit(plan, collectedRelations);
}
}

private static class PredicateCollector extends DefaultPlanVisitor<Void, Set<Expression>> {
@Override
public Void visit(Plan plan, Set<Expression> predicates) {
// Just collect the filter in top plan, if meet other node except project and filter, return
if (!(plan instanceof LogicalProject)
&& !(plan instanceof LogicalFilter)
&& !(plan instanceof LogicalAggregate)) {
&& !(plan instanceof LogicalAggregate)
&& !(plan instanceof LogicalSort)
&& !(plan instanceof LogicalRepeat)) {
return null;
}
if (plan instanceof LogicalFilter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ o \N 1 0 0 178.10 56.20 1.20 8 0
o a 0 0 0 77.50 33.50 9.50 5 0
o c 0 0 0 100.60 56.20 1.20 3 0

-- !query10_1_before --
\N \N 3 1 1 100.60 56.20 1.20 3 0
o \N 1 0 0 100.60 56.20 1.20 3 0
o c 0 0 0 100.60 56.20 1.20 3 0

-- !query10_1_after --
\N \N 3 1 1 100.60 56.20 1.20 3 0
o \N 1 0 0 100.60 56.20 1.20 3 0
o c 0 0 0 100.60 56.20 1.20 3 0

-- !query11_0_before --
\N \N \N 43.20 43.20 43.20 1 0
3 \N \N 43.20 43.20 43.20 1 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,43 @@ suite("materialized_view_grouping_sets") {
order_qt_query10_0_after "${query10_0}"
sql """ DROP MATERIALIZED VIEW IF EXISTS mv10_0"""


// single table rollup with grouping scalar function and filter
def mv10_1 =
"""
select o_orderstatus, o_orderdate, o_orderpriority,
sum(o_totalprice) as sum_total,
max(o_totalprice) as max_total,
min(o_totalprice) as min_total,
count(*) as count_all,
bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)) as bitmap_union_basic
from orders
where o_custkey > 1
group by
o_orderstatus, o_orderdate, o_orderpriority;
"""
def query10_1 =
"""
select o_orderstatus, o_orderpriority,
grouping_id(o_orderstatus, o_orderpriority),
grouping_id(o_orderstatus),
grouping(o_orderstatus),
sum(o_totalprice),
max(o_totalprice),
min(o_totalprice),
count(*),
count(distinct case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)
from orders
where o_custkey > 1
group by
ROLLUP (o_orderstatus, o_orderpriority);
"""
order_qt_query10_1_before "${query10_1}"
async_mv_rewrite_success(db, mv10_1, query10_1, "mv10_1")
order_qt_query10_1_after "${query10_1}"
sql """ DROP MATERIALIZED VIEW IF EXISTS mv10_1"""


// multi table rollup without grouping scalar function
def mv11_0 =
"""
Expand Down
Loading