[Fix-2.1](function) fix function covar core for not null input (#39943)

## Proposed changes

Issue Number: close #xxx

add testcases like:
```groovy
    qt_notnull1 "select covar_samp(non_nullable(x), non_nullable(y)) from test_covar_samp"
    qt_notnull2 "select covar_samp(x, non_nullable(y)) from test_covar_samp"
    qt_notnull3 "select covar_samp(non_nullable(x), y) from test_covar_samp"
```

before they will all coredump in 2.1
This commit is contained in:
zclllhhjj
2024-08-27 08:39:47 +08:00
committed by GitHub
parent 21bd4a4ac8
commit db0724dfe0
5 changed files with 77 additions and 36 deletions

View File

@ -76,13 +76,15 @@ AggregateFunctionPtr create_aggregate_function_covariance_pop(const std::string&
name, argument_types, result_is_nullable, NOTNULLABLE);
}
// register covar_pop for nullable/non_nullable both.
void register_aggregate_function_covar_pop(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both("covar", create_aggregate_function_covariance_pop);
factory.register_alias("covar", "covar_pop");
}
void register_aggregate_function_covar_samp(AggregateFunctionSimpleFactory& factory) {
factory.register_function("covar_samp", create_aggregate_function_covariance_samp<NOTNULLABLE>);
factory.register_function("covar_samp", create_aggregate_function_covariance_samp<NOTNULLABLE>,
NOTNULLABLE);
factory.register_function("covar_samp", create_aggregate_function_covariance_samp<NULLABLE>,
NULLABLE);
}