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

ARROW-9642: [C++] Let MakeBuilder refer DictionaryType's index_type for deciding the starting bit width of the indices #7898

Closed
wants to merge 15 commits into from

Conversation

mrkn
Copy link
Member

@mrkn mrkn commented Aug 4, 2020

As the discussion in arrow-dev ML, it may be better that when creating a dictionary builder by MakeBuilder function, we can specify the starting bit width of the builder's index by the dictionary index type specified in the argument of MakeBuilder.

@github-actions
Copy link

github-actions bot commented Aug 4, 2020

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. Here's a small number of comments and questions.

cpp/src/arrow/array/builder_dict.h Outdated Show resolved Hide resolved
cpp/src/arrow/array/builder_adaptive.h Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_dict_test.cc Outdated Show resolved Hide resolved
@mrkn
Copy link
Member Author

mrkn commented Aug 12, 2020

@pitrou @wesm I found that DictionaryBuilderCase rejects that the value type is NullType though there is the specialization of DictionaryBuilderBase with T=NullType. Is this intentional?

@mrkn mrkn force-pushed the ARROW-9642 branch 5 times, most recently from 64f06da to bb91c38 Compare August 12, 2020 07:58
@pitrou
Copy link
Member

pitrou commented Aug 12, 2020

@mrkn I don't think it is, feel free to add it :-)

@mrkn
Copy link
Member Author

mrkn commented Aug 12, 2020

@pitrou OK, I'll do it.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. Here are a couple more comments.

cpp/src/arrow/array/array_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/builder_dict.h Show resolved Hide resolved
cpp/src/arrow/array/array_dict_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_dict_test.cc Outdated Show resolved Hide resolved
@mrkn
Copy link
Member Author

mrkn commented Aug 31, 2020

@pitrou I've finished. Could you please have a look at this again?

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Just a couple more comments and we'll be good.

@@ -93,6 +93,10 @@ class ARROW_EXPORT DictionaryMemoTable {
std::unique_ptr<DictionaryMemoTableImpl> impl_;
};

/// \brief Check array's value type by DCHECK
ARROW_EXPORT void CheckArrayType(const std::shared_ptr<DataType>& expected_type,
const Array& array, const std::string& message);
Copy link
Member

Choose a reason for hiding this comment

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

Can you make this a protected method of DictionaryBuilderBase or something? We don't want to expose it as a public API.

Copy link
Member

Choose a reason for hiding this comment

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

Also, take const char* for the error message, to avoid constructing a std::string.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll make this a protected method of ArrayBuilder.

cpp/src/arrow/builder.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/array/array_dict_test.cc Outdated Show resolved Hide resolved
@mrkn mrkn requested a review from pitrou August 31, 2020 23:43
@mrkn
Copy link
Member Author

mrkn commented Aug 31, 2020

@pitrou I've finished. Could you please have a look at this again?

@pitrou pitrou closed this in 2272d9a Sep 1, 2020
emkornfield pushed a commit to emkornfield/arrow that referenced this pull request Oct 16, 2020
…or deciding the starting bit width of the indices

As [the discussion in arrow-dev ML](https://lists.apache.org/thread.html/r69b17b5043bc629507440e962fd50d087c8833cd70682651c6ebda3d%40%3Cdev.arrow.apache.org%3E), it may be better that when creating a dictionary builder by MakeBuilder function, we can specify the starting bit width of the builder's index by the dictionary index type specified in the argument of MakeBuilder.

Closes apache#7898 from mrkn/ARROW-9642

Lead-authored-by: Kenta Murata <mrkn@mrkn.jp>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
…or deciding the starting bit width of the indices

As [the discussion in arrow-dev ML](https://lists.apache.org/thread.html/r69b17b5043bc629507440e962fd50d087c8833cd70682651c6ebda3d%40%3Cdev.arrow.apache.org%3E), it may be better that when creating a dictionary builder by MakeBuilder function, we can specify the starting bit width of the builder's index by the dictionary index type specified in the argument of MakeBuilder.

Closes apache#7898 from mrkn/ARROW-9642

Lead-authored-by: Kenta Murata <mrkn@mrkn.jp>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
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.

None yet

2 participants