Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19797#discussion_r152719853
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -799,9 +799,11 @@ case class Cast(child: Expression, dataType: DataType,
timeZoneId: Option[String
private[this] def castToByteCode(from: DataType, ctx: CodegenContext):
CastFunction = from match {
case StringType =>
- val wrapper = ctx.freshName("wrapper")
- ctx.addMutableState("UTF8String.IntWrapper", wrapper,
- s"$wrapper = new UTF8String.IntWrapper();")
+ val wrapper = "intWrapper"
--- End diff --
Do you worry about name collision among different methods? Since the
lifetime of this object is very short, I intentionally use the same name for
the same type (`IntWrapper` or `LongWrapper`) to reuse the object.
We could use different names among different methods.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]