aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/serialize.cpp
diff options
context:
space:
mode:
authorEgor Chunaev <egor.chunaev@pinely.com>2023-11-23 18:08:40 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-11-23 18:36:56 +0300
commit1c6a0f0555dad6bcacf5ef2614d7cd88627609f0 (patch)
treef953529aff78e88ec7be727345e0a50bc457d849 /yt/cpp/mapreduce/interface/serialize.cpp
parent50c69e8394f3c3e1afef75878953a4c4691d4383 (diff)
downloadydb-1c6a0f0555dad6bcacf5ef2614d7cd88627609f0.tar.gz
Fix serialization of decimal type in TTableSchema
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en Fix for https://github.com/ytsaurus/ytsaurus/issues/173 --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/174 Co-authored-by: ermolovd <ermolovd@yandex-team.com>
Diffstat (limited to 'yt/cpp/mapreduce/interface/serialize.cpp')
-rw-r--r--yt/cpp/mapreduce/interface/serialize.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/yt/cpp/mapreduce/interface/serialize.cpp b/yt/cpp/mapreduce/interface/serialize.cpp
index 7cd8417487..8e701d30b4 100644
--- a/yt/cpp/mapreduce/interface/serialize.cpp
+++ b/yt/cpp/mapreduce/interface/serialize.cpp
@@ -165,10 +165,16 @@ void Serialize(const TColumnSchema& columnSchema, NYson::IYsonConsumer* consumer
.Item("name").Value(columnSchema.Name())
.DoIf(!columnSchema.RawTypeV3().Defined(),
[&] (TFluentMap fluent) {
+ static const auto optionalYson = NTi::Optional(NTi::Yson());
+
fluent.Item("type").Value(NDetail::ToString(columnSchema.Type()));
fluent.Item("required").Value(columnSchema.Required());
- if (columnSchema.Type() == VT_ANY
- && *columnSchema.TypeV3() != *NTi::Optional(NTi::Yson()))
+ if (
+ (columnSchema.Type() == VT_ANY && *columnSchema.TypeV3() != *optionalYson) ||
+ // See https://github.com/ytsaurus/ytsaurus/issues/173
+ columnSchema.TypeV3()->IsDecimal() ||
+ (columnSchema.TypeV3()->IsOptional() && columnSchema.TypeV3()->AsOptional()->GetItemType()->IsDecimal()))
+
{
// A lot of user canonize serialized schema.
// To be backward compatible we only set type_v3 for new types.