diff options
author | dinmukhammed <dinmukhammed@yandex-team.ru> | 2022-03-09 14:38:27 +0300 |
---|---|---|
committer | dinmukhammed <dinmukhammed@yandex-team.ru> | 2022-03-09 14:38:27 +0300 |
commit | 34f4367a925410be3b114cfbd658518f0942ed55 (patch) | |
tree | df866ed8fdec50b975e00add1c73ced0452f6d30 | |
parent | 1097c234cd792a78a9695f57c4d1f27ea79bfbde (diff) | |
download | ydb-34f4367a925410be3b114cfbd658518f0942ed55.tar.gz |
YQ-937 Fixed s3 format validation
Fixed s3 format validation
ref:b237e217b1950a0e2c21bba4d82b8f60037fe598
-rw-r--r-- | ydb/library/yql/providers/s3/provider/yql_s3_datasource_type_ann.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
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 b102c7ab046..98d4c647829 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 @@ -15,21 +15,14 @@ using namespace NNodes; namespace { -std::pair<TStringBuf, TStringBuf> GetFormatAndCompression(const TExprNode& settings) { - TStringBuf compression; - TStringBuf format; +TStringBuf GetCompression(const TExprNode& settings) { for (auto i = 0U; i < settings.ChildrenSize(); ++i) { const auto& child = *settings.Child(i); if (child.Head().IsAtom("compression") && child.Tail().IsCallable({"String", "Utf8"})) if (const auto& comp = child.Tail().Head().Content(); !comp.empty()) - compression = comp; - if (child.Head().IsAtom("format")) - if (const auto& form = child.Tail().Head().Content(); !form.empty()) - format = form; - if (compression && format) - break; + return comp; } - return std::make_pair(format, compression); + return ""sv; } class TS3DataSourceTypeAnnotationTransformer : public TVisitorTransformerBase { @@ -131,7 +124,7 @@ public: return TStatus::Error; } - if (!EnsureAtom(*input->Child(TS3Object::idx_Format), ctx)) { + if (!EnsureAtom(*input->Child(TS3Object::idx_Format), ctx) || !NCommon::ValidateFormat(input->Child(TS3Object::idx_Format)->Content(), ctx)) { return TStatus::Error; } @@ -139,14 +132,7 @@ public: return TStatus::Error; } - const auto formatAndCompression = GetFormatAndCompression(*input->Child(TS3Object::idx_Settings)); // used for win32 build - const auto& format = formatAndCompression.first; - const auto& compression = formatAndCompression.second; - - if (!NCommon::ValidateFormat(format, ctx)) { - return TStatus::Error; - } - + const auto compression = GetCompression(*input->Child(TS3Object::idx_Settings)); if (!NCommon::ValidateCompression(compression, ctx)) { return TStatus::Error; } |