-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f18b905
commit 4028155
Showing
6 changed files
with
137 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE OR REPLACE TEMPORARY VIEW t1 AS SELECT * FROM VALUES | ||
(1), (2), (3), (4) | ||
as t1(int_col1); | ||
|
||
CREATE FUNCTION myDoubleAvg AS 'test.org.apache.spark.sql.MyDoubleAvg'; | ||
|
||
SELECT default.myDoubleAvg(int_col1) as my_avg from t1; | ||
|
||
SELECT default.myDoubleAvg(int_col1, 3) as my_avg from t1; | ||
|
||
CREATE FUNCTION udaf1 AS 'test.non.existent.udaf'; | ||
|
||
SELECT default.udaf1(int_col1) as udaf1 from t1; |
54 changes: 54 additions & 0 deletions
54
sql/core/src/test/resources/sql-tests/results/udaf.sql.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- Number of queries: 6 | ||
|
||
|
||
-- !query 0 | ||
CREATE OR REPLACE TEMPORARY VIEW t1 AS SELECT * FROM VALUES | ||
(1), (2), (3), (4) | ||
as t1(int_col1) | ||
-- !query 0 schema | ||
struct<> | ||
-- !query 0 output | ||
|
||
|
||
|
||
-- !query 1 | ||
CREATE FUNCTION myDoubleAvg AS 'test.org.apache.spark.sql.MyDoubleAvg' | ||
-- !query 1 schema | ||
struct<> | ||
-- !query 1 output | ||
|
||
|
||
|
||
-- !query 2 | ||
SELECT default.myDoubleAvg(int_col1) as my_avg from t1 | ||
-- !query 2 schema | ||
struct<my_avg:double> | ||
-- !query 2 output | ||
102.5 | ||
|
||
|
||
-- !query 3 | ||
SELECT default.myDoubleAvg(int_col1, 3) as my_avg from t1 | ||
-- !query 3 schema | ||
struct<> | ||
-- !query 3 output | ||
org.apache.spark.sql.AnalysisException | ||
No handler for UDAF 'test.org.apache.spark.sql.MyDoubleAvg': org.apache.spark.sql.AnalysisException: Invalid number of arguments for the function Expected: 1; Found: 2;; line 1 pos 7 | ||
|
||
|
||
-- !query 4 | ||
CREATE FUNCTION udaf1 AS 'test.non.existent.udaf' | ||
-- !query 4 schema | ||
struct<> | ||
-- !query 4 output | ||
|
||
|
||
|
||
-- !query 5 | ||
SELECT default.udaf1(int_col1) as udaf1 from t1 | ||
-- !query 5 schema | ||
struct<> | ||
-- !query 5 output | ||
org.apache.spark.sql.AnalysisException | ||
Can not load class 'test.non.existent.udaf' when registering the function 'default.udaf1', please make sure it is on the classpath; line 1 pos 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters