Skip to content

Commit d5ee48e

Browse files
authored
init (#1561)
1 parent 8b6a673 commit d5ee48e

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

ydb/library/yql/core/issue/protos/issue_id.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ message TIssuesIds {
3737
CORE_LEGACY_RANK_FOR_NULLABLE_KEYS = 1109;
3838
CORE_LEGACY_REGEX_ENGINE = 1110;
3939
CORE_ALIAS_SHADOWS_COLUMN = 1111;
40+
CORE_LINEAGE_INTERNAL_ERROR = 1112;
4041

4142
// core errors
4243
CORE_GC_NODES_LIMIT_EXCEEDED = 1500;

ydb/library/yql/core/issue/yql_issue.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,3 +651,7 @@ ids {
651651
code: YQL_UNTYPED_STRING_LITERALS
652652
severity: S_WARNING
653653
}
654+
ids {
655+
code: CORE_LINEAGE_INTERNAL_ERROR
656+
severity: S_WARNING
657+
}

ydb/library/yql/core/services/yql_lineage.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ namespace {
1212

1313
class TLineageScanner {
1414
public:
15-
TLineageScanner(const TExprNode& root, const TTypeAnnotationContext& ctx)
15+
TLineageScanner(const TExprNode& root, const TTypeAnnotationContext& ctx, TExprContext& exprCtx)
1616
: Root_(root)
1717
, Ctx_(ctx)
18+
, ExprCtx_(exprCtx)
1819
{}
1920

2021
TString Process() {
@@ -209,7 +210,15 @@ class TLineageScanner {
209210
return &lineage;
210211
}
211212

212-
if (node.IsCallable({"Unordered", "UnorderedSubquery", "Right!", "Skip", "Take", "Sort", "AssumeSorted"})) {
213+
if (node.IsCallable({
214+
"Unordered",
215+
"UnorderedSubquery",
216+
"Right!",
217+
"Skip",
218+
"Take",
219+
"Sort",
220+
"AssumeSorted",
221+
"SkipNullMembers"})) {
213222
lineage = *CollectLineage(node.Head());
214223
return &lineage;
215224
} else if (node.IsCallable("ExtractMembers")) {
@@ -224,11 +233,19 @@ class TLineageScanner {
224233
HandleWindow(lineage, node);
225234
} else if (node.IsCallable("EquiJoin")) {
226235
HandleEquiJoin(lineage, node);
236+
} else {
237+
Warning(node, TStringBuilder() << node.Content() << " is not supported");
227238
}
228239

229240
return &lineage;
230241
}
231242

243+
void Warning(const TExprNode& node, const TString& message) {
244+
auto issue = TIssue(ExprCtx_.GetPosition(node.Pos()), message);
245+
SetIssueCode(EYqlIssueCode::TIssuesIds_EIssueCode_CORE_LINEAGE_INTERNAL_ERROR, issue);
246+
ExprCtx_.AddWarning(issue);
247+
}
248+
232249
void HandleExtractMembers(TLineage& lineage, const TExprNode& node) {
233250
auto innerLineage = *CollectLineage(node.Head());
234251
if (innerLineage.Fields.Defined()) {
@@ -763,6 +780,7 @@ class TLineageScanner {
763780
private:
764781
const TExprNode& Root_;
765782
const TTypeAnnotationContext& Ctx_;
783+
TExprContext& ExprCtx_;
766784
TNodeMap<IDataProvider*> Reads_, Writes_;
767785
ui32 NextReadId_ = 0;
768786
ui32 NextWriteId_ = 0;
@@ -773,8 +791,8 @@ class TLineageScanner {
773791

774792
}
775793

776-
TString CalculateLineage(const TExprNode& root, const TTypeAnnotationContext& ctx) {
777-
TLineageScanner scanner(root, ctx);
794+
TString CalculateLineage(const TExprNode& root, const TTypeAnnotationContext& ctx, TExprContext& exprCtx) {
795+
TLineageScanner scanner(root, ctx, exprCtx);
778796
return scanner.Process();
779797
}
780798

ydb/library/yql/core/services/yql_lineage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
namespace NYql {
55

66
struct TTypeAnnotationContext;
7+
struct TExprContext;
78

8-
TString CalculateLineage(const TExprNode& root, const TTypeAnnotationContext& ctx);
9+
TString CalculateLineage(const TExprNode& root, const TTypeAnnotationContext& ctx, TExprContext& exprCtx);
910

1011
}

ydb/library/yql/core/services/yql_transform_pipeline.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,8 @@ TTransformationPipeline& TTransformationPipeline::AddLineageOptimization(TMaybe<
190190
Transformers_.push_back(TTransformStage(
191191
CreateFunctorTransformer(
192192
[typeCtx = TypeAnnotationContext_, &lineageOut](const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx) {
193-
Y_UNUSED(ctx);
194193
output = input;
195-
lineageOut = CalculateLineage(*input, *typeCtx);
194+
lineageOut = CalculateLineage(*input, *typeCtx, ctx);
196195
return IGraphTransformer::TStatus::Ok;
197196
}
198197
),

0 commit comments

Comments
 (0)