blob: 59e71ad0bfc8d8b1a7adb1c5e7efbc378c97dfae [file] [log] [blame]
-- Automatically generated by SQLQueryTestSuite
-- !query
CREATE OR REPLACE TEMPORARY VIEW testData AS SELECT * FROM VALUES
(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2), (null, 1), (3, null), (null, null)
AS testData(a, b)
-- !query analysis
CreateViewCommand `testData`, SELECT * FROM VALUES
(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2), (null, 1), (3, null), (null, null)
AS testData(a, b), false, true, LocalTempView, true
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(a), udf(COUNT(b)) FROM testData
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "MISSING_GROUP_BY",
"sqlState" : "42803",
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 1,
"stopIndex" : 42,
"fragment" : "SELECT udf(a), udf(COUNT(b)) FROM testData"
} ]
}
-- !query
SELECT COUNT(udf(a)), udf(COUNT(b)) FROM testData
-- !query analysis
Aggregate [count(cast(udf(cast(a#x as string)) as int)) AS count(udf(a))#xL, cast(udf(cast(count(b#x) as string)) as bigint) AS udf(count(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(a), COUNT(udf(b)) FROM testData GROUP BY a
-- !query analysis
Aggregate [a#x], [cast(udf(cast(a#x as string)) as int) AS udf(a)#x, count(cast(udf(cast(b#x as string)) as int)) AS count(udf(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(a), udf(COUNT(udf(b))) FROM testData GROUP BY b
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "MISSING_AGGREGATION",
"sqlState" : "42803",
"messageParameters" : {
"expression" : "\"a\"",
"expressionAnyValue" : "\"any_value(a)\""
}
}
-- !query
SELECT COUNT(udf(a)), COUNT(udf(b)) FROM testData GROUP BY udf(a)
-- !query analysis
Aggregate [cast(udf(cast(a#x as string)) as int)], [count(cast(udf(cast(a#x as string)) as int)) AS count(udf(a))#xL, count(cast(udf(cast(b#x as string)) as int)) AS count(udf(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 'foo', COUNT(udf(a)) FROM testData GROUP BY 1
-- !query analysis
Aggregate [foo], [foo AS foo#x, count(cast(udf(cast(a#x as string)) as int)) AS count(udf(a))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 'foo' FROM testData WHERE a = 0 GROUP BY udf(1)
-- !query analysis
Aggregate [cast(udf(cast(1 as string)) as int)], [foo AS foo#x]
+- Filter (a#x = 0)
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 'foo', udf(APPROX_COUNT_DISTINCT(udf(a))) FROM testData WHERE a = 0 GROUP BY udf(1)
-- !query analysis
Aggregate [cast(udf(cast(1 as string)) as int)], [foo AS foo#x, cast(udf(cast(approx_count_distinct(cast(udf(cast(a#x as string)) as int), 0.05, 0, 0) as string)) as bigint) AS udf(approx_count_distinct(udf(a)))#xL]
+- Filter (a#x = 0)
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 'foo', MAX(STRUCT(udf(a))) FROM testData WHERE a = 0 GROUP BY udf(1)
-- !query analysis
Aggregate [cast(udf(cast(1 as string)) as int)], [foo AS foo#x, max(struct(col1, cast(udf(cast(a#x as string)) as int))) AS max(struct(udf(a)))#x]
+- Filter (a#x = 0)
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(a + b), udf(COUNT(b)) FROM testData GROUP BY a + b
-- !query analysis
Aggregate [(a#x + b#x)], [cast(udf(cast((a#x + b#x) as string)) as int) AS udf((a + b))#x, cast(udf(cast(count(b#x) as string)) as bigint) AS udf(count(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(a + 2), udf(COUNT(b)) FROM testData GROUP BY a + 1
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "MISSING_AGGREGATION",
"sqlState" : "42803",
"messageParameters" : {
"expression" : "\"a\"",
"expressionAnyValue" : "\"any_value(a)\""
}
}
-- !query
SELECT udf(a + 1) + 1, udf(COUNT(b)) FROM testData GROUP BY udf(a + 1)
-- !query analysis
Aggregate [cast(udf(cast((a#x + 1) as string)) as int)], [(cast(udf(cast((a#x + 1) as string)) as int) + 1) AS (udf((a + 1)) + 1)#x, cast(udf(cast(count(b#x) as string)) as bigint) AS udf(count(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT SKEWNESS(udf(a)), udf(KURTOSIS(a)), udf(MIN(a)), MAX(udf(a)), udf(AVG(udf(a))), udf(VARIANCE(a)), STDDEV(udf(a)), udf(SUM(a)), udf(COUNT(a))
FROM testData
-- !query analysis
Aggregate [skewness(cast(cast(udf(cast(a#x as string)) as int) as double)) AS skewness(udf(a))#x, cast(udf(cast(kurtosis(cast(a#x as double)) as string)) as double) AS udf(kurtosis(a))#x, cast(udf(cast(min(a#x) as string)) as int) AS udf(min(a))#x, max(cast(udf(cast(a#x as string)) as int)) AS max(udf(a))#x, cast(udf(cast(avg(cast(udf(cast(a#x as string)) as int)) as string)) as double) AS udf(avg(udf(a)))#x, cast(udf(cast(variance(cast(a#x as double)) as string)) as double) AS udf(variance(a))#x, stddev(cast(cast(udf(cast(a#x as string)) as int) as double)) AS stddev(udf(a))#x, cast(udf(cast(sum(a#x) as string)) as bigint) AS udf(sum(a))#xL, cast(udf(cast(count(a#x) as string)) as bigint) AS udf(count(a))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT COUNT(DISTINCT udf(b)), udf(COUNT(DISTINCT b, c)) FROM (SELECT 1 AS a, 2 AS b, 3 AS c) GROUP BY udf(a)
-- !query analysis
Aggregate [cast(udf(cast(a#x as string)) as int)], [count(distinct cast(udf(cast(b#x as string)) as int)) AS count(DISTINCT udf(b))#xL, cast(udf(cast(count(distinct b#x, c#x) as string)) as bigint) AS udf(count(DISTINCT b, c))#xL]
+- SubqueryAlias __auto_generated_subquery_name
+- Project [1 AS a#x, 2 AS b#x, 3 AS c#x]
+- OneRowRelation
-- !query
SELECT udf(a) AS k, COUNT(udf(b)) FROM testData GROUP BY k
-- !query analysis
Aggregate [cast(udf(cast(a#x as string)) as int)], [cast(udf(cast(a#x as string)) as int) AS k#x, count(cast(udf(cast(b#x as string)) as int)) AS count(udf(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT a AS k, udf(COUNT(b)) FROM testData GROUP BY k HAVING k > 1
-- !query analysis
Filter (k#x > 1)
+- Aggregate [a#x], [a#x AS k#x, cast(udf(cast(count(b#x) as string)) as bigint) AS udf(count(b))#xL]
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(COUNT(b)) AS k FROM testData GROUP BY k
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "GROUP_BY_AGGREGATE",
"sqlState" : "42903",
"messageParameters" : {
"sqlExpr" : "CAST(udf(cast(count(b) as string)) AS BIGINT)"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 8,
"stopIndex" : 20,
"fragment" : "udf(COUNT(b))"
} ]
}
-- !query
CREATE OR REPLACE TEMPORARY VIEW testDataHasSameNameWithAlias AS SELECT * FROM VALUES
(1, 1, 3), (1, 2, 1) AS testDataHasSameNameWithAlias(k, a, v)
-- !query analysis
CreateViewCommand `testDataHasSameNameWithAlias`, SELECT * FROM VALUES
(1, 1, 3), (1, 2, 1) AS testDataHasSameNameWithAlias(k, a, v), false, true, LocalTempView, true
+- Project [k#x, a#x, v#x]
+- SubqueryAlias testDataHasSameNameWithAlias
+- LocalRelation [k#x, a#x, v#x]
-- !query
SELECT k AS a, udf(COUNT(udf(v))) FROM testDataHasSameNameWithAlias GROUP BY udf(a)
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "MISSING_AGGREGATION",
"sqlState" : "42803",
"messageParameters" : {
"expression" : "\"k\"",
"expressionAnyValue" : "\"any_value(k)\""
}
}
-- !query
set spark.sql.groupByAliases=false
-- !query analysis
SetCommand (spark.sql.groupByAliases,Some(false))
-- !query
SELECT a AS k, udf(COUNT(udf(b))) FROM testData GROUP BY k
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "UNRESOLVED_COLUMN.WITH_SUGGESTION",
"sqlState" : "42703",
"messageParameters" : {
"objectName" : "`k`",
"proposal" : "`a`, `b`"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 58,
"stopIndex" : 58,
"fragment" : "k"
} ]
}
-- !query
SELECT udf(a), COUNT(udf(1)) FROM testData WHERE false GROUP BY udf(a)
-- !query analysis
Aggregate [cast(udf(cast(a#x as string)) as int)], [cast(udf(cast(a#x as string)) as int) AS udf(a)#x, count(cast(udf(cast(1 as string)) as int)) AS count(udf(1))#xL]
+- Filter false
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT udf(COUNT(1)) FROM testData WHERE false
-- !query analysis
Aggregate [cast(udf(cast(count(1) as string)) as bigint) AS udf(count(1))#xL]
+- Filter false
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 1 FROM (SELECT udf(COUNT(1)) FROM testData WHERE false) t
-- !query analysis
Project [1 AS 1#x]
+- SubqueryAlias t
+- Aggregate [cast(udf(cast(count(1) as string)) as bigint) AS udf(count(1))#xL]
+- Filter false
+- SubqueryAlias testdata
+- View (`testData`, [a#x, b#x])
+- Project [cast(a#x as int) AS a#x, cast(b#x as int) AS b#x]
+- Project [a#x, b#x]
+- SubqueryAlias testData
+- LocalRelation [a#x, b#x]
-- !query
SELECT 1 from (
SELECT 1 AS z,
udf(MIN(a.x))
FROM (select 1 as x) a
WHERE false
) b
where b.z != b.z
-- !query analysis
Project [1 AS 1#x]
+- Filter NOT (z#x = z#x)
+- SubqueryAlias b
+- Aggregate [1 AS z#x, cast(udf(cast(min(x#x) as string)) as int) AS udf(min(x))#x]
+- Filter false
+- SubqueryAlias a
+- Project [1 AS x#x]
+- OneRowRelation
-- !query
SELECT corr(DISTINCT x, y), udf(corr(DISTINCT y, x)), count(*)
FROM (VALUES (1, 1), (2, 2), (2, 2)) t(x, y)
-- !query analysis
Aggregate [corr(distinct cast(x#x as double), cast(y#x as double)) AS corr(DISTINCT x, y)#x, cast(udf(cast(corr(distinct cast(y#x as double), cast(x#x as double)) as string)) as double) AS udf(corr(DISTINCT y, x))#x, count(1) AS count(1)#xL]
+- SubqueryAlias t
+- Project [col1#x AS x#x, col2#x AS y#x]
+- LocalRelation [col1#x, col2#x]
-- !query
SELECT udf(1) FROM range(10) HAVING true
-- !query analysis
Filter cast(true as boolean)
+- Aggregate [cast(udf(cast(1 as string)) as int) AS udf(1)#x]
+- Range (0, 10, step=1)
-- !query
SELECT udf(udf(1)) FROM range(10) HAVING MAX(id) > 0
-- !query analysis
Project [udf(udf(1))#x]
+- Filter (max(id#xL)#xL > cast(0 as bigint))
+- Aggregate [cast(udf(cast(cast(udf(cast(1 as string)) as int) as string)) as int) AS udf(udf(1))#x, max(id#xL) AS max(id#xL)#xL]
+- Range (0, 10, step=1)
-- !query
SELECT udf(id) FROM range(10) HAVING id > 0
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "MISSING_GROUP_BY",
"sqlState" : "42803",
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 1,
"stopIndex" : 43,
"fragment" : "SELECT udf(id) FROM range(10) HAVING id > 0"
} ]
}
-- !query
CREATE OR REPLACE TEMPORARY VIEW test_agg AS SELECT * FROM VALUES
(1, true), (1, false),
(2, true),
(3, false), (3, null),
(4, null), (4, null),
(5, null), (5, true), (5, false) AS test_agg(k, v)
-- !query analysis
CreateViewCommand `test_agg`, SELECT * FROM VALUES
(1, true), (1, false),
(2, true),
(3, false), (3, null),
(4, null), (4, null),
(5, null), (5, true), (5, false) AS test_agg(k, v), false, true, LocalTempView, true
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(every(v)), udf(some(v)), any(v) FROM test_agg WHERE 1 = 0
-- !query analysis
Aggregate [cast(udf(cast(every(v#x) as string)) as boolean) AS udf(every(v))#x, cast(udf(cast(some(v#x) as string)) as boolean) AS udf(some(v))#x, any(v#x) AS any(v)#x]
+- Filter (1 = 0)
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(every(udf(v))), some(v), any(v) FROM test_agg WHERE k = 4
-- !query analysis
Aggregate [cast(udf(cast(every(cast(udf(cast(v#x as string)) as boolean)) as string)) as boolean) AS udf(every(udf(v)))#x, some(v#x) AS some(v)#x, any(v#x) AS any(v)#x]
+- Filter (k#x = 4)
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT every(v), udf(some(v)), any(v) FROM test_agg WHERE k = 5
-- !query analysis
Aggregate [every(v#x) AS every(v)#x, cast(udf(cast(some(v#x) as string)) as boolean) AS udf(some(v))#x, any(v#x) AS any(v)#x]
+- Filter (k#x = 5)
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(k), every(v), udf(some(v)), any(v) FROM test_agg GROUP BY udf(k)
-- !query analysis
Aggregate [cast(udf(cast(k#x as string)) as int)], [cast(udf(cast(k#x as string)) as int) AS udf(k)#x, every(v#x) AS every(v)#x, cast(udf(cast(some(v#x) as string)) as boolean) AS udf(some(v))#x, any(v#x) AS any(v)#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(k), every(v) FROM test_agg GROUP BY k HAVING every(v) = false
-- !query analysis
Filter (every(v)#x = false)
+- Aggregate [k#x], [cast(udf(cast(k#x as string)) as int) AS udf(k)#x, every(v#x) AS every(v)#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(k), udf(every(v)) FROM test_agg GROUP BY udf(k) HAVING every(v) IS NULL
-- !query analysis
Project [udf(k)#x, udf(every(v))#x]
+- Filter isnull(every(v#x)#x)
+- Aggregate [cast(udf(cast(k#x as string)) as int)], [cast(udf(cast(k#x as string)) as int) AS udf(k)#x, cast(udf(cast(every(v#x) as string)) as boolean) AS udf(every(v))#x, every(v#x) AS every(v#x)#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(k),
udf(Every(v)) AS every
FROM test_agg
WHERE k = 2
AND v IN (SELECT Any(v)
FROM test_agg
WHERE k = 1)
GROUP BY udf(k)
-- !query analysis
Aggregate [cast(udf(cast(k#x as string)) as int)], [cast(udf(cast(k#x as string)) as int) AS udf(k)#x, cast(udf(cast(every(v#x) as string)) as boolean) AS every#x]
+- Filter ((k#x = 2) AND v#x IN (list#x []))
: +- Aggregate [any(v#x) AS any(v)#x]
: +- Filter (k#x = 1)
: +- SubqueryAlias test_agg
: +- View (`test_agg`, [k#x, v#x])
: +- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
: +- Project [k#x, v#x]
: +- SubqueryAlias test_agg
: +- LocalRelation [k#x, v#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(udf(k)),
Every(v) AS every
FROM test_agg
WHERE k = 2
AND v IN (SELECT Every(v)
FROM test_agg
WHERE k = 1)
GROUP BY udf(udf(k))
-- !query analysis
Aggregate [cast(udf(cast(cast(udf(cast(k#x as string)) as int) as string)) as int)], [cast(udf(cast(cast(udf(cast(k#x as string)) as int) as string)) as int) AS udf(udf(k))#x, every(v#x) AS every#x]
+- Filter ((k#x = 2) AND v#x IN (list#x []))
: +- Aggregate [every(v#x) AS every(v)#x]
: +- Filter (k#x = 1)
: +- SubqueryAlias test_agg
: +- View (`test_agg`, [k#x, v#x])
: +- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
: +- Project [k#x, v#x]
: +- SubqueryAlias test_agg
: +- LocalRelation [k#x, v#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT every(udf(1))
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
"sqlState" : "42K09",
"messageParameters" : {
"inputSql" : "\"udf(1)\"",
"inputType" : "\"INT\"",
"paramIndex" : "first",
"requiredType" : "\"BOOLEAN\"",
"sqlExpr" : "\"every(udf(1))\""
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 8,
"stopIndex" : 20,
"fragment" : "every(udf(1))"
} ]
}
-- !query
SELECT some(udf(1S))
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
"sqlState" : "42K09",
"messageParameters" : {
"inputSql" : "\"udf(1)\"",
"inputType" : "\"SMALLINT\"",
"paramIndex" : "first",
"requiredType" : "\"BOOLEAN\"",
"sqlExpr" : "\"some(udf(1))\""
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 8,
"stopIndex" : 20,
"fragment" : "some(udf(1S))"
} ]
}
-- !query
SELECT any(udf(1L))
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
"sqlState" : "42K09",
"messageParameters" : {
"inputSql" : "\"udf(1)\"",
"inputType" : "\"BIGINT\"",
"paramIndex" : "first",
"requiredType" : "\"BOOLEAN\"",
"sqlExpr" : "\"any(udf(1))\""
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 8,
"stopIndex" : 19,
"fragment" : "any(udf(1L))"
} ]
}
-- !query
SELECT udf(every("true"))
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
"sqlState" : "42K09",
"messageParameters" : {
"inputSql" : "\"true\"",
"inputType" : "\"STRING\"",
"paramIndex" : "first",
"requiredType" : "\"BOOLEAN\"",
"sqlExpr" : "\"every(true)\""
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 12,
"stopIndex" : 24,
"fragment" : "every(\"true\")"
} ]
}
-- !query
SELECT k, v, every(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg
-- !query analysis
Project [k#x, v#x, every(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Project [k#x, v#x, every(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x, every(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Window [every(v#x) windowspecdefinition(k#x, v#x ASC NULLS FIRST, specifiedwindowframe(RangeFrame, unboundedpreceding$(), currentrow$())) AS every(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x], [k#x], [v#x ASC NULLS FIRST]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT k, udf(udf(v)), some(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg
-- !query analysis
Project [k#x, udf(udf(v))#x, some(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Project [k#x, udf(udf(v))#x, v#x, some(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x, some(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Window [some(v#x) windowspecdefinition(k#x, v#x ASC NULLS FIRST, specifiedwindowframe(RangeFrame, unboundedpreceding$(), currentrow$())) AS some(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x], [k#x], [v#x ASC NULLS FIRST]
+- Project [k#x, cast(udf(cast(cast(udf(cast(v#x as string)) as boolean) as string)) as boolean) AS udf(udf(v))#x, v#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(udf(k)), v, any(v) OVER (PARTITION BY k ORDER BY v) FROM test_agg
-- !query analysis
Project [udf(udf(k))#x, v#x, any(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Project [udf(udf(k))#x, v#x, k#x, any(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x, any(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x]
+- Window [any(v#x) windowspecdefinition(k#x, v#x ASC NULLS FIRST, specifiedwindowframe(RangeFrame, unboundedpreceding$(), currentrow$())) AS any(v) OVER (PARTITION BY k ORDER BY v ASC NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)#x], [k#x], [v#x ASC NULLS FIRST]
+- Project [cast(udf(cast(cast(udf(cast(k#x as string)) as int) as string)) as int) AS udf(udf(k))#x, v#x, k#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(count(*)) FROM test_agg HAVING count(*) > 1L
-- !query analysis
Project [udf(count(1))#xL]
+- Filter (count(1)#xL > 1)
+- Aggregate [cast(udf(cast(count(1) as string)) as bigint) AS udf(count(1))#xL, count(1) AS count(1)#xL]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT k, udf(max(v)) FROM test_agg GROUP BY k HAVING max(v) = true
-- !query analysis
Project [k#x, udf(max(v))#x]
+- Filter (max(v#x)#x = true)
+- Aggregate [k#x], [k#x, cast(udf(cast(max(v#x) as string)) as boolean) AS udf(max(v))#x, max(v#x) AS max(v#x)#x]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT * FROM (SELECT udf(COUNT(*)) AS cnt FROM test_agg) WHERE cnt > 1L
-- !query analysis
Project [cnt#xL]
+- Filter (cnt#xL > 1)
+- SubqueryAlias __auto_generated_subquery_name
+- Aggregate [cast(udf(cast(count(1) as string)) as bigint) AS cnt#xL]
+- SubqueryAlias test_agg
+- View (`test_agg`, [k#x, v#x])
+- Project [cast(k#x as int) AS k#x, cast(v#x as boolean) AS v#x]
+- Project [k#x, v#x]
+- SubqueryAlias test_agg
+- LocalRelation [k#x, v#x]
-- !query
SELECT udf(count(*)) FROM test_agg WHERE count(*) > 1L
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "INVALID_WHERE_CONDITION",
"sqlState" : "42903",
"messageParameters" : {
"condition" : "\"(count(1) > 1)\"",
"expressionList" : "count(1)"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 1,
"stopIndex" : 54,
"fragment" : "SELECT udf(count(*)) FROM test_agg WHERE count(*) > 1L"
} ]
}
-- !query
SELECT udf(count(*)) FROM test_agg WHERE count(*) + 1L > 1L
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "INVALID_WHERE_CONDITION",
"sqlState" : "42903",
"messageParameters" : {
"condition" : "\"((count(1) + 1) > 1)\"",
"expressionList" : "count(1)"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 1,
"stopIndex" : 59,
"fragment" : "SELECT udf(count(*)) FROM test_agg WHERE count(*) + 1L > 1L"
} ]
}
-- !query
SELECT udf(count(*)) FROM test_agg WHERE k = 1 or k = 2 or count(*) + 1L > 1L or max(k) > 1
-- !query analysis
org.apache.spark.sql.catalyst.ExtendedAnalysisException
{
"errorClass" : "INVALID_WHERE_CONDITION",
"sqlState" : "42903",
"messageParameters" : {
"condition" : "\"(((k = 1) OR (k = 2)) OR (((count(1) + 1) > 1) OR (max(k) > 1)))\"",
"expressionList" : "count(1), max(test_agg.k)"
},
"queryContext" : [ {
"objectType" : "",
"objectName" : "",
"startIndex" : 1,
"stopIndex" : 91,
"fragment" : "SELECT udf(count(*)) FROM test_agg WHERE k = 1 or k = 2 or count(*) + 1L > 1L or max(k) > 1"
} ]
}