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

[sqllogictest] Define output types and check them in tests #5253

Merged
merged 8 commits into from
Feb 17, 2023

Conversation

melgenek
Copy link
Contributor

Which issue does this PR close?

Closes #4499.

Rationale for this change

Currently, the type strings in sqllogictests are ignored, and letters have no meaning to them. Also, some tests benefit, like null checks, benefit from type checking.

What changes are included in this PR?

  • this pr defines a custom DFColumnType that has more types than the original sqllite set of types
  • updates tests to use these custom types
  • forces the sqllogictestrunner to check the types

Are these changes tested?

Github actions.

Are there any user-facing changes?

No

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Feb 11, 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 so much @melgenek this is looking great. This feature is so cool!

Prior to merging this PR, I would like to suggest:

  1. Update the type characters to be more inline with other systems
  2. Wait for a release of sqllogictests-rs that includes the complete feature (as I think it is critical to the maintenance of the sqllogictests in datafusion)

cc @xudong963

@xudong963
Copy link
Member

Cool, I'm traveling. Will review it as soon as possible.

@xudong963 xudong963 self-requested a review February 11, 2023 13:55
@melgenek
Copy link
Contributor Author

Wait for a release of sqllogictests-rs that includes the complete feature (as I think it is critical to the maintenance of the sqllogictests in datafusion)

👍

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.

LGTM -- thanks @melgenek -- no we just need to wait on the sqllogictest release / upgrade and we'll be good to go

@alamb alamb added the waiting-on-upstream PR is waiting on an upstream dependency to be updated label Feb 15, 2023
@alamb
Copy link
Contributor

alamb commented Feb 15, 2023

Marking as draft until the upstream release is ready

@alamb alamb marked this pull request as draft February 15, 2023 14:10
# Conflicts:
#	datafusion/core/tests/sqllogictests/src/engines/datafusion/normalize.rs
#	datafusion/core/tests/sqllogictests/test_files/select.slt
@melgenek melgenek marked this pull request as ready for review February 16, 2023 22:35
@melgenek
Copy link
Contributor Author

@alamb I updated the sqllogictest-rs to 0.13.0. The --complete option fills in the types now.
In fact, you can now write query\n without specifying any types at all and completion would work.

This pr is good to go.

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 so much @melgenek

I merged this PR up to the latest main and ran cargo test --test sqllogictests -- --complete and there are no changes 👍

Then I also tried purposely updating test output to be incorrect, and I got an error as expected

Error: query columns mismatch:
[SQL] SELECT * from information_schema.tables;
[Expected] [R][R]
[Actual  ] [T][T][T][T]
at tests/sqllogictests/test_files/information_schema.slt:33

And then cargo test --test sqllogictests -- --complete fixed the problem I introduced

❤️ 🚀 -- thank you

@alamb alamb merged commit 22b974f into apache:main Feb 17, 2023
@ursabot
Copy link

ursabot commented Feb 17, 2023

Benchmark runs are scheduled for baseline = f154a9a and contender = 22b974f. 22b974f is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@melgenek melgenek deleted the 4499-check-types branch February 17, 2023 15:01
jiangzhx pushed a commit to jiangzhx/arrow-datafusion that referenced this pull request Feb 24, 2023
* [sqllogictest] Define output types and check them in tests

* Don't change imports

* Fix import

* Check types when results are empty

* Use Sqllite compatible types 'T','R','I'

* Update sqllogictest-rs to 0.13.0

* Complete types
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) waiting-on-upstream PR is waiting on an upstream dependency to be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement column number / column type verification for sqllogictest
4 participants