HeartSaVioR commented on a change in pull request #26173: [SPARK-29503][SQL] 
Copy result row from RowWriter in GenerateUnsafeProjection when the expression 
is lambdaFunction in MapObject
URL: https://github.com/apache/spark/pull/26173#discussion_r337260348
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
 ##########
 @@ -885,13 +887,15 @@ case class MapObjects private(
         )
     }
 
-    // Make a copy of the data if it's unsafe-backed
-    def makeCopyIfInstanceOf(clazz: Class[_ <: Any], value: String) =
-      s"$value instanceof ${clazz.getSimpleName}? ${value}.copy() : $value"
+    // Make a copy of the unsafe data if the result contains any
+    def makeCopyUnsafeData(dataType: DataType, value: String) = {
+      s"""${value}.copyUnsafeData("${dataType.catalogString}")"""
 
 Review comment:
   I guess it depends on how long would we classify as very long string. JSON 
is much easier to possibly create very long string, catalog string would create 
less. I agree the approach is questionable, but even getting a value from field 
requires schema for InternalRow so I'm not sure there's alternative approach 
for this.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to