mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix NOT parsing
This commit is contained in:
parent
bf482f75a7
commit
fabff86788
@ -22,9 +22,10 @@ const char * ParserMultiplicativeExpression::operators[] =
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char * ParserUnaryMinusExpression::operators[] =
|
||||
const char * ParserUnaryExpression::operators[] =
|
||||
{
|
||||
"-", "negate",
|
||||
"NOT", "not",
|
||||
nullptr
|
||||
};
|
||||
|
||||
@ -539,7 +540,7 @@ bool ParserPrefixUnaryOperatorExpression::parseImpl(Pos & pos, ASTPtr & node, Ex
|
||||
}
|
||||
|
||||
|
||||
bool ParserUnaryMinusExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
bool ParserUnaryExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
/// As an exception, negative numbers should be parsed as literals, and not as an application of the operator.
|
||||
|
||||
|
@ -245,14 +245,14 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class ParserUnaryMinusExpression : public IParserBase
|
||||
class ParserUnaryExpression : public IParserBase
|
||||
{
|
||||
private:
|
||||
static const char * operators[];
|
||||
ParserPrefixUnaryOperatorExpression operator_parser {operators, std::make_unique<ParserTupleElementExpression>()};
|
||||
|
||||
protected:
|
||||
const char * getName() const override { return "unary minus expression"; }
|
||||
const char * getName() const override { return "unary expression"; }
|
||||
|
||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||
};
|
||||
@ -262,7 +262,7 @@ class ParserMultiplicativeExpression : public IParserBase
|
||||
{
|
||||
private:
|
||||
static const char * operators[];
|
||||
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserUnaryMinusExpression>()};
|
||||
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserUnaryExpression>()};
|
||||
|
||||
protected:
|
||||
const char * getName() const override { return "multiplicative expression"; }
|
||||
|
9
tests/queries/0_stateless/01921_not_chain.reference
Normal file
9
tests/queries/0_stateless/01921_not_chain.reference
Normal file
@ -0,0 +1,9 @@
|
||||
-- { echo }
|
||||
SELECT 1 != (NOT 1);
|
||||
1
|
||||
SELECT 1 != NOT 1;
|
||||
1
|
||||
EXPLAIN SYNTAX SELECT 1 != (NOT 1);
|
||||
SELECT 1 != NOT 1
|
||||
EXPLAIN SYNTAX SELECT 1 != NOT 1;
|
||||
SELECT 1 != NOT 1
|
5
tests/queries/0_stateless/01921_not_chain.sql
Normal file
5
tests/queries/0_stateless/01921_not_chain.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- { echo }
|
||||
SELECT 1 != (NOT 1);
|
||||
SELECT 1 != NOT 1;
|
||||
EXPLAIN SYNTAX SELECT 1 != (NOT 1);
|
||||
EXPLAIN SYNTAX SELECT 1 != NOT 1;
|
Loading…
Reference in New Issue
Block a user