summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/sql_query.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-02-27 23:18:15 +0300
committervvvv <[email protected]>2025-02-27 23:34:50 +0300
commit042383afc665c770fae0a51b02fcd6671cc3bd35 (patch)
tree7f8f59a59a8787c40e2122b5db516f0290bcd0d9 /yql/essentials/sql/v1/sql_query.cpp
parent3db2ee495441f7b48430a02787b86444108f65a9 (diff)
refine Antlr deps
refine Antlr deps commit_hash:71b99424edb283bf56be6e79c9c9a19d805ce2ce
Diffstat (limited to 'yql/essentials/sql/v1/sql_query.cpp')
-rw-r--r--yql/essentials/sql/v1/sql_query.cpp63
1 files changed, 31 insertions, 32 deletions
diff --git a/yql/essentials/sql/v1/sql_query.cpp b/yql/essentials/sql/v1/sql_query.cpp
index 34f137016ad..6dc510bf571 100644
--- a/yql/essentials/sql/v1/sql_query.cpp
+++ b/yql/essentials/sql/v1/sql_query.cpp
@@ -4,8 +4,7 @@
#include "sql_into_tables.h"
#include "sql_values.h"
#include "node.h"
-#include <yql/essentials/parser/proto_ast/gen/v1/SQLv1Lexer.h>
-#include <yql/essentials/parser/proto_ast/gen/v1_antlr4/SQLv1Antlr4Lexer.h>
+#include "antlr_token.h"
#include <yql/essentials/sql/v1/object_processing.h>
#include <yql/essentials/utils/yql_paths.h>
#include <util/generic/scope.h>
@@ -314,8 +313,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (rule.HasBlock2()) { // OR REPLACE
replaceIfExists = true;
Y_DEBUG_ABORT_UNLESS(
- (IS_TOKEN(rule.GetBlock2().GetToken1().GetId(), OR) &&
- IS_TOKEN(rule.GetBlock2().GetToken2().GetId(), REPLACE))
+ (IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock2().GetToken1().GetId(), OR) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock2().GetToken2().GetId(), REPLACE))
);
}
@@ -324,7 +323,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
ETableType tableType = ETableType::Table;
bool temporary = false;
if (block.HasAlt2() &&
- IS_TOKEN(block.GetAlt2().GetToken1().GetId(), TABLESTORE)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, block.GetAlt2().GetToken1().GetId(), TABLESTORE)
) {
tableType = ETableType::TableStore;
if (isCreateTableAs) {
@@ -333,7 +332,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
return false;
}
} else if (block.HasAlt3() &&
- IS_TOKEN(block.GetAlt3().GetToken1().GetId(), EXTERNAL)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, block.GetAlt3().GetToken1().GetId(), EXTERNAL)
) {
tableType = ETableType::ExternalTable;
if (isCreateTableAs) {
@@ -341,8 +340,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
<< "CREATE TABLE AS is not supported for EXTERNAL TABLE";
return false;
}
- } else if (block.HasAlt4() && IS_TOKEN(block.GetAlt4().GetToken1().GetId(), TEMP) ||
- block.HasAlt5() && IS_TOKEN(block.GetAlt5().GetToken1().GetId(), TEMPORARY)) {
+ } else if (block.HasAlt4() && IS_TOKEN(Ctx.Settings.Antlr4Parser, block.GetAlt4().GetToken1().GetId(), TEMP) ||
+ block.HasAlt5() && IS_TOKEN(Ctx.Settings.Antlr4Parser, block.GetAlt5().GetToken1().GetId(), TEMPORARY)) {
temporary = true;
}
@@ -350,9 +349,9 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (rule.HasBlock4()) { // IF NOT EXISTS
existingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(rule.GetBlock4().GetToken1().GetId(), IF) &&
- IS_TOKEN(rule.GetBlock4().GetToken2().GetId(), NOT) &&
- IS_TOKEN(rule.GetBlock4().GetToken3().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock4().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock4().GetToken2().GetId(), NOT) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock4().GetToken3().GetId(), EXISTS)
);
}
@@ -439,8 +438,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (rule.HasBlock3()) { // IF EXISTS
missingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(rule.GetBlock3().GetToken1().GetId(), IF) &&
- IS_TOKEN(rule.GetBlock3().GetToken2().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock3().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetBlock3().GetToken2().GetId(), EXISTS)
);
}
@@ -531,7 +530,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
case TRule_sql_stmt_core::kAltSqlStmtCore15: {
Ctx.BodyPart();
const auto& rule = core.GetAlt_sql_stmt_core15().GetRule_alter_table_stmt1();
- const bool isTablestore = IS_TOKEN(rule.GetToken2().GetId(), TABLESTORE);
+ const bool isTablestore = IS_TOKEN(Ctx.Settings.Antlr4Parser, rule.GetToken2().GetId(), TABLESTORE);
TTableRef tr;
if (!SimpleTableRefImpl(rule.GetRule_simple_table_ref3(), tr)) {
return false;
@@ -813,7 +812,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
switch (node.GetBlock4().Alt_case()) {
case TRule_alter_group_stmt_TBlock4::kAlt1: {
auto& addDropNode = node.GetBlock4().GetAlt1();
- const bool isDrop = IS_TOKEN(addDropNode.GetToken1().GetId(), DROP);
+ const bool isDrop = IS_TOKEN(Ctx.Settings.Antlr4Parser, addDropNode.GetToken1().GetId(), DROP);
TVector<TDeferredAtom> roles;
bool allowSystemRoles = false;
roles.emplace_back();
@@ -862,13 +861,13 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
return false;
}
- const bool isUser = IS_TOKEN(node.GetToken2().GetId(), USER);
+ const bool isUser = IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetToken2().GetId(), USER);
bool missingOk = false;
if (node.HasBlock3()) { // IF EXISTS
missingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock3().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock3().GetToken2().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken2().GetId(), EXISTS)
);
}
@@ -904,9 +903,9 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock3()) { // IF NOT EXISTS
existingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock3().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock3().GetToken2().GetId(), NOT) &&
- IS_TOKEN(node.GetBlock3().GetToken3().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken2().GetId(), NOT) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken3().GetId(), EXISTS)
);
}
@@ -958,8 +957,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock3()) { // IF EXISTS
missingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock3().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock3().GetToken2().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken2().GetId(), EXISTS)
);
}
@@ -990,8 +989,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock2()) { // OR REPLACE
replaceIfExists = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock2().GetToken1().GetId(), OR) &&
- IS_TOKEN(node.GetBlock2().GetToken2().GetId(), REPLACE)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock2().GetToken1().GetId(), OR) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock2().GetToken2().GetId(), REPLACE)
);
}
@@ -999,9 +998,9 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock6()) { // IF NOT EXISTS
existingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock6().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock6().GetToken2().GetId(), NOT) &&
- IS_TOKEN(node.GetBlock6().GetToken3().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock6().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock6().GetToken2().GetId(), NOT) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock6().GetToken3().GetId(), EXISTS)
);
}
@@ -1057,8 +1056,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock5()) { // IF EXISTS
missingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock5().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock5().GetToken2().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock5().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock5().GetToken2().GetId(), EXISTS)
);
}
@@ -1814,8 +1813,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (node.HasBlock3()) { // IF EXISTS
params.MissingOk = true;
Y_DEBUG_ABORT_UNLESS(
- IS_TOKEN(node.GetBlock3().GetToken1().GetId(), IF) &&
- IS_TOKEN(node.GetBlock3().GetToken2().GetId(), EXISTS)
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken1().GetId(), IF) &&
+ IS_TOKEN(Ctx.Settings.Antlr4Parser, node.GetBlock3().GetToken2().GetId(), EXISTS)
);
}