mdedetrich commented on code in PR #146:
URL:
https://github.com/apache/incubator-pekko-connectors/pull/146#discussion_r1224121669
##########
json-streaming/src/main/scala/org/apache/pekko/stream/connectors/json/impl/JsonStreamReader.scala:
##########
@@ -42,14 +42,16 @@ private[pekko] final class JsonStreamReader(path: JsonPath)
extends GraphStage[F
private val out = shape.out
setHandlers(in, out, this)
- private val buffer = Queue.empty[ByteString]
+ private var buffer = Queue.empty[ByteString]
private val surfer = JsonSurferJackson.INSTANCE
private val config = surfer.configBuilder
.bind(path,
new JsonPathListener {
- override def onValue(value: Any, context: ParsingContext): Unit =
- buffer.enqueue(ByteString(value.toString))
+ override def onValue(value: Any, context: ParsingContext): Unit = {
+ // a strange Scala 3 compiler issue means
buffer.enqueue(ByteString(value.toString)) does not compile
+ buffer = buffer.enqueueAll(Seq(ByteString(value.toString)))
Review Comment:
I just had a look `Iterable.single` exists, its faster than `Seq` and can be
passed into `buffer.enqueueAll` so
`Iterable.single(Iterable.single(ByteString(value.toString)))` .
Can you try this? If it works then this should be better, otherwise let me
know and I can just approve as is.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]