summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraozeritsky <[email protected]>2022-03-31 19:30:56 +0300
committeraozeritsky <[email protected]>2022-03-31 19:30:56 +0300
commitb109b0629a87c94e27eb2b296c7b8c63a446a034 (patch)
tree2c87dab66f6b40a943275a0c77a487c82d23de49
parentb887f4667888c8712804b785a1c3759c5cf4d450 (diff)
YQL-13823: Check IsPersistable
ref:51c99ee2a0e417a0829d294aae7b84be4f49d999
-rw-r--r--ydb/library/yql/dq/type_ann/dq_type_ann.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/ydb/library/yql/dq/type_ann/dq_type_ann.cpp b/ydb/library/yql/dq/type_ann/dq_type_ann.cpp
index fcbd3bb9ecf..31dca5102e2 100644
--- a/ydb/library/yql/dq/type_ann/dq_type_ann.cpp
+++ b/ydb/library/yql/dq/type_ann/dq_type_ann.cpp
@@ -4,6 +4,7 @@
#include <ydb/library/yql/core/yql_join.h>
#include <ydb/library/yql/core/yql_opt_utils.h>
#include <ydb/library/yql/core/type_ann/type_ann_core.h>
+#include <ydb/library/yql/core/yql_type_helpers.h>
#include <ydb/library/yql/utils/log/log.h>
#include <ydb/library/yql/providers/common/provider/yql_provider.h>
@@ -98,6 +99,19 @@ TStatus AnnotateStage(const TExprNode::TPtr& stage, TExprContext& ctx) {
}
auto* argType = input->GetTypeAnn();
+ if constexpr (std::is_same_v<TStage, TDqPhyStage>) {
+ if (TDqConnection::Match(input.Get()) && argType->GetKind() == ETypeAnnotationKind::List) {
+ auto* itemType = argType->Cast<TListExprType>()->GetItemType();
+ if (!itemType->IsPersistable()) {
+ ctx.AddError(TIssue(ctx.GetPosition(input->Pos()), TStringBuilder()
+ << "Expected persistable data, but got: "
+ << *itemType));
+ ctx.AddError(TIssue(ctx.GetPosition(input->Pos()), "Persistable required. Atom, type, key, world, datasink, datasource, callable, resource, stream and lambda are not persistable"));
+ return TStatus::Error;
+ }
+ }
+ }
+
if (!TDqPhyPrecompute::Match(input.Get()) && input->Content() != "KqpTxResultBinding") {
if (argType->GetKind() == ETypeAnnotationKind::List) {
auto* listItemType = argType->Cast<TListExprType>()->GetItemType();