Skip to content

Commit 6066ffa

Browse files
committed
Intermediate changes
commit_hash:c8d74820e197343a1019edeff4f8c21fc5805244
1 parent 64d942a commit 6066ffa

File tree

8 files changed

+10
-53
lines changed

8 files changed

+10
-53
lines changed

yql/essentials/sql/v1/complete/analysis/yql/cluster.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "cluster.h"
22

3-
#define USE_CURRENT_UDF_ABI_VERSION
43
#include <yql/essentials/core/yql_expr_optimize.h>
54

65
namespace NSQLComplete {

yql/essentials/sql/v1/complete/analysis/yql/table.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "cluster.h"
44

5-
#define USE_CURRENT_UDF_ABI_VERSION
65
#include <yql/essentials/core/yql_expr_optimize.h>
76

87
namespace NSQLComplete {

yql/essentials/sql/v1/complete/analysis/yql/ut/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ SRCS(
55
)
66

77
PEERDIR(
8-
yql/essentials/minikql/invoke_builtins/no_llvm
98
yql/essentials/providers/common/provider
109
yql/essentials/parser/pg_wrapper
1110
yql/essentials/public/udf/service/stub

yql/essentials/sql/v1/complete/analysis/yql/ya.make

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ SRCS(
99
PEERDIR(
1010
yql/essentials/ast
1111
yql/essentials/core
12-
yql/essentials/core/services
13-
yql/essentials/minikql
14-
yql/essentials/minikql/invoke_builtins
1512
)
1613

14+
YQL_LAST_ABI_VERSION()
15+
1716
END()
1817

1918
RECURSE_FOR_TESTS(

yql/essentials/sql/v1/complete/analysis/yql/yql.cpp

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
#include "cluster.h"
44
#include "table.h"
55

6-
#define USE_CURRENT_UDF_ABI_VERSION
7-
#include <yql/essentials/core/yql_type_annotation.h>
8-
#include <yql/essentials/core/services/yql_eval_expr.h>
9-
#include <yql/essentials/minikql/mkql_function_registry.h>
10-
#include <yql/essentials/minikql/invoke_builtins/mkql_builtins.h>
11-
126
#include <library/cpp/iterator/iterate_keys.h>
137

148
namespace NSQLComplete {
@@ -34,16 +28,8 @@ namespace NSQLComplete {
3428

3529
class TYqlAnalysis: public IYqlAnalysis {
3630
public:
37-
TYqlAnalysis()
38-
: FunctionRegistry_(
39-
NKikimr::NMiniKQL::CreateFunctionRegistry(
40-
NKikimr::NMiniKQL::CreateBuiltinRegistry()))
41-
, Types_(MakeIntrusive<NYql::TTypeAnnotationContext>())
42-
{
43-
}
44-
4531
TYqlContext Analyze(NYql::TExprNode::TPtr root, NYql::TExprContext& ctx) const override {
46-
root = Optimized(std::move(root), ctx);
32+
Y_UNUSED(ctx);
4733

4834
TYqlContext yqlCtx;
4935

@@ -55,30 +41,6 @@ namespace NSQLComplete {
5541

5642
return yqlCtx;
5743
}
58-
59-
private:
60-
NYql::TExprNode::TPtr Optimized(NYql::TExprNode::TPtr expr, NYql::TExprContext& ctx) const {
61-
constexpr size_t AttemptsLimit = 128;
62-
63-
for (size_t i = 0; i < AttemptsLimit; ++i) {
64-
auto status = NYql::EvaluateExpression(expr, expr, *Types_, ctx, *FunctionRegistry_);
65-
if (status.Level != NYql::IGraphTransformer::TStatus::Repeat) {
66-
Y_ENSURE(status == NYql::IGraphTransformer::TStatus::Ok, "" << status);
67-
return expr;
68-
}
69-
}
70-
71-
ythrow yexception() << "Optimization was not converged after "
72-
<< AttemptsLimit << " attempts";
73-
}
74-
75-
static void Print(IOutputStream& out, const NYql::TExprNode& root, NYql::TExprContext& ctx) {
76-
auto ast = ConvertToAst(root, ctx, NYql::TExprAnnotationFlags::None, true);
77-
ast.Root->PrettyPrintTo(out, NYql::TAstPrintFlags::PerLine | NYql::TAstPrintFlags::ShortQuote);
78-
}
79-
80-
TIntrusivePtr<NKikimr::NMiniKQL::IFunctionRegistry> FunctionRegistry_;
81-
NYql::TTypeAnnotationContextPtr Types_;
8244
};
8345

8446
} // namespace

yql/essentials/sql/v1/complete/check/check_complete.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ namespace NSQLComplete {
6767
},
6868
MakeDefaultRanking());
6969

70-
auto engine = MakeSqlCompletionEngine(MakePureLexerSupplier(), std::move(service));
70+
auto engine = MakeSqlCompletionEngine(
71+
MakePureLexerSupplier(),
72+
std::move(service),
73+
MakeYQLConfiguration());
7174

7275
for (size_t i = 0, j = 0; i < Attempts && j < MaxAttempts; ++j) {
7376
size_t pos = RandomNumber<size_t>(query.size() + 1);
@@ -92,7 +95,7 @@ namespace NSQLComplete {
9295
bool CheckComplete(TStringBuf query, NYql::TExprNode::TPtr root, NYql::TExprContext& ctx, NYql::TIssues& issues) try {
9396
return CheckComplete(query, MakeYqlAnalysis()->Analyze(root, ctx));
9497
} catch (...) {
95-
issues.AddIssue(CurrentExceptionMessage());
98+
issues.AddIssue(FormatCurrentException());
9699
return false;
97100
}
98101

@@ -102,7 +105,7 @@ namespace NSQLComplete {
102105
.Transform([&](auto&& ctx) { return CheckComplete(query, std::move(ctx)); })
103106
.GetOrElse(false);
104107
} catch (...) {
105-
issues.AddIssue(CurrentExceptionMessage());
108+
issues.AddIssue(FormatCurrentException());
106109
return false;
107110
}
108111

yql/essentials/tools/sql2yql/sql2yql.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,8 @@ int BuildAST(int argc, char* argv[]) {
419419
int main(int argc, char* argv[]) {
420420
try {
421421
return BuildAST(argc, argv);
422-
} catch (const yexception& e) {
423-
Cerr << "Caught exception:" << e.what() << Endl;
424-
return 1;
425422
} catch (...) {
426-
Cerr << "Caught exception" << Endl;
423+
Cerr << "Caught exception: " << FormatCurrentException() << Endl;
427424
return 1;
428425
}
429426
return 0;

yql/essentials/tools/sql2yql/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ PEERDIR(
66
contrib/libs/antlr3_cpp_runtime
77
library/cpp/getopt
88
library/cpp/testing/unittest
9-
yql/essentials/minikql/invoke_builtins/no_llvm
109
yql/essentials/parser/lexer_common
1110
yql/essentials/parser/pg_wrapper
1211
yql/essentials/public/udf/service/stub

0 commit comments

Comments
 (0)