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: [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]

Reply via email to