You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/03 03:18:15 UTC
[GitHub] [spark] wangyum commented on a change in pull request #29490: [SPARK-32668][SQL] HiveGenericUDTF initialize UDTF should use StructObjectInspector method
wangyum commented on a change in pull request #29490:
URL: https://github.com/apache/spark/pull/29490#discussion_r550949512
##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2176,8 +2176,7 @@ abstract class SQLQuerySuiteBase extends QueryTest with SQLTestUtils with TestHi
sql(
s"""
|CREATE TEMPORARY FUNCTION udtf_stack2
- |AS 'org.apache.spark.sql.hive.execution.UDTFStack2'
- |USING JAR '${hiveContext.getHiveFile("SPARK-21101-1.0.jar").toURI}'
+ |AS 'org.apache.spark.sql.hive.execution.UDTFStack3'
Review comment:
Just replace this test with:
```scala
test("SPARK-32668: HiveGenericUDTF initialize UDTF should use StructObjectInspector method") {
withUserDefinedFunction("udtf_stack1" -> true, "udtf_stack2" -> true) {
sql(
s"""
|CREATE TEMPORARY FUNCTION udtf_stack1
|AS 'org.apache.spark.sql.hive.execution.UDTFStack'
|USING JAR '${hiveContext.getHiveFile("SPARK-21101-1.0.jar").toURI}'
""".stripMargin)
sql(
s"""
|CREATE TEMPORARY FUNCTION udtf_stack2
|AS 'org.apache.spark.sql.hive.execution.UDTFStack2'
|USING JAR '${hiveContext.getHiveFile("SPARK-21101-1.0.jar").toURI}'
""".stripMargin)
Seq("udtf_stack1", "udtf_stack2").foreach { udf =>
checkAnswer(
sql(s"SELECT $udf(2, 'A', 10, date '2015-01-01', 'B', 20, date '2016-01-01')"),
Seq(Row("A", 10, Date.valueOf("2015-01-01")),
Row("B", 20, Date.valueOf("2016-01-01"))))
}
}
}
```
?
`UDTFStack` and `UDTFStack2 ` are two ways to implement UDTF.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org