eejbyfeldt commented on a change in pull request #32783:
URL: https://github.com/apache/spark/pull/32783#discussion_r647149051
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -1181,21 +1176,25 @@ case class CatalystToExternalMap private(
newMapBuilderMethod.invoke(moduleField).asInstanceOf[Builder[AnyRef,
AnyRef]]
}
+ private def keyValueIterator(md: MapData): Iterator[AnyRef] = {
+ val keyArray = md.keyArray()
+ val valueArray = md.valueArray()
+ val row = new GenericInternalRow(1)
+ 0.until(md.numElements()).iterator.map { i =>
+ row.update(0, keyArray.get(i, inputMapType.keyType))
+ val key = keyLambdaFunction.eval(row)
+ row.update(0, valueArray.get(i, inputMapType.valueType))
+ val value = valueLambdaFunction.eval(row)
+ Tuple2(key, value)
+ }
+ }
+
override def eval(input: InternalRow): Any = {
val result = inputData.eval(input).asInstanceOf[MapData]
if (result != null) {
val builder = newMapBuilder()
builder.sizeHint(result.numElements())
- val keyArray = result.keyArray()
- val valueArray = result.valueArray()
- var i = 0
- while (i < result.numElements()) {
Review comment:
I guess I am not sure whether it does or not. But I updated the PR to
use a while instead, to be sure. Now the style is also more similar to what was
there before.
--
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]