You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HeartSaVioR (via GitHub)" <gi...@apache.org> on 2023/06/13 22:17:33 UTC

[GitHub] [spark] HeartSaVioR commented on a diff in pull request #41525: [SPARK-44012][SS]KafkaDataConsumer to print some read status

HeartSaVioR commented on code in PR #41525:
URL: https://github.com/apache/spark/pull/41525#discussion_r1228758459


##########
connector/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/consumer/KafkaDataConsumer.scala:
##########
@@ -548,7 +572,10 @@ private[kafka010] class KafkaDataConsumer(
       fetchedData: FetchedData,
       offset: Long,
       pollTimeoutMs: Long): Unit = {
-    val (records, offsetAfterPoll, range) = consumer.fetch(offset, pollTimeoutMs)
+    val (records, offsetAfterPoll, range) = timeNanos {
+      consumer.fetch(offset, pollTimeoutMs)
+    }
+    numPolls += 1

Review Comment:
   I'd say we need to count the number of records here because we are focusing on the interaction with Kafka, which effectiveness of the cache on fetched data should not contribute.



##########
connector/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/consumer/KafkaDataConsumer.scala:
##########
@@ -569,7 +596,13 @@ private[kafka010] class KafkaDataConsumer(
   }
 
   private def retrieveConsumer(): Unit = {
-    _consumer = Option(consumerPool.borrowObject(cacheKey, kafkaParams))
+    _consumer = timeNanos {
+      Option(consumerPool.borrowObject(cacheKey, kafkaParams))
+    }
+    startTimestampNano = System.nanoTime()
+    totalTimeReadNanos = 0
+    totalRecordsRead = 0

Review Comment:
   nit: also add numPolls = 0, for consistency?



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org