Skip to content

Commit

Permalink
Fix off compression (#9612)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-gogov authored Sep 23, 2024
1 parent d04225d commit c3abe60
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ydb/core/formats/arrow/serializer/native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

}
19 changes: 19 additions & 0 deletions ydb/core/kqp/ut/olap/compression_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TTestHelper::TColumnSchema> 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);
}
}
}

0 comments on commit c3abe60

Please sign in to comment.