Skip to content

ARROW-9345: [C++][Dataset] Support casting scalars to dictionary scalars#7686

Closed
bkietz wants to merge 2 commits into
apache:masterfrom
bkietz:9345-compare-with-dict-scalar
Closed

ARROW-9345: [C++][Dataset] Support casting scalars to dictionary scalars#7686
bkietz wants to merge 2 commits into
apache:masterfrom
bkietz:9345-compare-with-dict-scalar

Conversation

@bkietz

@bkietz bkietz commented Jul 8, 2020

Copy link
Copy Markdown
Member

Enable casting from Scalar DictionaryScalar, which allows InsertImplicitCasts to convert non-dict scalars embedded in filter expressions.

@bkietz bkietz requested a review from jorisvandenbossche July 8, 2020 18:52
@github-actions

github-actions Bot commented Jul 8, 2020

Copy link
Copy Markdown

@jorisvandenbossche jorisvandenbossche left a comment

Copy link
Copy Markdown
Member

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!

@bkietz

bkietz commented Jul 8, 2020

Copy link
Copy Markdown
Member Author

@jorisvandenbossche precisely

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

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?

@bkietz bkietz force-pushed the 9345-compare-with-dict-scalar branch from a103849 to 54a2a67 Compare July 9, 2020 20:44
@bkietz

bkietz commented Jul 9, 2020

Copy link
Copy Markdown
Member Author

@pitrou done, PTAL

}

TEST(TestDictionaryScalar, Basics) {
auto CheckIndexType = [&](const std::shared_ptr<DataType>& index_ty) {

Copy link
Copy Markdown
Member

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"])"));

Copy link
Copy Markdown
Member

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 pitrou left a comment

Copy link
Copy Markdown
Member

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 :-)

@bkietz

bkietz commented Jul 10, 2020

Copy link
Copy Markdown
Member Author

The null case doesn't hit the new code here, so I think I'll merge now and add more tests in follow up

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.

3 participants