This is an automated email from the ASF dual-hosted git repository.

dataroaring 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 5af7bcaa55 [Bug](decimalv3) Fix missing precision and scale in 
predicates (#15930)
5af7bcaa55 is described below

commit 5af7bcaa55434471e03fc2c1e411cc3708687717
Author: Gabriel <[email protected]>
AuthorDate: Sun Jan 15 00:01:48 2023 +0800

    [Bug](decimalv3) Fix missing precision and scale in predicates (#15930)
---
 be/src/vec/exec/scan/vscan_node.cpp                                | 3 ++-
 regression-test/data/datatype_p0/decimalv3/test_predicate.out      | 4 ++++
 regression-test/suites/datatype_p0/decimalv3/test_predicate.groovy | 5 +++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/exec/scan/vscan_node.cpp 
b/be/src/vec/exec/scan/vscan_node.cpp
index 96d724b358..78e7d91bd3 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -781,7 +781,8 @@ Status 
VScanNode::_normalize_not_in_and_not_eq_predicate(VExpr* expr, VExprConte
                                                          ColumnValueRange<T>& 
range,
                                                          PushDownType* pdt) {
     bool is_fixed_range = range.is_fixed_value_range();
-    auto not_in_range = 
ColumnValueRange<T>::create_empty_column_value_range(range.column_name());
+    auto not_in_range = ColumnValueRange<T>::create_empty_column_value_range(
+            range.column_name(), slot->type().precision, slot->type().scale);
     PushDownType temp_pdt = PushDownType::UNACCEPTABLE;
     // 1. Normalize in conjuncts like 'where col in (v1, v2, v3)'
     if (TExprNodeType::IN_PRED == expr->node_type()) {
diff --git a/regression-test/data/datatype_p0/decimalv3/test_predicate.out 
b/regression-test/data/datatype_p0/decimalv3/test_predicate.out
index 4873a90ae5..99787dfd4b 100644
--- a/regression-test/data/datatype_p0/decimalv3/test_predicate.out
+++ b/regression-test/data/datatype_p0/decimalv3/test_predicate.out
@@ -7,3 +7,7 @@ true
 1
 1
 
+-- !select3 --
+1.200000000000000000   1.200000000000000000    1.300000000000000000
+1.500000000000000000   1.200000000000000000    1.300000000000000000
+
diff --git a/regression-test/suites/datatype_p0/decimalv3/test_predicate.groovy 
b/regression-test/suites/datatype_p0/decimalv3/test_predicate.groovy
index a2be69952d..62c28fa928 100644
--- a/regression-test/suites/datatype_p0/decimalv3/test_predicate.groovy
+++ b/regression-test/suites/datatype_p0/decimalv3/test_predicate.groovy
@@ -39,8 +39,9 @@ suite("test_predicate") {
             (1.2,1.2,1.3),
             (1.5,1.2,1.3)
     """
-    qt_select1 "select CAST((CASE WHEN (TRUE IS NOT NULL) THEN '1.2' ELSE 
'1.2' END) AS FLOAT) = CAST(1.2 AS decimal(2,1))"
+    qt_select1 "SELECT CAST((CASE WHEN (TRUE IS NOT NULL) THEN '1.2' ELSE 
'1.2' END) AS FLOAT) = CAST(1.2 AS decimal(2,1))"
 
-    qt_select2 "select 1 from ${table1} where CAST((CASE WHEN (TRUE IS NOT 
NULL) THEN '1.2' ELSE '1.2' END) AS FLOAT) = CAST(1.2 AS decimal(2,1));"
+    qt_select2 "SELECT 1 FROM ${table1} WHERE CAST((CASE WHEN (TRUE IS NOT 
NULL) THEN '1.2' ELSE '1.2' END) AS FLOAT) = CAST(1.2 AS decimal(2,1));"
+    qt_select3 "SELECT * FROM ${table1} WHERE k1 != 1.1 ORDER BY k1"
     sql "drop table if exists ${table1}"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to