Skip to content
Merged
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 @@ -50,9 +50,14 @@ public class ContainDistinctFunctionRollupHandler extends AggFunctionRollUpHandl
public static final ContainDistinctFunctionRollupHandler INSTANCE = new ContainDistinctFunctionRollupHandler();
public static Set<AggregateFunction> SUPPORTED_AGGREGATE_FUNCTION_SET = ImmutableSet.of(
new Max(true, Any.INSTANCE), new Min(true, Any.INSTANCE),
new Max(true, Any.INSTANCE).withAlwaysNullable(true),
new Min(true, Any.INSTANCE).withAlwaysNullable(true),
new Max(false, Any.INSTANCE), new Min(false, Any.INSTANCE),
new Count(true, Any.INSTANCE), new Sum(true, Any.INSTANCE),
new Avg(true, Any.INSTANCE));
new Max(false, Any.INSTANCE).withAlwaysNullable(true),
new Min(false, Any.INSTANCE).withAlwaysNullable(true),
new Count(true, Any.INSTANCE),
new Sum(true, Any.INSTANCE), new Sum(true, Any.INSTANCE).withAlwaysNullable(true),
new Avg(true, Any.INSTANCE), new Avg(true, Any.INSTANCE).withAlwaysNullable(true));

@Override
public boolean canRollup(AggregateFunction queryAggregateFunction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
-4

-- !select_avg --
-4
-4.0

Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ suite ("agg_use_key_direct") {
order_qt_select_min """select min(distinct k3) from agg_use_key_direct"""

mv_rewrite_success("""select avg(distinct k3) from agg_use_key_direct""", "common_mv")
order_qt_select_avg """select min(distinct k3) from agg_use_key_direct"""
order_qt_select_avg """select avg(distinct k3) from agg_use_key_direct"""
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,6 @@ suite("agg_variety") {
sql """alter table lineitem modify column l_comment set stats ('row_count'='5');"""
sql """alter table partsupp modify column ps_comment set stats ('row_count'='2');"""

def check_rewrite_but_not_chose = { mv_sql, query_sql, mv_name ->

sql """DROP MATERIALIZED VIEW IF EXISTS ${mv_name}"""
sql"""
CREATE MATERIALIZED VIEW ${mv_name}
BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS ${mv_sql}
"""

def job_name = getJobName(db, mv_name);
waitingMTMVTaskFinished(job_name)
explain {
sql("${query_sql}")
check {result ->
def splitResult = result.split("MaterializedViewRewriteFail")
splitResult.length == 2 ? splitResult[0].contains(mv_name) : false
}
}
}

// query dimension is less then mv
def mv1_0 = """
select
Expand Down