This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 1ec88cbff6 [fix](nereids) AggregationNode process null as key column
in wrong way (#16125)
1ec88cbff6 is described below
commit 1ec88cbff6f81590b592cbe8e2d2860aa6ca2275
Author: starocean999 <[email protected]>
AuthorDate: Sun Jan 29 20:12:07 2023 +0800
[fix](nereids) AggregationNode process null as key column in wrong way
(#16125)
in AggregationNode, _merge_with_serialized_key_helper method should convert
the key column to full column if the key column is null literal.
---
be/src/vec/exec/vaggregation_node.h | 1 +
.../rules/rewrite/logical/NormalizeToSlot.java | 8 +---
.../data/nereids_syntax_p0/test_join_nereids.out | 48 ++++++++++++++++++++++
.../nereids_syntax_p0/test_join_nereids.groovy | 8 ++++
4 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/be/src/vec/exec/vaggregation_node.h
b/be/src/vec/exec/vaggregation_node.h
index 7d9a32960b..21b5338e98 100644
--- a/be/src/vec/exec/vaggregation_node.h
+++ b/be/src/vec/exec/vaggregation_node.h
@@ -976,6 +976,7 @@ private:
for (size_t i = 0; i < key_size; ++i) {
int result_column_id = -1;
RETURN_IF_ERROR(_probe_expr_ctxs[i]->execute(block,
&result_column_id));
+ block->replace_by_position_if_const(result_column_id);
key_columns[i] =
block->get_by_position(result_column_id).column.get();
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java
index d4a53b8ac0..34686534e3 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/NormalizeToSlot.java
@@ -21,9 +21,6 @@ import org.apache.doris.nereids.trees.expressions.Alias;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.Slot;
-import org.apache.doris.nereids.trees.expressions.SlotReference;
-import org.apache.doris.nereids.trees.expressions.literal.NullLiteral;
-import org.apache.doris.nereids.types.TinyIntType;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -136,10 +133,7 @@ public interface NormalizeToSlot {
}
Alias alias = new Alias(expression, expression.toSql());
- SlotReference slot = (SlotReference) alias.toSlot();
- // BE will create a nullable uint8 column to expand NullLiteral
when necessary
- return new NormalizeToSlotTriplet(expression, expression
instanceof NullLiteral ? slot.withDataType(
- TinyIntType.INSTANCE) : slot, alias);
+ return new NormalizeToSlotTriplet(expression, alias.toSlot(),
alias);
}
}
}
diff --git a/regression-test/data/nereids_syntax_p0/test_join_nereids.out
b/regression-test/data/nereids_syntax_p0/test_join_nereids.out
index f104987b51..c88fac5d2e 100644
--- a/regression-test/data/nereids_syntax_p0/test_join_nereids.out
+++ b/regression-test/data/nereids_syntax_p0/test_join_nereids.out
@@ -1,4 +1,52 @@
-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !agg_sql1 --
+0
+
+-- !agg_sql2 --
+0 1227.5333333333333
+
+-- !agg_sql3 --
+\N 0 \N 1
+1 1 11011902 1
+2 1 11011903 1
+3 1 11011905 1
+4 1 -11011907 1
+5 1 -11011903 1
+6 1 123456 1
+7 1 7210457 1
+8 1 11011920 1
+9 1 11011902 1
+10 1 9223372036854775807 1
+11 1 -9223372036854775807 1
+12 1 9223372036854775807 1
+13 1 -9223372036854775807 1
+14 1 11011902 1
+15 1 11011920 1
+
+-- !agg_sql4 --
+0
+
+-- !agg_sql5 --
+0 1227.5333333333333
+
+-- !agg_sql6 --
+\N 0 \N 1
+1 1 11011902 1
+2 1 11011903 1
+3 1 11011905 1
+4 1 -11011907 1
+5 1 -11011903 1
+6 1 123456 1
+7 1 7210457 1
+8 1 11011920 1
+9 1 11011902 1
+10 1 9223372036854775807 1
+11 1 -9223372036854775807 1
+12 1 9223372036854775807 1
+13 1 -9223372036854775807 1
+14 1 11011902 1
+15 1 11011920 1
+
-- !join1 --
6 3004 24453.325000000 11011905
diff --git a/regression-test/suites/nereids_syntax_p0/test_join_nereids.groovy
b/regression-test/suites/nereids_syntax_p0/test_join_nereids.groovy
index e9c3cfe9b6..7b25521191 100644
--- a/regression-test/suites/nereids_syntax_p0/test_join_nereids.groovy
+++ b/regression-test/suites/nereids_syntax_p0/test_join_nereids.groovy
@@ -126,6 +126,14 @@ suite("test_join_nereids") {
sql 'set enable_fallback_to_original_planner=false;'
sql 'set enable_nereids_planner=true;'
+ qt_agg_sql1 """select
/*+SET_VAR(disable_nereids_rules='TWO_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
count(distinct k1, NULL) from test;"""
+ qt_agg_sql2 """select
/*+SET_VAR(disable_nereids_rules='TWO_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
count(distinct k1, NULL), avg(k2) from baseall;"""
+ qt_agg_sql3 """select
/*+SET_VAR(disable_nereids_rules='TWO_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
k1,count(distinct k2,k3),min(k4),count(*) from baseall group by k1 order by
k1;"""
+
+ qt_agg_sql4 """select
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
count(distinct k1, NULL) from test;"""
+ qt_agg_sql5 """select
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
count(distinct k1, NULL), avg(k2) from baseall;"""
+ qt_agg_sql6 """select
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_COUNT_DISTINCT_MULTI')*/
k1,count(distinct k2,k3),min(k4),count(*) from baseall group by k1 order by
k1;"""
+
order_sql """select j.*, d.* from ${tbName2} j full outer join ${tbName1}
d on (j.k1=d.k1) order by j.k1, j.k2, j.k3, j.k4, d.k1, d.k2
limit 100"""
order_sql """select * from (select j.k1 j1, j.k2 j2, j.k3 j3, j.k4 j4,
j.k5 j5, j.k6 j6, j.k10 j10, j.k11 j11,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]