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

allow datafusion-cli to take a file param #285

Merged
merged 5 commits into from
May 8, 2021

Conversation

jimexist
Copy link
Member

@jimexist jimexist commented May 7, 2021

Which issue does this PR close?

Closes #282.

Relies on #283

Rationale for this change

Allow datafusion-cli to take file as a param.

What changes are included in this PR?

See above

Are there any user-facing changes?

User facing changes are the sole addition of such flag.

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2021

Codecov Report

Merging #285 (e26e996) into master (a947f11) will decrease coverage by 0.09%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #285      +/-   ##
==========================================
- Coverage   76.16%   76.07%   -0.10%     
==========================================
  Files         140      140              
  Lines       23603    23632      +29     
==========================================
  Hits        17978    17978              
- Misses       5625     5654      +29     
Impacted Files Coverage Δ
datafusion-cli/src/main.rs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a947f11...e26e996. Read the comment docs.

@jimexist
Copy link
Member Author

jimexist commented May 7, 2021

need to fix #286 first

@jimexist
Copy link
Member Author

jimexist commented May 7, 2021

need to fix #284 first

@jimexist jimexist force-pushed the add-file-mode-to-datafusion-cli branch from 24ba9a0 to 5582f18 Compare May 7, 2021 09:01
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.

Thanks @jimexist ! This is a great feature to add.

I think there is a bug in error handling for files, but otherwise this looks great!

Copy link
Member

@jorgecarleitao jorgecarleitao left a comment

Choose a reason for hiding this comment

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

Looks great 👍

And thanks lot for taking each of these separately, really easy to follow 💯

ExecutionContext::with_config(execution_config.with_information_schema(true));
if let Some(file_path) = matches.value_of("file") {
let file = File::open(file_path)
.unwrap_or_else(|err| panic!("cannot open file '{}': {}", file_path, err));
Copy link
Member Author

@jimexist jimexist May 8, 2021

Choose a reason for hiding this comment

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

example error for when file is not readable

❯ cargo run --release --bin datafusion-cli -q -- -f ./1.sql
thread 'main' panicked at 'cannot open file './1.sql': Permission denied (os error 13)', datafusion-cli/src/main.rs:82:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@jimexist jimexist force-pushed the add-file-mode-to-datafusion-cli branch from 0789a4f to e57ecce Compare May 8, 2021 07:18
@jimexist jimexist changed the title allow datafusion-cli to take file param allow datafusion-cli to take a file param May 8, 2021
@alamb
Copy link
Contributor

alamb commented May 8, 2021

Looks really good -- thanks @jimexist

@alamb alamb merged commit d0a4552 into apache:master May 8, 2021
@jimexist jimexist deleted the add-file-mode-to-datafusion-cli branch May 8, 2021 14:13
@houqp houqp added datafusion Changes in the datafusion crate enhancement New feature or request labels Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

datafusion-cli to take a file as a command input
5 participants