aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/computation/mkql_block_impl.cpp
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-02-11 00:51:38 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-02-11 00:51:38 +0000
commit1c380be4486e3fbc7209069d5cb04ebb2eb179ac (patch)
tree7460a5e24909c32fd88b8c8cd94d2548d26401e4 /yql/essentials/minikql/computation/mkql_block_impl.cpp
parent1b5d9e2ff1d57aaa4d1d784c37756d92331e5dc2 (diff)
parent098dbd39a7651dcc945ab33e751fdf93cc87c914 (diff)
downloadydb-1c380be4486e3fbc7209069d5cb04ebb2eb179ac.tar.gz
Merge branch 'rightlib' into merge-libs-250211-0050
Diffstat (limited to 'yql/essentials/minikql/computation/mkql_block_impl.cpp')
-rw-r--r--yql/essentials/minikql/computation/mkql_block_impl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/yql/essentials/minikql/computation/mkql_block_impl.cpp b/yql/essentials/minikql/computation/mkql_block_impl.cpp
index 2920a1ac3c..49d52eb0b8 100644
--- a/yql/essentials/minikql/computation/mkql_block_impl.cpp
+++ b/yql/essentials/minikql/computation/mkql_block_impl.cpp
@@ -114,8 +114,14 @@ arrow::Datum DoConvertScalar(TType* type, const T& value, arrow::MemoryPool& poo
const auto& str = value.AsStringRef();
std::shared_ptr<arrow::Buffer> buffer(ARROW_RESULT(arrow::AllocateBuffer(str.Size(), &pool)));
std::memcpy(buffer->mutable_data(), str.Data(), str.Size());
- auto type = (slot == NUdf::EDataSlot::String || slot == NUdf::EDataSlot::Yson || slot == NUdf::EDataSlot::JsonDocument) ? arrow::binary() : arrow::utf8();
- std::shared_ptr<arrow::Scalar> scalar = std::make_shared<arrow::BinaryScalar>(buffer, type);
+ std::shared_ptr<arrow::Scalar> scalar;
+ if (slot == NUdf::EDataSlot::String || slot == NUdf::EDataSlot::Yson || slot == NUdf::EDataSlot::JsonDocument) {
+ scalar = std::make_shared<arrow::BinaryScalar>(buffer, arrow::binary());
+ } else {
+ // NOTE: Do not use |arrow::BinaryScalar| for utf8 and json types directly.
+ // This is necessary so that the type of the scalar is clearly preserved at runtime.
+ scalar = std::make_shared<arrow::StringScalar>(buffer);
+ }
return arrow::Datum(scalar);
}
case NUdf::EDataSlot::TzDate: {