[X] I had searched in the issues and found no similar issues.
Version
selectdb-2.0.3
What's Wrong?
This a sql. and the column sal_amt_o2o 、sal_amt_offline... is the type of decimal(20,4)
SELECT *
FROM (
SELECT SUM(sal_amt_o2o + sal_amt_offline + sal_amt_sy_a + sal_amt_sy_b + sal_amt_dy + double_sy_b_sal_amt) AS monthSalAmtYj
FROM dasuan_analysis_data.ads_org_sal_inv_kpi_d
WHERE organ_new_no = 'NKBJBK'
AND period_sdate BETWEEN '2023-11-30' AND '2023-11-30'
UNION
SELECT SUM(sal_amt_o2o + sal_amt_offline + sal_amt_sy_a + sal_amt_sy_b + sal_amt_dy + double_sy_b_sal_amt) AS monthSalAmtYj
FROM dasuan_analysis_data.ads_org_sal_kpi_rt
WHERE organ_new_no = 'NKBJBK'
AND period_sdate = '2023-11-30'
) a
when i execute the whole sql . the error will report
SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = (10.250.168.39)[NOT_IMPLEMENTED_ERROR]Create Expr failed because [E3] Wrong precision 43, min: 1, max: 38
0# doris::Exception::Exception(int, std::basic_string_view<char, std::char_traits<char> >) at /usr/local/software/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/unique_ptr.h:173
1# doris::Exception::Exception<unsigned long&, unsigned long, unsigned long>(int, std::basic_string_view<char, std::char_traits<char> >, unsigned long&, unsigned long&&, unsigned long&&) at /usr/local/software/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:187
2# doris::vectorized::create_decimal(unsigned long, unsigned long, bool) at /mnt/ssd01/selectdb-doris-package/enterprise-core/be/src/vec/data_types/data_type_decimal.cpp:0
3# doris::vectorized::DataTypeFactory::create_data_type(doris::TypeDescriptor const&, bool) at /mnt/ssd01/selectdb-doris-package/enterprise-core/be/src/vec/data_types/data_type_factory.cpp:0
4# doris::vectorized::VExpr::VExpr(doris::TExprNode const&) at /usr/local/software/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1157
5# doris::vectorized::VSlotRef::VSlotRef(doris::TExprNode const&) at /mnt/ssd01/selectdb-doris-package/enterprise-core/be/src/vec/exprs/vslot_ref.cpp:41
6# doris::vectorized::VExpr::create_expr(doris::TExprNode const&, std::shared_ptr<doris::vectorized::VExpr>&) at /usr/local/software/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_construct.h:0
7# doris::vectorized::VExpr::create_tree_from_thrift(std::vector<doris::TExprNode, std::allocator<doris::TExprNode> > const&, int*, std::shared_ptr<doris::vectorized::VExpr>&, std::shared_ptr<doris::vectorized::VExprContext>&) at /mnt/ssd01/selectdb-doris-package/
But when i Execute the small sql before each union separately ,such as
SELECT SUM(sal_amt_o2o + sal_amt_offline + sal_amt_sy_a + sal_amt_sy_b + sal_amt_dy + double_sy_b_sal_amt) AS monthSalAmtYj
FROM dasuan_analysis_data.ads_org_sal_kpi_rt
WHERE organ_new_no = 'NKBJBK'
AND period_sdate = '2023-11-30'
or when i add cast as on column
SELECT *
FROM (
SELECT cast(SUM(sal_amt_o2o + sal_amt_offline + sal_amt_sy_a + sal_amt_sy_b + sal_amt_dy + double_sy_b_sal_amt) as double) AS monthSalAmtYj
FROM dasuan_analysis_data.ads_org_sal_inv_kpi_d
WHERE organ_new_no = 'NKBJBK'
AND period_sdate = '2023-11-29' group by organ_new_no,period_sdate
UNION
SELECT cast(SUM(sal_amt_o2o + sal_amt_offline + sal_amt_sy_a + sal_amt_sy_b + sal_amt_dy + double_sy_b_sal_amt) as double) AS monthSalAmtYj
FROM dasuan_analysis_data.ads_org_sal_kpi_rt
WHERE organ_new_no = 'NKBJBK'
AND period_sdate = '2023-11-30' group by organ_new_no,period_sdate
) a
it will return the right result.
!Important
And then. I rebuild this two tables, insert into new select * from old. and rerun the whole sql, it Passed!
So,i think,it`s decimal compatibility issues between different doris versions.
Search before asking
Version
selectdb-2.0.3
What's Wrong?
This a sql. and the column sal_amt_o2o 、sal_amt_offline... is the type of decimal(20,4)
when i execute the whole sql . the error will report
But when i Execute the small sql before each union separately ,such as
or when i add
cast as
on columnit will return the right result.
!Important
And then. I rebuild this two tables, insert into new select * from old. and rerun the whole sql, it Passed!
So,i think,it`s decimal compatibility issues between different doris versions.
What You Expected?
i think it should return the right result.
How to Reproduce?
No response
Anything Else?
No response
Are you willing to submit PR?
Code of Conduct