Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Nov 21, 2024
1 parent 73e578c commit 1e80b5e
Show file tree
Hide file tree
Showing 5 changed files with 492 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public boolean canRollup(AggregateFunction queryAggregateFunction,
Set<Expression> mvExpressionsQueryBased = mvExprToMvScanExprQueryBased.keySet();
Set<Slot> aggregateFunctionParamSlots = queryAggregateFunctionShuttled.collectToSet(Slot.class::isInstance);
if (aggregateFunctionParamSlots.stream().anyMatch(slot -> !mvExpressionsQueryBased.contains(slot))) {
// If query use any slot not in view, can not roll up
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ public boolean canRollup(
&& viewExpression instanceof NullableAggregateFunction
? ((NullableAggregateFunction) queryAggregateFunctionShuttled).equalsIgnoreNullable(viewExpression)
: queryAggregateFunctionShuttled.equals(viewExpression);
return isEquals && MappingRollupHandler.AGGREGATE_ROLL_UP_EQUIVALENT_FUNCTION_MAP.keySet().stream()
.noneMatch(aggFunction -> aggFunction.equals(queryAggregateFunction))
&& !(queryAggregateFunction instanceof Combinator);
return isEquals && !(queryAggregateFunction instanceof Combinator);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !query1_0_before --
3 o
3 o
3 o
3 o
4 o

-- !query1_0_after --
3 o
3 o
3 o
3 o
4 o

-- !query2_0_before --
3 o
3 o
3 o
3 o
4 o

-- !query2_0_after --
3 o
3 o
3 o
3 o
4 o

-- !query3_0_before --
3 3 o

-- !query3_0_after --
3 3 o

-- !query4_0_before --
3 o

-- !query4_0_after --
3 o

-- !query5_0_before --
3 3 o

-- !query5_0_after --
3 3 o

-- !query5_1_before --
3 3 o

-- !query5_1_after --
3 3 o

-- !query6_0_before --
3 o

-- !query6_0_after --
3 o

-- !query6_1_before --
3 o
3 o
3 o
3 o
4 o

-- !query6_1_after --
3 o
3 o
3 o
3 o
4 o

Original file line number Diff line number Diff line change
Expand Up @@ -1635,24 +1635,4 @@ suite("aggregate_with_roll_up") {
"""
async_mv_rewrite_fail(db, mv37_0, query37_0, "mv37_0")
sql """ DROP MATERIALIZED VIEW IF EXISTS mv37_0"""


// mv has any value, query also has any value


// query has any value, mv doesn't have


// mv has any value, query also has any value, with same filter


// query has any value, mv doesn't have, with same filter


// mv has any value, query also has any value, with different filter
// should fail


// query has any value, mv doesn't have, with different filter
// should fail
}
Loading

0 comments on commit 1e80b5e

Please sign in to comment.