felipeblazing commented on a change in pull request #10843:
URL: https://github.com/apache/arrow/pull/10843#discussion_r680128769
##########
File path: cpp/src/arrow/json/converter.cc
##########
@@ -147,6 +149,41 @@ class NumericConverter : public PrimitiveConverter {
const T& numeric_type_;
};
+template <typename T>
+class DecimalConverter : public PrimitiveConverter {
+ public:
+ using value_type = typename TypeTraits<T>::BuilderType::ValueType;
+
+ DecimalConverter(MemoryPool* pool, const std::shared_ptr<DataType>& type)
+ : PrimitiveConverter(pool, type) {}
+
+ Status Convert(const std::shared_ptr<Array>& in, std::shared_ptr<Array>*
out) override {
+ if (in->type_id() == Type::NA) {
+ return MakeArrayOfNull(out_type_, in->length(), pool_).Value(out);
+ }
+ const auto& dict_array = GetDictionaryArray(in);
+
+ using Builder = typename TypeTraits<T>::BuilderType;
+ Builder builder(out_type_, pool_);
+ RETURN_NOT_OK(builder.Resize(dict_array.indices()->length()));
+
+ auto visit_valid = [&](string_view repr) {
Review comment:
why capture everything here as well?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]