wangyum commented on a change in pull request #30665:
URL: https://github.com/apache/spark/pull/30665#discussion_r539309795



##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala
##########
@@ -212,7 +213,19 @@ private[hive] case class HiveGenericUDTF(
   protected lazy val inputInspectors = children.map(toInspector)
 
   @transient
-  protected lazy val outputInspector = 
function.initialize(inputInspectors.toArray)
+  protected lazy val inpuColNames = children.map(_ => "field_name").asJava
+
+  @transient
+  protected lazy val rowOI = 
ObjectInspectorFactory.getStandardStructObjectInspector(
+    inpuColNames, inputInspectors.asJava)
+
+  @transient
+  protected lazy val outputInspector =
+    if (deprecated) {
+      function.initialize(inputInspectors.toArray)
+    } else {
+      function.initialize(rowOI)
+    }

Review comment:
       How about?
   ```scala
   protected lazy val outputInspector = {
     if (isDeprecatedConstructor) {
       function.initialize(inputInspectors.toArray)
     } else {
       val rowOI = ObjectInspectorFactory.getStandardStructObjectInspector(
         children.zipWithIndex.map(e => s"_col${e._2}").asJava, 
inputInspectors.asJava)
       function.initialize(rowOI)
     }
   }
   ```




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to