Merge pull request #58710 from aiven-sal/aiven-sal/fix_normq2

Handle signed numeric literals in normalizeQuery
This commit is contained in:
Yarik Briukhovetskyi 2024-01-15 14:40:03 +01:00 committed by GitHub
commit 61889faabd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 1 deletions

View File

@ -167,6 +167,8 @@ void normalizeQueryToPODArray(const char * begin, const char * end, PaddedPODArr
continue;
}
}
else if (prev_comma && (token.type == TokenType::Plus || token.type == TokenType::Minus))
continue;
else
{
if (num_literals_in_sequence > 1)

View File

@ -23,3 +23,23 @@ SELECT ?..
SELECT ? xyz11
SELECT ?, xyz11
SELECT ?..
? - ?
?..
-?..
? - ?..
f(-?..)
[-?..]
? + ?
?..
-?..
? + ?..
f(+?..)
[+?..]
?.. + ?
?.. - ?..
f(+?..), ?
[+?..] - ?
-?.. - [+?..] - ?
(+?..) - ?
-?.. - (+?..) - ?
(+?..)

View File

@ -23,4 +23,23 @@ SELECT normalizeQuery('SELECT 1, ''xyz11''');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$ xyz11');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$, xyz11');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$, ''xyz11''');
SELECT normalizeQuery('1 - 2');
SELECT normalizeQuery('1, -2, 3');
SELECT normalizeQuery('-1, -2, 3');
SELECT normalizeQuery('1 - 2, 3, 4');
SELECT normalizeQuery('f(-2, 3)');
SELECT normalizeQuery('[-1, 2, 3]');
SELECT normalizeQuery('1 + 2');
SELECT normalizeQuery('1, +2, 3');
SELECT normalizeQuery('-1, +2, 3');
SELECT normalizeQuery('1 + 2, 3, 4');
SELECT normalizeQuery('f(+2, 3)');
SELECT normalizeQuery('[+1, 2, 3]');
SELECT normalizeQuery('1, 2, 3 + 4');
SELECT normalizeQuery('1, 2 - 3, 4');
SELECT normalizeQuery('f(+2, 3), 1');
SELECT normalizeQuery('[+1, 2, 3] - 1');
SELECT normalizeQuery('-1, 1 - [+1, 2, 3] - 1');
SELECT normalizeQuery('(+1, 2, 3) - 1');
SELECT normalizeQuery('-1, 1 - (+1, 2, 3) - 1');
SELECT normalizeQuery('(+1, 2, -3)');