-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default compression via CSConfig #12542
base: main
Are you sure you want to change the base?
Changes from 7 commits
383db7f
d6ecc91
3e28787
b3a9d1a
e62eef1
c00d144
db36b0a
dc5c43d
f94e573
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
#pragma once | ||
|
||
#include "abstract.h" | ||
#include "parsing.h" | ||
|
||
#include <ydb/core/base/appdata_fwd.h> | ||
#include <ydb/core/protos/config.pb.h> | ||
#include <ydb/core/protos/flat_scheme_op.pb.h> | ||
|
||
#include <ydb/library/accessor/accessor.h> | ||
|
@@ -50,10 +53,32 @@ class TNativeSerializer: public ISerializer { | |
|
||
virtual TConclusionStatus DoDeserializeFromRequest(NYql::TFeaturesExtractor& features) override; | ||
|
||
static arrow::Compression::type GetDefaultCompressionType() { | ||
if (!HasAppData() && !AppData()->ColumnShardConfig.HasDefaultCompression()) { | ||
return arrow::Compression::ZSTD; | ||
} | ||
return CompressionFromProto(AppData()->ColumnShardConfig.GetDefaultCompression()).value(); | ||
} | ||
|
||
static std::shared_ptr<arrow::util::Codec> GetDefaultCodec() { | ||
if (!HasAppData() || | ||
(!AppData()->ColumnShardConfig.HasDefaultCompression() && !AppData()->ColumnShardConfig.HasDefaultCompressionLevel())) { | ||
return NArrow::TStatusValidator::GetValid(arrow::util::Codec::Create(arrow::Compression::type::ZSTD, 1)); | ||
} | ||
arrow::Compression::type codec = GetDefaultCompressionType(); | ||
if (AppData()->ColumnShardConfig.HasDefaultCompressionLevel()) { | ||
return NArrow::TStatusValidator::GetValid( | ||
arrow::util::Codec::Create(codec, AppData()->ColumnShardConfig.GetDefaultCompressionLevel())); | ||
} else if (codec == arrow::Compression::ZSTD) { | ||
return NArrow::TStatusValidator::GetValid(arrow::util::Codec::Create(codec, 1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Зачем хардкодить дефолтный compression level для ZTDS? Create(codec) не выставит нужное значение по-умолчанию? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Create(codec) по умолчанию создает ZSTD с compression level равным 8 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А как ты это понял? Просто в коде arrow значением по умолчанию для ZSTD стоит 1: https://github.com/ydb-platform/ydb/blob/main/contrib/libs/apache/arrow/cpp/src/arrow/util/compression_internal.h#L73 |
||
} | ||
return NArrow::TStatusValidator::GetValid(arrow::util::Codec::Create(codec)); | ||
} | ||
|
||
static arrow::ipc::IpcOptions BuildDefaultOptions() { | ||
arrow::ipc::IpcWriteOptions options; | ||
options.use_threads = false; | ||
options.codec = *arrow::util::Codec::Create(arrow::Compression::LZ4_FRAME); | ||
options.codec = GetDefaultCodec(); | ||
return options; | ||
} | ||
|
||
|
@@ -83,7 +108,7 @@ class TNativeSerializer: public ISerializer { | |
} | ||
|
||
static arrow::ipc::IpcOptions GetDefaultOptions() { | ||
static arrow::ipc::IpcWriteOptions options = BuildDefaultOptions(); | ||
arrow::ipc::IpcWriteOptions options = BuildDefaultOptions(); | ||
return options; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем уносить проверки в HasAppData? Может быть так, что TlsActivationContext есть, но в нём нет AppData?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У меня получилась ситация, HasAppData возвращает true, но AppData в нем нет, поэтому я не мог обратиться к конфигурации CS, падало на
ydb/ydb/core/base/appdata_fwd.h
Line 308 in de2a1e3