diff options
author | nadya73 <nadya73@yandex-team.com> | 2023-10-02 20:06:25 +0300 |
---|---|---|
committer | nadya73 <nadya73@yandex-team.com> | 2023-10-02 20:59:02 +0300 |
commit | 0fffde075dc96543465a2e8a399608c79e89b90d (patch) | |
tree | a9b7026e82dfbe91532b624df459dc9f9e4a1f91 | |
parent | 0c3173cd44d7607c95d012a3e98b4d45440242b4 (diff) | |
download | ydb-0fffde075dc96543465a2e8a399608c79e89b90d.tar.gz |
Fix bug in arrow integer column serialization
-rw-r--r-- | yt/yt/client/arrow/arrow_row_stream_encoder.cpp | 3 | ||||
-rw-r--r-- | yt/yt/library/formats/arrow_writer.cpp | 37 |
2 files changed, 21 insertions, 19 deletions
diff --git a/yt/yt/client/arrow/arrow_row_stream_encoder.cpp b/yt/yt/client/arrow/arrow_row_stream_encoder.cpp index 415d556abbe..a0e8f7f5f55 100644 --- a/yt/yt/client/arrow/arrow_row_stream_encoder.cpp +++ b/yt/yt/client/arrow/arrow_row_stream_encoder.cpp @@ -409,7 +409,8 @@ void SerializeIntegerColumn( TRange<ui32>(), \ rleIndexes, \ [&] (auto index) { \ - return values[index]; \ + YT_VERIFY(index >= column->StartIndex); \ + return values[index - column->StartIndex]; \ }, \ [&] (auto value) { \ *currentOutput++ = value; \ diff --git a/yt/yt/library/formats/arrow_writer.cpp b/yt/yt/library/formats/arrow_writer.cpp index b93e54cf31c..56bdec02358 100644 --- a/yt/yt/library/formats/arrow_writer.cpp +++ b/yt/yt/library/formats/arrow_writer.cpp @@ -400,24 +400,25 @@ void SerializeIntegerColumn( : TRange<ui64>(); switch (simpleType) { -#define XX(cppType, ytType) \ - case ESimpleLogicalValueType::ytType: { \ - auto dstValues = GetTypedValues<cppType>(dstRef); \ - auto* currentOutput = dstValues.Begin(); \ - DecodeIntegerVector( \ - column->StartIndex, \ - column->StartIndex + column->ValueCount, \ - valueColumn->Values->BaseValue, \ - valueColumn->Values->ZigZagEncoded, \ - TRange<ui32>(), \ - rleIndexes, \ - [&] (auto index) { \ - return values[index]; \ - }, \ - [&] (auto value) { \ - *currentOutput++ = value; \ - }); \ - break; \ +#define XX(cppType, ytType) \ + case ESimpleLogicalValueType::ytType: { \ + auto dstValues = GetTypedValues<cppType>(dstRef); \ + auto* currentOutput = dstValues.Begin(); \ + DecodeIntegerVector( \ + column->StartIndex, \ + column->StartIndex + column->ValueCount, \ + valueColumn->Values->BaseValue, \ + valueColumn->Values->ZigZagEncoded, \ + TRange<ui32>(), \ + rleIndexes, \ + [&] (auto index) { \ + YT_VERIFY(index >= column->StartIndex); \ + return values[index - column->StartIndex]; \ + }, \ + [&] (auto value) { \ + *currentOutput++ = value; \ + }); \ + break; \ } XX(i8, Int8) |