apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
5.21k stars 957 forks source link

Port aggregate test to sqllogictest #10384

Open jayzhan211 opened 1 week ago

jayzhan211 commented 1 week ago

Is your feature request related to a problem or challenge?

There are many rust test that exists in aggregate functions. Moving them to sqllogictest is easier to maintain and avoid additional testing functions like generic_test_op, assert_string_aggregate, assert_aggregate, assert_error_bounds, and so on. It also makes #8708 a lot easier.

10382 is an example of how tests are moved to.

I think most of them are Good first issue:

Describe the solution you'd like

Port rust test in datafusion/physical-expr/src/aggregate/tdigest.rs to datafusion/sqllogictest/test_files/aggregate.slt

We can just add the test to aggregate.slt even if there is a duplicated test case to make the review easier.

Describe alternatives you've considered

No response

Additional context

No response

xinlifoobar commented 4 days ago

Hello @jayzhan211 , I am trying to ramp up the repo via porting the min_max tests to sqllogictests.

During the migrations, however, I found there are inconsistent behavours. An example is error handling inside rust class versus through the SQL engine as such:

statement ok CREATE TABLE decimals_error (value DECIMAL(10, 2));

statement ok INSERT INTO decimals_error VALUES (123.00), (arrow_cast(124.00, 'Decimal128(10, 3)'));

query R SELECT MAX(value) FROM decimals_error

124



As far as I could tell, the error will be lost permanently.

What's your opinions on such migrations? Shall we keep the tests that are different still in the rs files?
jayzhan211 commented 3 days ago

I think we don't need to keep the test. The reason that you didn't get the error is that we have coercion already in building values. It is the expected result.