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
148namespace 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
0 commit comments