Skip to content

Commit

Permalink
[opt](Nereids) add float type signature for sum aggregate function
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Jan 4, 2024
1 parent b26f3c3 commit 60054c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public List<FunctionSignature> getSignatures() {
@Override
public FunctionSignature searchSignature(List<FunctionSignature> signatures) {
if (getArgument(0).getDataType() instanceof FloatType) {
return FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE);
return FunctionSignature.ret(DoubleType.INSTANCE).args(FloatType.INSTANCE);
}
return ExplicitlyCastableSignature.super.searchSignature(signatures);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,12 @@ suite("nereids_agg_fn") {
qt_sql_sum_BigInt_agg_phase_4_notnull '''
select /*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), sum(kbint) from fn_test'''

//not cast float to double
explain {
sql("select sum(kfloat) from fn_test;")
contains "partial_sum(kfloat"
}

qt_sql_sum_Double_gb '''
select sum(kdbl) from fn_test group by kbool order by kbool'''
qt_sql_sum_Double '''
Expand Down

0 comments on commit 60054c2

Please sign in to comment.