Kusto-pahse1: Fixed moy style issues.

This commit is contained in:
Yong Wang 2022-06-12 20:05:51 -07:00
parent b9d850cad6
commit a90fb535a7
6 changed files with 14 additions and 16 deletions

View File

@ -83,7 +83,7 @@ String KQLOperators::genHaystackOpExpr(std::vector<String> &tokens,IParser::Pos
}
if (!tokens.empty() && ((++token_pos)->type == TokenType::StringLiteral || token_pos->type == TokenType::QuotedIdentifier))
new_expr = ch_op +"(" + tokens.back() +", '"+left_wildcards + String(token_pos->begin + 1,token_pos->end - 1 ) + right_wildcards + "')";
new_expr = ch_op +"(" + tokens.back() +", '"+left_wildcards + String(token_pos->begin + 1,token_pos->end - 1 ) + right_wildcards + "')";
else
throw Exception(ErrorCodes::SYNTAX_ERROR, "Syntax error near {}", kql_op);
tokens.pop_back();
@ -102,7 +102,7 @@ String KQLOperators::getExprFromToken(IParser::Pos pos)
auto token = String(pos->begin,pos->end);
String op = token;
if ( token == "!" )
if ( token == "!")
{
++pos;
if (pos->isEnd() || pos->type == TokenType::PipeMark || pos->type == TokenType::Semicolon)
@ -183,7 +183,7 @@ String KQLOperators::getExprFromToken(IParser::Pos pos)
case KQLOperatorValue::not_equal:
break;
case KQLOperatorValue::equal_cs:
new_expr = "==";
break;
@ -191,7 +191,7 @@ String KQLOperators::getExprFromToken(IParser::Pos pos)
case KQLOperatorValue::not_equal_cs:
new_expr = "!=";
break;
case KQLOperatorValue::has:
new_expr = genHaystackOpExpr(tokens, pos, op, "hasTokenCaseInsensitive", WildcardsPos::none);
break;

View File

@ -6,7 +6,8 @@
namespace DB
{
class KQLOperators {
class KQLOperators
{
public:
String getExprFromToken(IParser::Pos pos);
protected:

View File

@ -42,6 +42,4 @@ bool ParserKQLProject :: parseImpl(Pos & pos, ASTPtr & node, Expected & expected
return true;
}
}

View File

@ -7,7 +7,6 @@
#include <Parsers/Kusto/ParserKQLFilter.h>
#include <Parsers/Kusto/ParserKQLSort.h>
#include <Parsers/Kusto/ParserKQLSummarize.h>
#include <Parsers/Kusto/ParserKQLFilter.h>
#include <Parsers/Kusto/ParserKQLLimit.h>
namespace DB
@ -15,8 +14,8 @@ namespace DB
bool ParserKQLBase :: parsePrepare(Pos & pos)
{
op_pos.push_back(pos);
return true;
op_pos.push_back(pos);
return true;
}
String ParserKQLBase :: getExprFromToken(Pos pos)

View File

@ -11,7 +11,7 @@ public:
protected:
std::vector<Pos> op_pos;
std::vector<String> expresions;
std::vector<String> expressions;
virtual String getExprFromToken(Pos pos);
};

View File

@ -9,17 +9,17 @@ namespace DB
bool ParserKQLTable :: parsePrepare(Pos & pos)
{
if (!op_pos.empty())
if (!op_pos.empty())
return false;
op_pos.push_back(pos);
return true;
op_pos.push_back(pos);
return true;
}
bool ParserKQLTable :: parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
std::unordered_set<String> sql_keywords
( {
({
"SELECT",
"INSERT",
"CREATE",
@ -42,7 +42,7 @@ bool ParserKQLTable :: parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
"TRUNCATE",
"USE",
"EXPLAIN"
} );
});
if (op_pos.empty())
return false;