-
Notifications
You must be signed in to change notification settings - Fork 416
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
Save operational params in the same way with delta io #1054
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#[allow(dead_code)] | ||
mod fs_common; | ||
|
||
use deltalake::action::{Action, DeltaOperation, SaveMode}; | ||
|
||
use serde_json::{json, Value}; | ||
use std::error::Error; | ||
|
||
#[tokio::test] | ||
async fn test_operational_parameters() -> Result<(), Box<dyn Error>> { | ||
let path = "./tests/data/operational_parameters"; | ||
let mut table = fs_common::create_table(path, None).await; | ||
|
||
let add = fs_common::add(0); | ||
|
||
let operation = DeltaOperation::Write { | ||
mode: SaveMode::Append, | ||
partition_by: Some(vec!["some_partition".to_string()]), | ||
predicate: None, | ||
}; | ||
|
||
let mut tx = table.create_transaction(None); | ||
let actions = vec![Action::add(add.clone())]; | ||
tx.add_actions(actions); | ||
tx.commit(Some(operation), None).await.unwrap(); | ||
|
||
let commit_info = table.history(None).await?; | ||
let last_commit = &commit_info[commit_info.len() - 1]; | ||
|
||
assert_eq!(last_commit["operationParameters"]["mode"], json!("Append")); | ||
|
||
assert_eq!( | ||
last_commit["operationParameters"]["partitionBy"], | ||
json!("[\"some_partition\"]") | ||
); | ||
|
||
assert_eq!(last_commit["operationParameters"]["predicate"], Value::Null); | ||
|
||
Ok(()) | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also like to see a test for
partitionValues
. Could you add that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, could you please clarify your request? I ask because "partitionValues" is not part of the commit info and operating params that have been changed in this PR.
Perhaps you want to check that "partitionBy" as part of the operating params is built correctly?
If you want exactly "partitionValues", I can figure out how to check that. But it looks like it should be in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry. I meant "partitionBy".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added separated unit test, because the most of commit info sections doesn't pass operation info. So they doesn't contains operational parameters which I can use to check.