-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-9345: [C++][Dataset] Support casting scalars to dictionary scalars #7686
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
Conversation
jorisvandenbossche
left a comment
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.
For the C++ changes: you basically enabled casting to DictionaryScalar? (so that implicit casts in the dataset filter expression works?)
The enabled behaviour certainly looks good!
|
@jorisvandenbossche precisely |
pitrou
left a comment
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.
LGTM, but can you add tests on the C++ side?
a103849 to
54a2a67
Compare
|
@pitrou done, PTAL |
| } | ||
|
|
||
| TEST(TestDictionaryScalar, Basics) { | ||
| auto CheckIndexType = [&](const std::shared_ptr<DataType>& index_ty) { |
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.
Ha, this function was never called?
| for (auto index_ty : all_dictionary_index_types()) { | ||
| auto ty = dictionary(index_ty, utf8()); | ||
| auto dict = checked_pointer_cast<StringArray>( | ||
| ArrayFromJSON(utf8(), R"(["alpha", "beta", "gamma"])")); |
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.
Hmm, perhaps test for null as well?
pitrou
left a comment
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 don't know if you'd like to quickly add a test for null, otherwise please merge :-)
|
The null case doesn't hit the new code here, so I think I'll merge now and add more tests in follow up |
Enable casting from Scalar DictionaryScalar, which allows InsertImplicitCasts to convert non-dict scalars embedded in filter expressions.