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

Support MapType in FFI #2042

Merged
merged 3 commits into from Jul 12, 2022
Merged

Support MapType in FFI #2042

merged 3 commits into from Jul 12, 2022

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 11, 2022

Which issue does this PR close?

Closes #2037.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 11, 2022
arrow/src/ffi.rs Outdated Show resolved Hide resolved
@viirya
Copy link
Member Author

viirya commented Jul 11, 2022

cc @sunchao

// Variable-sized binaries: have two buffers.
// "small": first buffer is i32, second is in bytes
(DataType::Utf8, 1) | (DataType::Binary, 1) | (DataType::List(_), 1) => size_of::<i32>() * 8,
(DataType::Utf8, 2) | (DataType::Binary, 2) | (DataType::List(_), 2) => size_of::<u8>() * 8,
Copy link
Member Author

Choose a reason for hiding this comment

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

According to Arrow spec, variable-size list has only one i32 buffer (except for null buffer). This was incorrect. Although we actually iterator array data's buffers so it won't hit issue, it is better to correct it here.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

Looks good

.unwrap()
.with_name("map")
.unwrap()
.with_flags(flags)
Copy link
Member

Choose a reason for hiding this comment

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

why we have to set flags here? shouldn't try_from already set it from the input type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, it is missed on setting MAP_KEYS_SORTED in try_from. Good catch!

Copy link
Member Author

@viirya viirya Jul 12, 2022

Choose a reason for hiding this comment

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

DICTIONARY_ORDERED is also not set too. I will fix it in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

Yea to implement that we'll need to add the property to the dictionary type first.

arrow/src/datatypes/ffi.rs Outdated Show resolved Hide resolved
Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

LGTM (pending CI)

@viirya viirya merged commit 742a590 into apache:master Jul 12, 2022
@viirya
Copy link
Member Author

viirya commented Jul 12, 2022

Thanks @sunchao @HaoYang670

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

Successfully merging this pull request may close these issues.

Support FFI / C Data Interface for MapType
3 participants