HeartSaVioR commented on code in PR #45341: URL: https://github.com/apache/spark/pull/45341#discussion_r1520713399
########## sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MapStateImpl.scala: ########## @@ -73,24 +74,31 @@ class MapStateImpl[K, V]( } /** Get the map associated with grouping key */ - override def getMap(): Map[K, V] = { + override def getMap(): Iterator[(K, V)] = { val encodedGroupingKey = stateTypesEncoder.encodeGroupingKey() - store.prefixScan(encodedGroupingKey, stateName) - .map { - case iter: UnsafeRowPair => - (stateTypesEncoder.decodeCompositeKey(iter.key), - stateTypesEncoder.decodeValue(iter.value)) - }.toMap + val pairsIterator = store.prefixScan(encodedGroupingKey, stateName) + + new Iterator[(K, V)] { Review Comment: It's OK to defer the change of method name in follow up PR if we want to have a time to figure out the best name. The first one is something good to do this before merging the code. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org