From c3abe603dc2b688e1af502ca8e89e0ea0a931ff3 Mon Sep 17 00:00:00 2001 From: Vladislav Gogov Date: Mon, 23 Sep 2024 15:58:16 +0300 Subject: [PATCH] Fix off compression (#9612) --- ydb/core/formats/arrow/serializer/native.cpp | 8 ++++++-- ydb/core/kqp/ut/olap/compression_ut.cpp | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ydb/core/formats/arrow/serializer/native.cpp b/ydb/core/formats/arrow/serializer/native.cpp index 4b90286001d2..73e2f637f751 100644 --- a/ydb/core/formats/arrow/serializer/native.cpp +++ b/ydb/core/formats/arrow/serializer/native.cpp @@ -178,8 +178,12 @@ NKikimr::TConclusionStatus TNativeSerializer::DoDeserializeFromProto(const NKiki } void TNativeSerializer::DoSerializeToProto(NKikimrSchemeOp::TOlapColumn::TSerializer& proto) const { - proto.MutableArrowCompression()->SetCodec(NArrow::CompressionToProto(Options.codec->compression_type())); - proto.MutableArrowCompression()->SetLevel(Options.codec->compression_level()); + if (Options.codec) { + proto.MutableArrowCompression()->SetCodec(NArrow::CompressionToProto(Options.codec->compression_type())); + proto.MutableArrowCompression()->SetLevel(Options.codec->compression_level()); + } else { + proto.MutableArrowCompression()->SetCodec(NArrow::CompressionToProto(arrow::Compression::UNCOMPRESSED)); + } } } diff --git a/ydb/core/kqp/ut/olap/compression_ut.cpp b/ydb/core/kqp/ut/olap/compression_ut.cpp index 3745809b05c5..107888a6c06c 100644 --- a/ydb/core/kqp/ut/olap/compression_ut.cpp +++ b/ydb/core/kqp/ut/olap/compression_ut.cpp @@ -26,5 +26,24 @@ Y_UNIT_TEST_SUITE(KqpOlapCompression) { testHelper.CreateTable(testTable); testHelper.SetCompression(testTable, "pk_int", compression, NYdb::EStatus::SCHEME_ERROR); } + + Y_UNIT_TEST(OffCompression) { + TKikimrSettings settings = TKikimrSettings().SetWithSampleTables(false); + TTestHelper testHelper(settings); + TVector schema = { + TTestHelper::TColumnSchema().SetName("pk_int").SetType(NScheme::NTypeIds::Uint64).SetNullable(false) + }; + TTestHelper::TCompression compression = TTestHelper::TCompression().SetType(arrow::Compression::type::UNCOMPRESSED); + + TTestHelper::TColumnTable standaloneTable; + standaloneTable.SetName("/Root/StandaloneTable").SetPrimaryKey({ "pk_int" }).SetSharding({ "pk_int" }).SetSchema(schema); + testHelper.CreateTable(standaloneTable); + testHelper.SetCompression(standaloneTable, "pk_int", compression); + + TTestHelper::TColumnTableStore testTableStore; + testTableStore.SetName("/Root/TableStoreTest").SetPrimaryKey({ "pk_int" }).SetSchema(schema); + testHelper.CreateTable(testTableStore); + testHelper.SetCompression(testTableStore, "pk_int", compression); + } } }