Skip to content

Commit

Permalink
Cherry-pick ab525d9 with conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
vitess-bot[bot] committed May 7, 2024
1 parent efb6984 commit 7f11142
Show file tree
Hide file tree
Showing 3 changed files with 2,804 additions and 109 deletions.
79 changes: 79 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3649,6 +3649,85 @@ var (
}, {
input: `select * from t1 where col1 like 'ks\_' and col2 = 'ks\_' and col1 like 'ks_' and col2 = 'ks_'`,
output: `select * from t1 where col1 like 'ks\_' and col2 = 'ks\_' and col1 like 'ks_' and col2 = 'ks_'`,
<<<<<<< HEAD
=======
}, {
input: "select 1 from dual where 'bac' = 'b' 'a' 'c'",
output: "select 1 from dual where 'bac' = 'bac'",
}, {
input: "select 'b' 'a' 'c'",
output: "select 'bac' from dual",
}, {
input: "select 1 where 'bac' = N'b' 'a' 'c'",
output: "select 1 from dual where 'bac' = N'bac'",
/*We need to ignore this test because, after the normalizer, we change the produced NChar
string into an introducer expression, so the vttablet will never see a NChar string */
ignoreNormalizerTest: true,
}, {
input: "select _ascii 'b' 'a' 'c'",
output: "select _ascii 'bac' from dual",
}, {
input: "SELECT time, subject, AVG(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, avg(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, BIT_AND(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, bit_and(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, BIT_OR(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, bit_or(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, BIT_XOR(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, bit_xor(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, COUNT(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, count(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, COUNT(*) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, count(*) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, MAX(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, max(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, MIN(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, min(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, STD(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, std(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, STDDEV(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, stddev(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, STDDEV_POP(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, stddev_pop(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, STDDEV_SAMP(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, stddev_samp(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, SUM(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, sum(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, VAR_POP(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, var_pop(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, VAR_SAMP(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, var_samp(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT time, subject, VARIANCE(val) OVER (PARTITION BY time, subject) AS window_result FROM observations GROUP BY time, subject;",
output: "select `time`, subject, variance(val) over ( partition by `time`, subject) as window_result from observations group by `time`, subject",
}, {
input: "SELECT id, coalesce( (SELECT Json_arrayagg(Json_array(id)) FROM (SELECT *, Row_number() over (ORDER BY users.order ASC) FROM unsharded as users WHERE users.purchaseorderid = orders.id) users), json_array()) AS users, coalesce( (SELECT json_arrayagg(json_array(id)) FROM (SELECT *, row_number() over (ORDER BY tests.order ASC) FROM unsharded as tests WHERE tests.purchaseorderid = orders.id) tests), json_array()) AS tests FROM unsharded as orders WHERE orders.id = 'xxx'",
output: "select id, coalesce((select Json_arrayagg(json_array(id)) from (select *, row_number() over ( order by users.`order` asc) from unsharded as users where users.purchaseorderid = orders.id) as users), json_array()) as users, coalesce((select json_arrayagg(json_array(id)) from (select *, row_number() over ( order by tests.`order` asc) from unsharded as tests where tests.purchaseorderid = orders.id) as tests), json_array()) as tests from unsharded as orders where orders.id = 'xxx'",
}, {
input: `kill connection 18446744073709551615`,
}, {
input: `kill query 18446744073709551615`,
}, {
input: `kill 18446744073709551615`,
output: `kill connection 18446744073709551615`,
}, {
input: `select * from tbl where foo is unknown or bar is not unknown`,
output: `select * from tbl where foo is null or bar is not null`,
>>>>>>> ab525d9cd5 (Fix wrong assignment to `sql_id_opt` in the parser (#15862))
}}
)

Expand Down
Loading

0 comments on commit 7f11142

Please sign in to comment.