| -- Automatically generated by SQLQueryTestSuite |
| -- !query |
| create or replace temporary view nested as values |
| (1, array(32, 97), array(array(12, 99), array(123, 42), array(1))), |
| (2, array(77, -76), array(array(6, 96, 65), array(-1, -2))), |
| (3, array(12), array(array(17))) |
| as t(x, ys, zs) |
| -- !query analysis |
| CreateViewCommand `nested`, values |
| (1, array(32, 97), array(array(12, 99), array(123, 42), array(1))), |
| (2, array(77, -76), array(array(6, 96, 65), array(-1, -2))), |
| (3, array(12), array(array(17))) |
| as t(x, ys, zs), false, true, LocalTempView, true |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select upper(x -> x) as v |
| -- !query analysis |
| org.apache.spark.sql.AnalysisException |
| { |
| "errorClass" : "INVALID_LAMBDA_FUNCTION_CALL.NON_HIGHER_ORDER_FUNCTION", |
| "sqlState" : "42K0D", |
| "messageParameters" : { |
| "class" : "org.apache.spark.sql.catalyst.expressions.Upper" |
| }, |
| "queryContext" : [ { |
| "objectType" : "", |
| "objectName" : "", |
| "startIndex" : 8, |
| "stopIndex" : 20, |
| "fragment" : "upper(x -> x)" |
| } ] |
| } |
| |
| |
| -- !query |
| select ceil(x -> x) as v |
| -- !query analysis |
| org.apache.spark.sql.AnalysisException |
| { |
| "errorClass" : "INVALID_LAMBDA_FUNCTION_CALL.NON_HIGHER_ORDER_FUNCTION", |
| "sqlState" : "42K0D", |
| "messageParameters" : { |
| "class" : "org.apache.spark.sql.catalyst.expressions.CeilExpressionBuilder$" |
| }, |
| "queryContext" : [ { |
| "objectType" : "", |
| "objectName" : "", |
| "startIndex" : 8, |
| "stopIndex" : 19, |
| "fragment" : "ceil(x -> x)" |
| } ] |
| } |
| |
| |
| -- !query |
| select transform(zs, z -> z) as v from nested |
| -- !query analysis |
| Project [transform(zs#x, lambdafunction(lambda z#x, lambda z#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(ys, y -> y * y) as v from nested |
| -- !query analysis |
| Project [transform(ys#x, lambdafunction((lambda y#x * lambda y#x), lambda y#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(ys, (y, i) -> y + i) as v from nested |
| -- !query analysis |
| Project [transform(ys#x, lambdafunction((lambda y#x + lambda i#x), lambda y#x, lambda i#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(zs, z -> concat(ys, z)) as v from nested |
| -- !query analysis |
| Project [transform(zs#x, lambdafunction(concat(ys#x, lambda z#x), lambda z#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(ys, 0) as v from nested |
| -- !query analysis |
| Project [transform(ys#x, lambdafunction(0, lambda col0#x, true)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(cast(null as array<int>), x -> x + 1) as v |
| -- !query analysis |
| Project [transform(cast(null as array<int>), lambdafunction((lambda x#x + 1), lambda x#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select filter(ys, y -> y > 30) as v from nested |
| -- !query analysis |
| Project [filter(ys#x, lambdafunction((lambda y#x > 30), lambda y#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select filter(cast(null as array<int>), y -> true) as v |
| -- !query analysis |
| Project [filter(cast(null as array<int>), lambdafunction(true, lambda y#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select transform(zs, z -> filter(z, zz -> zz > 50)) as v from nested |
| -- !query analysis |
| Project [transform(zs#x, lambdafunction(filter(lambda z#x, lambdafunction((lambda zz#x > 50), lambda zz#x, false)), lambda z#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select aggregate(ys, 0, (y, a) -> y + a + x) as v from nested |
| -- !query analysis |
| Project [aggregate(ys#x, 0, lambdafunction(((lambda y#x + lambda a#x) + x#x), lambda y#x, lambda a#x, false), lambdafunction(lambda id#x, lambda id#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select aggregate(ys, (0 as sum, 0 as n), (acc, x) -> (acc.sum + x, acc.n + 1), acc -> acc.sum / acc.n) as v from nested |
| -- !query analysis |
| Project [aggregate(ys#x, named_struct(sum, 0, n, 0), lambdafunction(named_struct(col1, (lambda acc#x.sum + lambda x#x), col2, (lambda acc#x.n + 1)), lambda acc#x, lambda x#x, false), lambdafunction((cast(lambda acc#x.sum as double) / cast(lambda acc#x.n as double)), lambda acc#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(zs, z -> aggregate(z, 1, (acc, val) -> acc * val * size(z))) as v from nested |
| -- !query analysis |
| Project [transform(zs#x, lambdafunction(aggregate(lambda z#x, 1, lambdafunction(((lambda acc#x * lambda val#x) * size(lambda z#x, true)), lambda acc#x, lambda val#x, false), lambdafunction(lambda id#x, lambda id#x, false)), lambda z#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select aggregate(cast(null as array<int>), 0, (a, y) -> a + y + 1, a -> a + 2) as v |
| -- !query analysis |
| Project [aggregate(cast(null as array<int>), 0, lambdafunction(((lambda a#x + lambda y#x) + 1), lambda a#x, lambda y#x, false), lambdafunction((lambda a#x + 2), lambda a#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select reduce(ys, 0, (y, a) -> y + a + x) as v from nested |
| -- !query analysis |
| Project [reduce(ys#x, 0, lambdafunction(((lambda y#x + lambda a#x) + x#x), lambda y#x, lambda a#x, false), lambdafunction(lambda id#x, lambda id#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select reduce(ys, (0 as sum, 0 as n), (acc, x) -> (acc.sum + x, acc.n + 1), acc -> acc.sum / acc.n) as v from nested |
| -- !query analysis |
| Project [reduce(ys#x, named_struct(sum, 0, n, 0), lambdafunction(named_struct(col1, (lambda acc#x.sum + lambda x#x), col2, (lambda acc#x.n + 1)), lambda acc#x, lambda x#x, false), lambdafunction((cast(lambda acc#x.sum as double) / cast(lambda acc#x.n as double)), lambda acc#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select transform(zs, z -> reduce(z, 1, (acc, val) -> acc * val * size(z))) as v from nested |
| -- !query analysis |
| Project [transform(zs#x, lambdafunction(reduce(lambda z#x, 1, lambdafunction(((lambda acc#x * lambda val#x) * size(lambda z#x, true)), lambda acc#x, lambda val#x, false), lambdafunction(lambda id#x, lambda id#x, false)), lambda z#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select reduce(cast(null as array<int>), 0, (a, y) -> a + y + 1, a -> a + 2) as v |
| -- !query analysis |
| Project [reduce(cast(null as array<int>), 0, lambdafunction(((lambda a#x + lambda y#x) + 1), lambda a#x, lambda y#x, false), lambdafunction((lambda a#x + 2), lambda a#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select exists(ys, y -> y > 30) as v from nested |
| -- !query analysis |
| Project [exists(ys#x, lambdafunction((lambda y#x > 30), lambda y#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select exists(cast(null as array<int>), y -> y > 30) as v |
| -- !query analysis |
| Project [exists(cast(null as array<int>), lambdafunction((lambda y#x > 30), lambda y#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select zip_with(ys, zs, (a, b) -> a + size(b)) as v from nested |
| -- !query analysis |
| Project [zip_with(ys#x, zs#x, lambdafunction((lambda a#x + size(lambda b#x, true)), lambda a#x, lambda b#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x, zs#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as array<int>) AS ys#x, cast(zs#x as array<array<int>>) AS zs#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x, zs#x] |
| |
| |
| -- !query |
| select zip_with(array('a', 'b', 'c'), array('d', 'e', 'f'), (x, y) -> concat(x, y)) as v |
| -- !query analysis |
| Project [zip_with(array(a, b, c), array(d, e, f), lambdafunction(concat(lambda x#x, lambda y#x), lambda x#x, lambda y#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| select zip_with(array('a'), array('d', null, 'f'), (x, y) -> coalesce(x, y)) as v |
| -- !query analysis |
| Project [zip_with(array(a), array(d, cast(null as string), f), lambdafunction(coalesce(lambda x#x, lambda y#x), lambda x#x, lambda y#x, false)) AS v#x] |
| +- OneRowRelation |
| |
| |
| -- !query |
| create or replace temporary view nested as values |
| (1, map(1, 1, 2, 2, 3, 3)), |
| (2, map(4, 4, 5, 5, 6, 6)) |
| as t(x, ys) |
| -- !query analysis |
| CreateViewCommand `nested`, values |
| (1, map(1, 1, 2, 2, 3, 3)), |
| (2, map(4, 4, 5, 5, 6, 6)) |
| as t(x, ys), false, true, LocalTempView, true |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_keys(ys, (k, v) -> k) as v from nested |
| -- !query analysis |
| Project [transform_keys(ys#x, lambdafunction(lambda k#x, lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_keys(ys, (k, v) -> k + 1) as v from nested |
| -- !query analysis |
| Project [transform_keys(ys#x, lambdafunction((lambda k#x + 1), lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_keys(ys, (k, v) -> k + v) as v from nested |
| -- !query analysis |
| Project [transform_keys(ys#x, lambdafunction((lambda k#x + lambda v#x), lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_values(ys, (k, v) -> v) as v from nested |
| -- !query analysis |
| Project [transform_values(ys#x, lambdafunction(lambda v#x, lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_values(ys, (k, v) -> v + 1) as v from nested |
| -- !query analysis |
| Project [transform_values(ys#x, lambdafunction((lambda v#x + 1), lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform_values(ys, (k, v) -> k + v) as v from nested |
| -- !query analysis |
| Project [transform_values(ys#x, lambdafunction((lambda k#x + lambda v#x), lambda k#x, lambda v#x, false)) AS v#x] |
| +- SubqueryAlias nested |
| +- View (`nested`, [x#x, ys#x]) |
| +- Project [cast(x#x as int) AS x#x, cast(ys#x as map<int,int>) AS ys#x] |
| +- SubqueryAlias t |
| +- LocalRelation [x#x, ys#x] |
| |
| |
| -- !query |
| select transform(ys, all -> all * all) as v from values (array(32, 97)) as t(ys) |
| -- !query analysis |
| Project [transform(ys#x, lambdafunction((lambda all#x * lambda all#x), lambda all#x, false)) AS v#x] |
| +- SubqueryAlias t |
| +- LocalRelation [ys#x] |
| |
| |
| -- !query |
| select transform(ys, (all, i) -> all + i) as v from values (array(32, 97)) as t(ys) |
| -- !query analysis |
| Project [transform(ys#x, lambdafunction((lambda all#x + lambda i#x), lambda all#x, lambda i#x, false)) AS v#x] |
| +- SubqueryAlias t |
| +- LocalRelation [ys#x] |
| |
| |
| -- !query |
| select aggregate(split('abcdefgh',''), array(array('')), (acc, x) -> array(array(x))) |
| -- !query analysis |
| Project [aggregate(split(abcdefgh, , -1), array(array()), lambdafunction(array(array(lambda x#x)), lambda acc#x, lambda x#x, false), lambdafunction(lambda id#x, lambda id#x, false)) AS aggregate(split(abcdefgh, , -1), array(array()), lambdafunction(array(array(namedlambdavariable())), namedlambdavariable(), namedlambdavariable()), lambdafunction(namedlambdavariable(), namedlambdavariable()))#x] |
| +- OneRowRelation |