[Improvement](jsonb) add suport for JSONB type for arrow (#16869)

add suport for JSONB type for arrow, which is used by doris spark/flink connector.
This commit is contained in:
Kang
2023-02-28 17:04:13 +08:00
committed by GitHub
parent 9db56201a6
commit f8e20ceca2
2 changed files with 9 additions and 1 deletions

View File

@ -38,6 +38,7 @@
#include "gutil/strings/substitute.h"
#include "runtime/descriptor_helper.h"
#include "runtime/descriptors.h"
#include "runtime/jsonb_value.h"
#include "runtime/large_int_value.h"
#include "util/arrow/utils.h"
#include "util/types.h"
@ -137,9 +138,15 @@ public:
ARROW_RETURN_NOT_OK(builder.Append(string_temp.data(), string_temp.size()));
break;
}
case vectorized::TypeIndex::JSONB: {
std::string string_temp =
JsonbToJson::jsonb_to_json_string(data_ref.data, data_ref.size);
ARROW_RETURN_NOT_OK(builder.Append(string_temp.data(), string_temp.size()));
break;
}
default: {
LOG(WARNING) << "can't convert this type = " << vectorized::getTypeName(type_idx)
<< "to arrow type";
<< " to arrow type";
return arrow::Status::TypeError("unsupported column type");
}
}

View File

@ -78,6 +78,7 @@ Status convert_to_arrow_type(const TypeDescriptor& type, std::shared_ptr<arrow::
case TYPE_DATEV2:
case TYPE_DATETIMEV2:
case TYPE_STRING:
case TYPE_JSONB:
*result = arrow::utf8();
break;
case TYPE_DECIMALV2: