diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-08-14 10:12:11 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-08-14 10:45:28 +0300 |
commit | 00b0b9320087f944b944550edb8d64d68d2c4af0 (patch) | |
tree | 033c962ec0565ddd4706662e9e90fa82ee10b7c8 | |
parent | 9b7c69ec3dd0836987d9ce391f832b6f56176d34 (diff) | |
download | ydb-00b0b9320087f944b944550edb8d64d68d2c4af0.tar.gz |
YQL-16089 Restriction for specify column "_other".
-rw-r--r-- | ydb/library/yql/providers/yt/provider/yql_yt_helpers.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ydb/library/yql/providers/yt/provider/yql_yt_helpers.cpp b/ydb/library/yql/providers/yt/provider/yql_yt_helpers.cpp index e341a942c42..5d157c401bb 100644 --- a/ydb/library/yql/providers/yt/provider/yql_yt_helpers.cpp +++ b/ydb/library/yql/providers/yt/provider/yql_yt_helpers.cpp @@ -903,8 +903,13 @@ IGraphTransformer::TStatus UpdateTableMeta(const TExprNode::TPtr& tableNode, TEx if (hasUserSchema || hasUserColumns) { const auto setting = GetSetting(tableInfo.Settings.Ref(), hasUserSchema ? EYtSettingType::UserSchema : EYtSettingType::UserColumns); - auto type = setting->Child(1)->GetTypeAnn()->Cast<TTypeExprType>()->GetType()->Cast<TStructExprType>(); - auto prevRowSpec = tableInfo.RowSpec; + auto type = setting->Tail().GetTypeAnn()->Cast<TTypeExprType>()->GetType()->Cast<TStructExprType>(); + const auto prevRowSpec = tableInfo.RowSpec; + if (!(prevRowSpec && prevRowSpec->StrictSchema) && type->Cast<TStructExprType>()->FindItem("_other")) { + ctx.AddError(TIssue(ctx.GetPosition(setting->Tail().Pos()), "It is forbidden to specify the column '_other'.")); + return IGraphTransformer::TStatus::Error; + } + TVector<TString> explicitYson; if (prevRowSpec && hasUserColumns) { const bool hasNativeFlags = prevRowSpec->GetNativeYtTypeFlags() != 0; |