Fix CI check when version changes -- remove checked in file that is created by doc example#12034
Merged
alamb merged 4 commits intoapache:mainfrom Aug 19, 2024
Merged
Fix CI check when version changes -- remove checked in file that is created by doc example#12034alamb merged 4 commits intoapache:mainfrom
alamb merged 4 commits intoapache:mainfrom
Conversation
This was referenced Aug 16, 2024
Contributor
|
Since this file is produced by https://github.com/apache/datafusion/blob/main/docs/source/library-user-guide/using-the-dataframe-api.md#write-dataframe-to-files, which is runned by this doctest as cargo test --doc 'library_user_guide_dataframe_api'won't it be better to replace it with tempdir rather than adding this file to gitignore? E.g. use datafusion::prelude::*;
use datafusion::error::Result;
use datafusion::dataframe::DataFrameWriteOptions;
#[tokio::main]
async fn main() -> Result<()> {
// Replace with actual target path
let target_path = tempfile::tempdir()?.path().join("example.parquet");
let ctx = SessionContext::new();
// read example.csv file into a DataFrame
let df = ctx.read_csv("tests/data/example.csv", CsvReadOptions::new()).await?;
// stream the contents of the DataFrame to the target file
df.write_parquet(
target_path.to_string_lossy().as_ref(),
DataFrameWriteOptions::new(),
None, // writer_options
).await;
Ok(())
}or to delete the file in the end of the example, like it's done in other doctests, but using tempdir has zero (or close to it) risk that this file will be committed. |
Contributor
Author
korowa
approved these changes
Aug 19, 2024
Contributor
Author
|
Thank you for the review @korowa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #11892
Rationale for this change
See #11892 -- basically if versions change the CI fails
The problem is that the output parquet file that is written as part of the doc example is checked in, and thus if the actual bytes written by the example change (e.g. when the version number changes) the local file is different too
What changes are included in this PR?
Add it to.gitignoreso it isn't added againAre these changes tested?
Yes by CI
Are there any user-facing changes?
No, this is a test fix only