pitrou commented on a change in pull request #7898:
URL: https://github.com/apache/arrow/pull/7898#discussion_r480167400
##########
File path: cpp/src/arrow/array/builder_dict.h
##########
@@ -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);
Review comment:
Can you make this a protected method of `DictionaryBuilderBase` or
something? We don't want to expose it as a public API.
##########
File path: cpp/src/arrow/array/builder_dict.h
##########
@@ -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);
Review comment:
Also, take `const char*` for the error message, to avoid constructing a
`std::string`.
##########
File path: cpp/src/arrow/builder.cc
##########
@@ -129,8 +134,10 @@ Status MakeBuilder(MemoryPool* pool, const
std::shared_ptr<DataType>& type,
case Type::DICTIONARY: {
const auto& dict_type = static_cast<const DictionaryType&>(*type);
- DictionaryBuilderCase visitor = {pool, dict_type.value_type(), nullptr,
out};
- return visitor.Make();
+ DictionaryBuilderCase visitor = {pool, dict_type.index_type(),
+ dict_type.value_type(), nullptr, out};
+ auto status = visitor.Make();
+ return status;
Review comment:
`return visitor.Make()`, simply?
##########
File path: cpp/src/arrow/array/array_test.cc
##########
@@ -2306,6 +2319,19 @@ TEST_F(TestAdaptiveUIntBuilder, TestAppendNulls) {
}
}
+TEST(TestAdaptiveUIntBuilderWithStartIntSize, TestReset) {
+ auto builder = std::make_shared<AdaptiveUIntBuilder>(
+ static_cast<uint8_t>(sizeof(uint16_t)), default_memory_pool());
+ ASSERT_TRUE(uint16()->Equals(*builder->type()));
Review comment:
`AssertTypeEqual`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]