cloud-fan commented on code in PR #48047: URL: https://github.com/apache/spark/pull/48047#discussion_r1758096325
########## sql/core/src/test/resources/sql-tests/inputs/pipe-operators.sql: ########## @@ -0,0 +1,99 @@ +-- Prepare some test data. +-------------------------- +drop table if exists t; +create table t(x int, y string) using csv; +insert into t values (0, 'abc'), (1, 'def'); + +drop table if exists other; +create table other(a int, b int) using json; +insert into other values (1, 1), (1, 2), (2, 4); + +drop table if exists st; +create table st(x int, col struct<i1:int, i2:int>) using parquet; +insert into st values (1, (2, 3)); + +-- Selection operators: positive tests. +--------------------------------------- + +-- Selecting a constant. +table t +|> select 1 as x; + +-- Selecting attributes. +table t +|> select x, y; + +-- Chained pipe SELECT operators. +table t +|> select x, y +|> select x + length(y) as z; + +-- Using the VALUES list as the source relation. +values (0), (1) tab(col) +|> select col * 2 as result; + +-- Using a table subquery as the source relation. +(select * from t union all select * from t) +|> select x + length(y) as result; + +-- Enclosing the result of a pipe SELECT operation in a table subquery. +(table t + |> select x, y + |> select x) +union all +select x from t where x < 1; + +-- Selecting struct fields. +(select col from st) +|> select col.i1; + +table st +|> select st.col.i1; + +-- Expression subqueries in the pipe operator SELECT list. +table t +|> select (select a from other where x = a limit 1) as result; Review Comment: can we also test pipe SQL in subquery expression? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
