Skip to content

fix: support arrow views in ensure_data_types #1028

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

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

Conversation

zachschuermann
Copy link
Collaborator

@zachschuermann zachschuermann commented Jun 24, 2025

What changes are proposed in this pull request?

We landed support for Arrow view types in #533 but didn't make modifications to ensure_data_types, meaning users would hit Incorrect datatype. Expected string, got Utf8View

This adds:
kernel's BINARY = BinaryView
kernel's STRING = Utf8View
kernel's Array = ListView
kernel's Array = LargeListView
(and ran across a missing LargeList equivalence, so added:)
kernel's Array = LargeList

How was this change tested?

new UT

resolves #1027

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.77%. Comparing base (4a13e74) to head (dc7b246).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1028      +/-   ##
==========================================
+ Coverage   84.74%   84.77%   +0.02%     
==========================================
  Files          92       92              
  Lines       23407    23450      +43     
  Branches    23407    23450      +43     
==========================================
+ Hits        19836    19879      +43     
  Misses       2587     2587              
  Partials      984      984              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@nicklan nicklan left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix

@@ -44,6 +44,7 @@ struct EnsureDataTypes {
}

/// Capture the compatibility between two data-types, as passed to [`ensure_data_types`]
#[derive(Debug, Clone, PartialEq, Eq)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need debug and clone? It does have a compile time cost, so I prefer to add it only when needed. Also, if the eq/partialeq are just for tests, can we only derive it if testing? (not sure how easy/possible that is)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea fair point - I derived Debug since it seems like something you should almost always do even if only for testing/println debugging. I can remove clone/eq! and let me know if you think it's worth doing cfg(test) only

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually yea i think it makes sense - doing test-only :)

Copy link
Collaborator

@scovich scovich left a comment

Choose a reason for hiding this comment

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

The specific change looks fine, but --

How much does schema checking actually help, if the default engine's arrow eval doesn't actually handle those types? Do we need to add that support in this PR as well? Or is that something to look into as a fast-follow?

Comment on lines 70 to 74
(&DataType::BOOLEAN, ArrowDataType::Boolean)
| (&DataType::STRING, ArrowDataType::Utf8)
| (&DataType::STRING, ArrowDataType::Utf8View)
| (&DataType::BINARY, ArrowDataType::BinaryView)
| (&DataType::BINARY, ArrowDataType::Binary) => Ok(DataTypeCompat::Identical),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be better to explicitly capture the 1:many relationship here?

Suggested change
(&DataType::BOOLEAN, ArrowDataType::Boolean)
| (&DataType::STRING, ArrowDataType::Utf8)
| (&DataType::STRING, ArrowDataType::Utf8View)
| (&DataType::BINARY, ArrowDataType::BinaryView)
| (&DataType::BINARY, ArrowDataType::Binary) => Ok(DataTypeCompat::Identical),
(&DataType::STRING, ArrowDataType::Utf8 | ArrowDataType::Utf8View)
| (&DataType::BINARY, ArrowDataType::Binary | ArrowDataType::BinaryView)
| (&DataType::BOOLEAN, ArrowDataType::Boolean) => Ok(DataTypeCompat::Identical),

Comment on lines +75 to +78
(DataType::Array(inner_type), ArrowDataType::List(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::LargeList(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::ListView(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::LargeListView(arrow_list_field)) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to the above -- there's a lot of redundancy here

Suggested change
(DataType::Array(inner_type), ArrowDataType::List(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::LargeList(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::ListView(arrow_list_field))
| (DataType::Array(inner_type), ArrowDataType::LargeListView(arrow_list_field)) => {
(
DataType::Array(inner_type),
ArrowDataType::List(arrow_list_field)
| ArrowDataType::LargeList(arrow_list_field)
| ArrowDataType::ListView(arrow_list_field)
| ArrowDataType::LargeListView(arrow_list_field),
) => {

Not sure whether the deeper match is actually better than the flattened one tho?

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.

read-table-changes example broken with Incorrect datatype. Expected string, got Utf8View
3 participants