diff options
author | wangfei <wangfei1@huawei.com> | 2015-02-04 15:12:07 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-02-04 15:12:07 -0800 |
commit | 417d1118cd720b616bfd30e9c1a0bfb1838e8cbd (patch) | |
tree | c3fa02e03c68f0274574d0340dfeb826760fd3be /sql/hive | |
parent | 424cb699ee9b091eb23b86dc018a86e377ad309f (diff) | |
download | spark-417d1118cd720b616bfd30e9c1a0bfb1838e8cbd.tar.gz spark-417d1118cd720b616bfd30e9c1a0bfb1838e8cbd.tar.bz2 spark-417d1118cd720b616bfd30e9c1a0bfb1838e8cbd.zip |
[SPARK-5367][SQL] Support star expression in udfs
A follow up for #4163: support `select array(key, *) from src`
Since array(key, *) will not go into this case
```
case Alias(f UnresolvedFunction(_, args), name) if containsStar(args) =>
val expandedArgs = args.flatMap {
case s: Star => s.expand(child.output, resolver)
case o => o :: Nil
}
```
here added a case to cover the corner case of array.
/cc liancheng
Author: wangfei <wangfei1@huawei.com>
Author: scwf <wangfei1@huawei.com>
Closes #4353 from scwf/udf-star1 and squashes the following commits:
4350d17 [wangfei] minor fix
a7cd191 [wangfei] minor fix
0942fb1 [wangfei] follow up: support select array(key, *) from src
6ae00db [wangfei] also fix problem with array
da1da09 [scwf] minor fix
f87b5f9 [scwf] added test case
587bf7e [wangfei] compile fix
eb93c16 [wangfei] fix star resolve issue in udf
Diffstat (limited to 'sql/hive')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala index 82efadb28e..a321452cef 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala @@ -620,6 +620,8 @@ class HiveQuerySuite extends HiveComparisonTest with BeforeAndAfter { test("SPARK-5367: resolve star expression in udf") { assert(sql("select concat(*) from src limit 5").collect().size == 5) assert(sql("select array(*) from src limit 5").collect().size == 5) + assert(sql("select concat(key, *) from src limit 5").collect().size == 5) + assert(sql("select array(key, *) from src limit 5").collect().size == 5) } test("Query Hive native command execution result") { |