@@ -28,7 +28,7 @@ import org.apache.hadoop.fs.Path
2828import org .apache .spark .TestUtils
2929import org .apache .spark .sql ._
3030import org .apache .spark .sql .catalyst .TableIdentifier
31- import org .apache .spark .sql .catalyst .analysis .{EliminateSubqueryAliases , FunctionRegistry , NoSuchPartitionException }
31+ import org .apache .spark .sql .catalyst .analysis .{EliminateSubqueryAliases , FunctionRegistry }
3232import org .apache .spark .sql .catalyst .catalog .{CatalogRelation , CatalogTableType , CatalogUtils }
3333import org .apache .spark .sql .catalyst .parser .ParseException
3434import org .apache .spark .sql .catalyst .plans .logical .{LogicalPlan , SubqueryAlias }
@@ -98,46 +98,6 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
9898 checkAnswer(query1, Row (" x1_y1" ) :: Row (" x2_y2" ) :: Nil )
9999 }
100100
101- test(" UDTF" ) {
102- withUserDefinedFunction(" udtf_count2" -> true ) {
103- sql(s " ADD JAR ${hiveContext.getHiveFile(" TestUDTF.jar" ).getCanonicalPath()}" )
104- // The function source code can be found at:
105- // https://cwiki.apache.org/confluence/display/Hive/DeveloperGuide+UDTF
106- sql(
107- """
108- |CREATE TEMPORARY FUNCTION udtf_count2
109- |AS 'org.apache.spark.sql.hive.execution.GenericUDTFCount2'
110- """ .stripMargin)
111-
112- checkAnswer(
113- sql(" SELECT key, cc FROM src LATERAL VIEW udtf_count2(value) dd AS cc" ),
114- Row (97 , 500 ) :: Row (97 , 500 ) :: Nil )
115-
116- checkAnswer(
117- sql(" SELECT udtf_count2(a) FROM (SELECT 1 AS a FROM src LIMIT 3) t" ),
118- Row (3 ) :: Row (3 ) :: Nil )
119- }
120- }
121-
122- test(" permanent UDTF" ) {
123- withUserDefinedFunction(" udtf_count_temp" -> false ) {
124- sql(
125- s """
126- |CREATE FUNCTION udtf_count_temp
127- |AS 'org.apache.spark.sql.hive.execution.GenericUDTFCount2'
128- |USING JAR ' ${hiveContext.getHiveFile(" TestUDTF.jar" ).toURI}'
129- """ .stripMargin)
130-
131- checkAnswer(
132- sql(" SELECT key, cc FROM src LATERAL VIEW udtf_count_temp(value) dd AS cc" ),
133- Row (97 , 500 ) :: Row (97 , 500 ) :: Nil )
134-
135- checkAnswer(
136- sql(" SELECT udtf_count_temp(a) FROM (SELECT 1 AS a FROM src LIMIT 3) t" ),
137- Row (3 ) :: Row (3 ) :: Nil )
138- }
139- }
140-
141101 test(" SPARK-6835: udtf in lateral view" ) {
142102 val df = Seq ((1 , 1 )).toDF(" c1" , " c2" )
143103 df.createOrReplaceTempView(" table1" )
0 commit comments