Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/20979#discussion_r182730393
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
---
@@ -1009,8 +1009,39 @@ case class CatalystToExternalMap private(
override def children: Seq[Expression] =
keyLambdaFunction :: valueLambdaFunction :: inputData :: Nil
- override def eval(input: InternalRow): Any =
- throw new UnsupportedOperationException("Only code-generated
evaluation is supported")
+ private lazy val inputMapType = inputData.dataType.asInstanceOf[MapType]
+
+ private lazy val keyConverter =
+ CatalystTypeConverters.createToScalaConverter(inputMapType.keyType)
+ private lazy val valueConverter =
+ CatalystTypeConverters.createToScalaConverter(inputMapType.valueType)
+
+ private def newMapBuilder(): Builder[AnyRef, AnyRef] = {
--- End diff --
Can you make sure the builder only get's resolved once per expression
instead of once per row. Can you address this in a follow-up?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]