Wilson-BT opened a new issue, #27841:
URL: https://github.com/apache/doris/issues/27841

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) 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 change it to 
   ```
   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.
   
   
   ### 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?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to