Skip to content

Commit df7683b

Browse files
committed
Revert "YQL-17476 check for cycle during evaluation of file args (ydb-platform#1608)"
This reverts commit 1c12b54.
1 parent 0342dc0 commit df7683b

File tree

8 files changed

+8
-83
lines changed

8 files changed

+8
-83
lines changed

ydb/library/yql/providers/config/yql_config_provider.cpp

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace {
168168
for (auto& arg: flag.GetArgs()) {
169169
args.push_back(arg);
170170
}
171-
if (!ApplyFlag(pos, flag.GetName(), args, ctx, 0)) {
171+
if (!ApplyFlag(pos, flag.GetName(), args, ctx)) {
172172
return false;
173173
}
174174
}
@@ -260,23 +260,15 @@ namespace {
260260
for (size_t i = 3; i < node->ChildrenSize(); ++i) {
261261
if (node->Child(i)->IsCallable("EvaluateAtom")) {
262262
hasPendingEvaluations = true;
263-
break;
263+
return res;
264264
}
265265
if (!EnsureAtom(*node->Child(i), ctx)) {
266266
return {};
267267
}
268268
args.push_back(node->Child(i)->Content());
269269
}
270270

271-
if (hasPendingEvaluations) {
272-
if (!ValidateEvaluation(command, *node, ctx)) {
273-
return {};
274-
}
275-
276-
return res;
277-
}
278-
279-
if (!ApplyFlag(ctx.GetPosition(node->Child(2)->Pos()), command, args, ctx, node->UniqueId())) {
271+
if (!ApplyFlag(ctx.GetPosition(node->Child(2)->Pos()), command, args, ctx)) {
280272
return {};
281273
}
282274

@@ -468,30 +460,7 @@ namespace {
468460
return true;
469461
}
470462

471-
bool ValidateEvaluation(const TStringBuf name, const TExprNode& node, TExprContext& ctx) {
472-
if (name == "AddFileByUrl" || name == "AddFolderByUrl") {
473-
if (node.ChildrenSize() < 4) {
474-
ctx.AddError(TIssue(ctx.GetPosition(node.Pos()), TStringBuilder() << "Expected at least 4 arguments, but got " << node.ChildrenSize()));
475-
return false;
476-
}
477-
478-
if (node.Child(3)->IsCallable("EvaluateAtom")) {
479-
return true;
480-
}
481-
482-
if (!PendingEvaluationFiles.insert({TString(node.Child(3)->Content()), node.UniqueId()}).second) {
483-
ctx.AddError(TIssue(ctx.GetPosition(node.Pos()), TStringBuilder() << "Detected evaluation cycle for file: " << node.Child(3)->Content()));
484-
return false;
485-
}
486-
487-
return true;
488-
} else {
489-
return true;
490-
}
491-
}
492-
493-
bool ApplyFlag(const TPosition& pos, const TStringBuf name, const TVector<TStringBuf>& args, TExprContext& ctx,
494-
ui64 nodeUniqueId) {
463+
bool ApplyFlag(const TPosition& pos, const TStringBuf name, const TVector<TStringBuf>& args, TExprContext& ctx) {
495464
if (!IsSettingAllowed(pos, name, ctx)) {
496465
return false;
497466
}
@@ -505,15 +474,15 @@ namespace {
505474
return false;
506475
}
507476
} else if (name == "AddFileByUrl") {
508-
if (!AddFileByUrl(pos, args, ctx, nodeUniqueId)) {
477+
if (!AddFileByUrl(pos, args, ctx)) {
509478
return false;
510479
}
511480
} else if (name == "SetFileOption") {
512481
if (!SetFileOption(pos, args, ctx)) {
513482
return false;
514483
}
515484
} else if (name == "AddFolderByUrl") {
516-
if (!AddFolderByUrl(pos, args, ctx, nodeUniqueId)) {
485+
if (!AddFolderByUrl(pos, args, ctx)) {
517486
return false;
518487
}
519488
} else if (name == "SetPackageVersion") {
@@ -1040,13 +1009,12 @@ namespace {
10401009
return true;
10411010
}
10421011

1043-
bool AddFileByUrl(const TPosition& pos, const TVector<TStringBuf>& args, TExprContext& ctx, ui64 nodeUniqueId) {
1012+
bool AddFileByUrl(const TPosition& pos, const TVector<TStringBuf>& args, TExprContext& ctx) {
10441013
if (args.size() < 2 || args.size() > 3) {
10451014
ctx.AddError(TIssue(pos, TStringBuilder() << "Expected 2 or 3 arguments, but got " << args.size()));
10461015
return false;
10471016
}
10481017

1049-
PendingEvaluationFiles.erase({TString(args[0]),nodeUniqueId});
10501018
TStringBuf token = args.size() == 3 ? args[2] : TStringBuf();
10511019
if (token) {
10521020
if (auto cred = Types.Credentials->FindCredential(token)) {
@@ -1160,13 +1128,12 @@ namespace {
11601128
return url;
11611129
}
11621130

1163-
bool AddFolderByUrl(const TPosition& pos, const TVector<TStringBuf>& args, TExprContext& ctx, ui64 nodeUniqueId) {
1131+
bool AddFolderByUrl(const TPosition& pos, const TVector<TStringBuf>& args, TExprContext& ctx) {
11641132
if (args.size() < 2 || args.size() > 3) {
11651133
ctx.AddError(TIssue(pos, TStringBuilder() << "Expected 2 or 3 arguments, but got " << args.size()));
11661134
return false;
11671135
}
11681136

1169-
PendingEvaluationFiles.erase({TString(args[0]),nodeUniqueId});
11701137
TStringBuf token = args.size() == 3 ? args[2] : TStringBuf();
11711138
if (token) {
11721139
if (auto cred = Types.Credentials->FindCredential(token)) {
@@ -1263,7 +1230,6 @@ namespace {
12631230
TString Username;
12641231
const TAllowSettingPolicy Policy;
12651232
TOperationStatistics Statistics;
1266-
THashSet<std::pair<TString, ui64>> PendingEvaluationFiles;
12671233
};
12681234
}
12691235

ydb/library/yql/tests/sql/dq_file/part8/canondata/result.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
}
2222
],
2323
"test.test[action-evaluate_pure--Results]": [],
24-
"test.test[action-file_cycle--Results]": [
25-
{
26-
"uri": "file://test.test_action-file_cycle--Results_/extracted"
27-
}
28-
],
2924
"test.test[action-nested_eval-default.txt-Analyze]": [
3025
{
3126
"checksum": "b4dd508a329723c74293d80f0278c705",

ydb/library/yql/tests/sql/dq_file/part8/canondata/test.test_action-file_cycle--Results_/extracted

Lines changed: 0 additions & 5 deletions
This file was deleted.

ydb/library/yql/tests/sql/sql2yql/canondata/result.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,6 @@
426426
"uri": "https://{canondata_backend}/1936947/659b615f15086142a8960946dabd06b519d43335/resource.tar.gz#test_sql2yql.test_action-export_action_/sql.yql"
427427
}
428428
],
429-
"test_sql2yql.test[action-file_cycle]": [
430-
{
431-
"checksum": "095c2c315ba26037554c056a02f5af05",
432-
"size": 343,
433-
"uri": "https://{canondata_backend}/1871002/4d084a25cea0c62bd09f3c9e9e7c2b56d112c5b1/resource.tar.gz#test_sql2yql.test_action-file_cycle_/sql.yql"
434-
}
435-
],
436429
"test_sql2yql.test[action-inline_action]": [
437430
{
438431
"checksum": "928aaa85637625e18fef89b35501f0f3",
@@ -18997,13 +18990,6 @@
1899718990
"uri": "https://{canondata_backend}/1871102/17992aa919577eec0f31ef167084ab70f41ccc80/resource.tar.gz#test_sql_format.test_action-export_action_/formatted.sql"
1899818991
}
1899918992
],
19000-
"test_sql_format.test[action-file_cycle]": [
19001-
{
19002-
"checksum": "5476df82092007027246993752e24f68",
19003-
"size": 45,
19004-
"uri": "https://{canondata_backend}/1871002/4d084a25cea0c62bd09f3c9e9e7c2b56d112c5b1/resource.tar.gz#test_sql_format.test_action-file_cycle_/formatted.sql"
19005-
}
19006-
],
1900718993
"test_sql_format.test[action-inline_action]": [
1900818994
{
1900918995
"checksum": "7da554999ea3520183678c730ae2fffb",

ydb/library/yql/tests/sql/suites/action/file_cycle.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

ydb/library/yql/tests/sql/suites/action/file_cycle.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

ydb/library/yql/tests/sql/yt_native_file/part8/canondata/result.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@
2020
"uri": "https://{canondata_backend}/1775059/105879cd875204bc7c66426c8bfdd2bbd01bfaf7/resource.tar.gz#test.test_action-evaluate_pure--Results_/results.txt"
2121
}
2222
],
23-
"test.test[action-file_cycle--Debug]": [],
24-
"test.test[action-file_cycle--Plan]": [],
25-
"test.test[action-file_cycle--Results]": [
26-
{
27-
"uri": "file://test.test_action-file_cycle--Results_/extracted"
28-
}
29-
],
3023
"test.test[action-nested_eval-default.txt-Debug]": [
3124
{
3225
"checksum": "dfc49c1f6f30ac41794475c26145cd89",

ydb/library/yql/tests/sql/yt_native_file/part8/canondata/test.test_action-file_cycle--Results_/extracted

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)