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

Add --complete auto completion mode to sqllogictests #4665

Merged
merged 4 commits into from
Dec 22, 2022

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Dec 18, 2022

Which issue does this PR close?

Closes #4570
re #4460

Rationale for this change

TLDR I want to be able to write a script and capture expected output easily

See #4570

What changes are included in this PR?

  1. Update sqllogictest = "0.10.0"
  2. add a --complete command line flag to sqllogictest
  3. add documentation on how to update the files

Are these changes tested?

not directly -- they are a tool for testing

As an example:

As an example, I ported two tests from aggregates.rs to aggregate.slt like:

# array_agg_zero
query U
SELECT ARRAY_AGG([]);

# array_agg_one
query U
SELECT ARRAY_AGG([1]);

Note I didn't put in the expected results

Then I ran in complete mode:

cargo test --test sqllogictests -- aggregate --complete
 # array_agg_zero
 query U
 SELECT ARRAY_AGG([]);
----
[]

 # array_agg_one
 query U
 SELECT ARRAY_AGG([1]);
----
[[1]]

🎉

Are there any user-facing changes?

No

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Dec 18, 2022
info!("Using complete mode to complete {}", path.display());
let col_separator = " ";
let validator = default_validator;
update_test_file(path, runner, col_separator, validator)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This calls the excellent function update_test_file from @xxchan added in risinglightdb/sqllogictest-rs#130 👨‍🍳 👌




# array_agg_zero
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Writing these tests was amazing -- I just added the queries and the --complete mode added the expected results ❤️

@alamb alamb marked this pull request as ready for review December 18, 2022 12:50
@alamb
Copy link
Contributor Author

alamb commented Dec 18, 2022

cc @xudong963 @mvanschellebeeck

@alamb
Copy link
Contributor Author

alamb commented Dec 18, 2022

I am quite pleased that this worked so well :bowtie:

@xudong963
Copy link
Member

I'll review it today, love the feature!!!

Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

Except for a few minor flaws, others lgtm, thanks @alamb

Currently, we only have one dir test_files which contains all test files. As more and more tests become available, we can categorize them by adding some new subdirs under test_files.

Btw, maybe we can use clap and WalkDir in the future to replace Options struct.

datafusion/core/tests/sqllogictests/README.md Outdated Show resolved Hide resolved
datafusion/core/tests/sqllogictests/README.md Outdated Show resolved Hide resolved
alamb and others added 2 commits December 22, 2022 06:17
@alamb
Copy link
Contributor Author

alamb commented Dec 22, 2022

Except for a few minor flaws, others lgtm, thanks @alamb

Currently, we only have one dir test_files which contains all test files. As more and more tests become available, we can categorize them by adding some new subdirs under test_files.

Good idea -- filed #4709

Btw, maybe we can use clap and WalkDir in the future to replace Options struct.

I agree using clap in the future would be a good idea!

@xudong963 xudong963 merged commit 04d095d into apache:master Dec 22, 2022
@ursabot
Copy link

ursabot commented Dec 22, 2022

Benchmark runs are scheduled for baseline = c9d6118 and contender = 04d095d. 04d095d 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

@alamb alamb deleted the alamb/sqllogictest_autocomplete branch August 8, 2023 20:14
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.

Make it easier to update sqltestlogic test expected output ("test script completion mode")
3 participants