This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new f8361062fee [fix](planner)the data type should be the same between
input slot and sort slot #27137 (#27215)
f8361062fee is described below
commit f8361062fee8e093a467fd9e3f95d7890b2c2d96
Author: starocean999 <[email protected]>
AuthorDate: Sun Nov 19 10:17:12 2023 +0800
[fix](planner)the data type should be the same between input slot and sort
slot #27137 (#27215)
---
.../java/org/apache/doris/planner/AnalyticPlanner.java | 4 ++--
.../test_inlineview_with_window_function.out | 5 +++++
.../test_inlineview_with_window_function.groovy | 16 ++++++++++++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticPlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticPlanner.java
index 433fe76fd9e..f3a865b051f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticPlanner.java
@@ -313,9 +313,9 @@ public class AnalyticPlanner {
SlotDescriptor sortSlotDesc =
analyzer.getDescTbl().addSlotDescriptor(sortTupleDesc);
if (inputSlotDesc.getColumn() != null) {
sortSlotDesc.setColumn(inputSlotDesc.getColumn());
- } else {
- sortSlotDesc.setType(inputSlotDesc.getType());
}
+ // always set type as inputSlotDesc's type
+ sortSlotDesc.setType(inputSlotDesc.getType());
// all output slots need to be materialized
sortSlotDesc.setIsMaterialized(true);
sortSlotDesc.setIsNullable(inputSlotDesc.getIsNullable());
diff --git
a/regression-test/data/correctness_p0/test_inlineview_with_window_function.out
b/regression-test/data/correctness_p0/test_inlineview_with_window_function.out
index 281bf5dd1b2..651e03f982f 100644
---
a/regression-test/data/correctness_p0/test_inlineview_with_window_function.out
+++
b/regression-test/data/correctness_p0/test_inlineview_with_window_function.out
@@ -2,3 +2,8 @@
-- !order --
2023-06-10 cib2205045_1_1s 0.0000 168939.0 0.0000 0.0 0.0000
0.0 0.0000 day
+-- !order2 --
+1 1 1
+2 2 2
+3 3 3
+4 4 4
diff --git
a/regression-test/suites/correctness_p0/test_inlineview_with_window_function.groovy
b/regression-test/suites/correctness_p0/test_inlineview_with_window_function.groovy
index cdeb65e9ec5..359874f52d0 100644
---
a/regression-test/suites/correctness_p0/test_inlineview_with_window_function.groovy
+++
b/regression-test/suites/correctness_p0/test_inlineview_with_window_function.groovy
@@ -16,6 +16,7 @@
// under the License.
suite("test_inlineview_with_window_function") {
+ sql """set enable_nereids_planner=false;"""
sql """
drop view if exists test_table_aa;
"""
@@ -151,4 +152,19 @@ suite("test_inlineview_with_window_function") {
group by ordernum
)tmp1
on tmp.ordernum=tmp1.ordernum;"""
+
+ qt_order2 """
+ SELECT
+ row_number() over(partition by add_date order by pc_num desc)
+ ,row_number() over(partition by add_date order by vc_num desc)
+ ,row_number() over(partition by add_date order by vt_num desc)
+ FROM (
+ SELECT
+ cast(dnt as datev2) add_date
+ ,row_number() over(order by dnt) pc_num
+ ,row_number() over(order by dnt) vc_num
+ ,row_number() over(order by dnt) vt_num
+ FROM test_table_aaa
+ ) t;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]