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

fix: Parquet format output not working in CLI for show commands #25997

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Karribalu
Copy link

BREAKING CHANGE:
The short option -o, previously used for order-by in the table-list command, has been replaced and is now used for the output option.

Closes #25941

Describe your proposed changes here.

  1. Mandated the -o or --output option when -format specified as Parquet
  2. Updated the following commands with the same fix
    • show databases
    • show system table
    • show system table-list
    • show system summary
  • I've read the contributing section of the project README.
  • Signed CLA (if not already signed).

BREAKING CHANGE:
The short option -o, previously used for order-by in the table-list command, has been replaced and is now used for the output option.
Copy link
Contributor

@hiltontj hiltontj left a comment

Choose a reason for hiding this comment

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

He @Karribalu - I have a couple of suggestions in line. I think the breaking change is okay given the prior discussion about it, and that this makes it consistent with other CLIs that output parquet.

Comment on lines +130 to +143
if let Some(path) = output_file_path {
let mut f = OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(path)
.await?;
f.write_all_buf(&mut bs).await?;
} else {
if output_format.is_parquet() {
Err(Error::NoOutputFileForParquet)?
}
println!("{}", String::from_utf8(bs.as_ref().to_vec()).unwrap());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you move this code into a helper function since it is re-used in several places.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to add a success test case that writes the parquet to a temp file, then reads it, and validates its contents.

Some helpful APIs that would enable that:

  • We use the tempfile crate for temporary files in tests
  • There are APIs for reading parquet files into Arrow RecordBatchs in the parquet crate
  • There are helpers for visually asserting on the contents of those record batches in DataFusion, e.g., assert_batches_sorted_eq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug with 'influxdb3 show databases' when outputting to parquet
2 participants