srielau commented on code in PR #58584:
URL: https://github.com/apache/spark/pull/58584#discussion_r3994222572
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala:
##########
@@ -897,6 +953,19 @@ private[hive] trait HiveInspectors {
(value: Any, row: InternalRow, ordinal: Int) => row(ordinal) =
unwrapper(value)
}
+ /**
+ * Builds an in-place unwrapper that also honors target-type-specific
conversions.
+ */
+ def unwrapperFor(
+ field: HiveStructField,
+ dataType: DataType): (Any, InternalRow, Int) => Unit = dataType match {
+ case _: CharType | _: VarcharType =>
+ val unwrapper = unwrapperFor(field.getFieldObjectInspector, dataType)
+ (value: Any, row: InternalRow, ordinal: Int) => row(ordinal) =
unwrapper(value)
+ case _ =>
Review Comment:
Fixed in c77094331c5. The in-place field unwrapper now selects target-aware
recursive conversion whenever the declared type contains CHAR/VARCHAR, while
primitive and unrelated fields retain their specialized setters.
HiveInspectorSuite now exercises this nested field path directly.
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala:
##########
@@ -245,7 +250,7 @@ private[hive] case class HiveGenericUDTF(
private lazy val wrappers = children.map(x => wrapperFor(toInspector(x),
x.dataType)).toArray
@transient
- private lazy val unwrapper = unwrapperFor(outputInspector)
+ private lazy val unwrapper = unwrapperFor(outputInspector, elementSchema)
Review Comment:
Fixed in c77094331c5. HiveGenericUDTF now carries its resolved element
schema as a case-class field and preserves it in withNewChildrenInternal. The
persisted-view test now covers a first-class CHAR UDTF created and executed
under opposite settings.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]