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: remove unnecessary metadata action when overwriting partition #2923

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/core/src/operations/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ impl std::future::IntoFuture for WriteBuilder {
actions.push(protocol.into())
}

if schema != table_schema {
if try_cast_batch(schema.fields(), table_schema.fields()).is_err() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Try cast batch is too lenient, you can already see it in the test failure.

Copy link
Member

Choose a reason for hiding this comment

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

There are a couple issues that are worth digging into:

  • can_cast_types seems like the wrong function to use in try_cast_batch considering it allows incompatible type downcasting, i.e. casting from i64 to i8.
  • The failing rust test test_issue_2105 has the id column type defined as PrimitiveType::Integer, which based on delta spec should map to 4 bytes int (i32). But the test expects the query result to have the type ArrowDataType::Int64. Is this expected? The original MR that introduced this test has the expected type defined as ArrowDataType::Int32, which seems more reasonable, but it got changed to i64 in later schema casting MR.
  • The failed python test test_parse_stats_with_new_schema is definitely a valid test failure that we should fix @PeterKeDer . Although it might be related to the same use of can_cast_types in try_cast_batch issue mentioned in my first point.

let mut metadata = snapshot.metadata().clone();
let delta_schema: StructType = schema.as_ref().try_into()?;
metadata.schema_string = serde_json::to_string(&delta_schema)?;
Expand Down
Loading