diff options
author | hor911 <hor911@ydb.tech> | 2023-03-24 11:37:52 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2023-03-24 11:37:52 +0300 |
commit | 247cb5398c9261bc86473933a9b399624b7f9fbc (patch) | |
tree | f473b17f368b5023963f04827a6284012948b944 | |
parent | 8bf60a95b267388c669402cf85d8236671a6a4c0 (diff) | |
download | ydb-247cb5398c9261bc86473933a9b399624b7f9fbc.tar.gz |
Disable external compression for parquet
5 files changed, 27 insertions, 11 deletions
diff --git a/ydb/library/yql/providers/common/provider/yql_provider.cpp b/ydb/library/yql/providers/common/provider/yql_provider.cpp index 809dfe35cbf..f13a717f2d1 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.cpp +++ b/ydb/library/yql/providers/common/provider/yql_provider.cpp @@ -1144,8 +1144,15 @@ void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap< writer.OnEndMap(); } -bool ValidateCompressionForInput(std::string_view compression, TExprContext& ctx) { - if (compression.empty() || IsIn(Compressions, compression)) { +bool ValidateCompressionForInput(std::string_view format, std::string_view compression, TExprContext& ctx) { + if (compression.empty()) { + return true; + } + if (format == "parquet"sv) { + ctx.AddError(TIssue(TStringBuilder() << "External compression for parquet is not supported")); + return false; + } + if (IsIn(Compressions, compression)) { return true; } ctx.AddError(TIssue(TStringBuilder() << "Unknown compression: " << compression @@ -1153,8 +1160,15 @@ bool ValidateCompressionForInput(std::string_view compression, TExprContext& ctx return false; } -bool ValidateCompressionForOutput(std::string_view compression, TExprContext& ctx) { - if (compression.empty() || IsIn(Compressions, compression)) { +bool ValidateCompressionForOutput(std::string_view format, std::string_view compression, TExprContext& ctx) { + if (compression.empty()) { + return true; + } + if (format == "parquet"sv) { + ctx.AddError(TIssue(TStringBuilder() << "External compression for parquet is not supported")); + return false; + } + if (IsIn(Compressions, compression)) { return true; } ctx.AddError(TIssue(TStringBuilder() << "Unknown compression: " << compression diff --git a/ydb/library/yql/providers/common/provider/yql_provider.h b/ydb/library/yql/providers/common/provider/yql_provider.h index b7541edaed0..1ee50a6b3d2 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.h +++ b/ydb/library/yql/providers/common/provider/yql_provider.h @@ -136,8 +136,8 @@ double GetDataReplicationFactor(const TExprNode& lambda, TExprContext& ctx); void WriteStatistics(NYson::TYsonWriter& writer, bool totalOnly, const THashMap<ui32, TOperationStatistics>& statistics); -bool ValidateCompressionForInput(std::string_view compression, TExprContext& ctx); -bool ValidateCompressionForOutput(std::string_view compression, TExprContext& ctx); +bool ValidateCompressionForInput(std::string_view format, std::string_view compression, TExprContext& ctx); +bool ValidateCompressionForOutput(std::string_view format, std::string_view compression, TExprContext& ctx); bool ValidateFormatForInput(std::string_view format, TExprContext& ctx); bool ValidateFormatForOutput(std::string_view format, TExprContext& ctx); diff --git a/ydb/library/yql/providers/pq/provider/yql_pq_datasource_type_ann.cpp b/ydb/library/yql/providers/pq/provider/yql_pq_datasource_type_ann.cpp index 2680ddb56b4..f3a1051802c 100644 --- a/ydb/library/yql/providers/pq/provider/yql_pq_datasource_type_ann.cpp +++ b/ydb/library/yql/providers/pq/provider/yql_pq_datasource_type_ann.cpp @@ -99,11 +99,12 @@ public: return TStatus::Error; } - if (!NCommon::ValidateFormatForInput(read.Format().Ref().Content(), ctx)) { + auto format = read.Format().Ref().Content(); + if (!NCommon::ValidateFormatForInput(format, ctx)) { return TStatus::Error; } - if (!NCommon::ValidateCompressionForInput(read.Compression().Ref().Content(), ctx)) { + if (!NCommon::ValidateCompressionForInput(format, read.Compression().Ref().Content(), ctx)) { return TStatus::Error; } diff --git a/ydb/library/yql/providers/s3/provider/yql_s3_datasink_type_ann.cpp b/ydb/library/yql/providers/s3/provider/yql_s3_datasink_type_ann.cpp index cfc5293dac5..5ad6565cf34 100644 --- a/ydb/library/yql/providers/s3/provider/yql_s3_datasink_type_ann.cpp +++ b/ydb/library/yql/providers/s3/provider/yql_s3_datasink_type_ann.cpp @@ -107,7 +107,8 @@ private: return TStatus::Repeat; } - if (!EnsureAtom(*input->Child(TS3Target::idx_Format), ctx) || !NCommon::ValidateFormatForOutput(input->Child(TS3Target::idx_Format)->Content(), ctx)) { + const auto format = input->Child(TS3Object::idx_Format)->Content(); + if (!EnsureAtom(*input->Child(TS3Target::idx_Format), ctx) || !NCommon::ValidateFormatForOutput(format, ctx)) { return TStatus::Error; } @@ -126,7 +127,7 @@ private: return false; } - return NCommon::ValidateCompressionForOutput(value.Content(), ctx); + return NCommon::ValidateCompressionForOutput(format, value.Content(), ctx); } if (name == "partitionedby") { diff --git a/ydb/library/yql/providers/s3/provider/yql_s3_datasource_type_ann.cpp b/ydb/library/yql/providers/s3/provider/yql_s3_datasource_type_ann.cpp index 908aebd3bd7..c638bb4bf6a 100644 --- a/ydb/library/yql/providers/s3/provider/yql_s3_datasource_type_ann.cpp +++ b/ydb/library/yql/providers/s3/provider/yql_s3_datasource_type_ann.cpp @@ -505,7 +505,7 @@ public: if (!ExtractSettingValue(setting.Tail(), "compression"sv, format, {}, ctx, compression)) { return false; } - return NCommon::ValidateCompressionForInput(compression, ctx); + return NCommon::ValidateCompressionForInput(format, compression, ctx); } if (name == "partitionedby"sv) { |