Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port tests in aggregates.rs to sqllogictest #8316

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Conversation

edmondop
Copy link
Contributor

Which issue does this PR close?

This pr addresses #8194 and try to migrate all the tests from aggregate.rs to sqlllogictests. At the moment, the following tests have been migrated:

  • csv_query_array_agg_distinct
  • aggregate
  • aggregate_empty
  • aggregate_avg
  • aggregate_max
  • aggregate_min
  • aggregate_grouped
  • aggregate_grouped_avg
  • aggregate_grouped_empty
  • aggregate_grouped_max
  • aggregate_grouped_min
  • aggregate_min_max_w_custom_window_frames
  • aggregate_min_max_w_custom_window_frames_unbounded_start
  • aggregate_avg_add
  • case_sensitive_identifiers_aggregates
  • count_basic
  • count_partitioned
  • count_aggregated
  • count_aggregated_cube
  • count_multi_expr
  • count_multi_expr_group_by
  • simple_avg
  • simple_mean
  • run_count_distinct_integers_aggregated_scenario
  • count_distinct_integers_aggregated_single_partition
  • count_distinct_integers_aggregated_multiple_partitions
  • aggregate_with_alias
  • test_accumulator_row_accumulator

For the non migrated tests, it seems that they have to do explicitly with partitioning such as https://github.com/apache/arrow-datafusion/blob/main/datafusion/core/tests/sql/aggregates.rs#L409. Is it possible to exercise this behavior in SQL tests and verify it? Also for count_aggreagted_cube for example https://github.com/apache/arrow-datafusion/blob/main/datafusion/core/tests/sql/aggregates.rs#L427

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Nov 25, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @edmondop 👍

query II
SELECT SUM(c1), SUM(c2) FROM test
----
7 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gets a different answer (likely because the table is different). However, I think the test still offers the same coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, I believed that the if the old tests can be trusted, then this one having a different result is trustable

@@ -771,31 +295,6 @@ async fn count_distinct_integers_aggregated_multiple_partitions() -> Result<()>
Ok(())
}

#[tokio::test]
async fn aggregate_with_alias() -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a dataframe test -- I'll port it over to https://github.com/apache/arrow-datafusion/blob/main/datafusion/core/tests/dataframe/mod.rs as a follow on PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alamb alamb merged commit 3c12dee into apache:main Nov 28, 2023
22 checks passed
2
0

# aggreggte_with_alias
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: aggregate_with_alias

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to search this ported for #8341 but cannot find it due to this typo. 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edmondop are you willing to address @viirya comments in a follow on PR? Otherwise I can do so

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱 apologies


# aggreggte_with_alias
query II
select c1, sum(c2) as `Total Salary` from test group by c1 order by c1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, it looks like the original test wants to check the aliased column name. Maybe this ported one should do a explain? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can have the column names also with a select?

Copy link
Contributor

@alamb alamb Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think sqllogictest has any way to do this now (by design, as I recall). Maybe we need to make/ restore a SQL level test for this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants