summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/analysis/global/global.cpp
diff options
context:
space:
mode:
authorvitya-smirnov <[email protected]>2025-08-12 15:04:56 +0300
committervitya-smirnov <[email protected]>2025-08-12 15:29:12 +0300
commit088fbdd4485f80a02567bbe84ed0e3f35337eb3d (patch)
tree15177d3cbfb50769297613218fe2597c7c2f678c /yql/essentials/sql/v1/complete/analysis/global/global.cpp
parenta84a916fe9eff84d52151ee74e4c6ddcebcf00c2 (diff)
YQL-19747: Improve and fix completon engine
Played with the autocomplete and found some issues: https://nda.ya.ru/t/1F9ioYe37HVwo2. - Supported `min`, `max` parameters of the `RANGE` table function, respecting `prefix`. - Supported cluster detecton at table function, e.g. `SELECT * FROM plato.RANGE(Input1, Input2)`. - Made column filter not to ignore a table alias. - Supported keyword as identifier parsing. - Supported `ID_QUOTED` as table alias. commit_hash:9e9ff13373cd059e6a240ddff0ae18f599d790c0
Diffstat (limited to 'yql/essentials/sql/v1/complete/analysis/global/global.cpp')
-rw-r--r--yql/essentials/sql/v1/complete/analysis/global/global.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/yql/essentials/sql/v1/complete/analysis/global/global.cpp b/yql/essentials/sql/v1/complete/analysis/global/global.cpp
index f97c940bed4..95a260ee973 100644
--- a/yql/essentials/sql/v1/complete/analysis/global/global.cpp
+++ b/yql/essentials/sql/v1/complete/analysis/global/global.cpp
@@ -171,7 +171,7 @@ namespace NSQLComplete {
ctx.Use = FindUseStatement(parsed, nodes);
ctx.Names = Keys(nodes);
- ctx.EnclosingFunction = EnclosingFunction(parsed);
+ ctx.EnclosingFunction = EnclosingFunction(parsed, nodes);
ctx.Column = InferColumnContext(parsed, nodes);
if (ctx.Use && ctx.Column) {
@@ -206,10 +206,10 @@ namespace NSQLComplete {
return keys;
}
- void EnrichTableClusters(TColumnContext& column, const TUseContext& use) {
+ void EnrichTableClusters(TColumnContext& column, const TClusterContext& use) {
for (auto& table : column.Tables) {
if (table.Cluster.empty()) {
- table.Cluster = use.Cluster;
+ table.Cluster = use.Name;
}
}
}
@@ -252,10 +252,20 @@ namespace NSQLComplete {
} // namespace NSQLComplete
template <>
+void Out<NSQLComplete::TClusterContext>(IOutputStream& out, const NSQLComplete::TClusterContext& value) {
+ if (!value.Provider.empty()) {
+ out << value.Provider << ":";
+ }
+ out << value.Name;
+}
+
+template <>
void Out<NSQLComplete::TFunctionContext>(IOutputStream& out, const NSQLComplete::TFunctionContext& value) {
out << "TFunctionContext { ";
out << "Name: " << value.Name;
- out << ", Args: " << value.ArgumentNumber;
+ out << ", ArgN: " << value.ArgumentNumber;
+ out << ", Arg0: " << value.Arg0.GetOrElse("None");
+ out << ", Cluster: " << value.Cluster;
out << " }";
}