You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/04/02 14:15:31 UTC

[GitHub] [spark] attilapiros commented on a change in pull request #24270: [SPARK-27343][KAFKA][SS]Avoid hadcoded for spark-sql-kafka-0-10

attilapiros commented on a change in pull request #24270: [SPARK-27343][KAFKA][SS]Avoid hadcoded for spark-sql-kafka-0-10
URL: https://github.com/apache/spark/pull/24270#discussion_r271327497
 
 

 ##########
 File path: external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/package.scala
 ##########
 @@ -16,9 +16,58 @@
  */
 package org.apache.spark.sql
 
+import java.util.concurrent.TimeUnit
+
 import org.apache.kafka.common.TopicPartition
 
+import org.apache.spark.internal.config.ConfigBuilder
+
 package object kafka010 {   // scalastyle:ignore
   // ^^ scalastyle:ignore is for ignoring warnings about digits in package name
   type PartitionOffsetMap = Map[TopicPartition, Long]
-}
+
+  private[spark] val PRODUCER_CACHE_TIMEOUT =
+    ConfigBuilder("spark.kafka.producer.cache.timeout")
+      .doc("The time to remove the producer when the producer is not used.")
+      .timeConf(TimeUnit.MILLISECONDS)
+      .createWithDefaultString("600000")
+
+  val CONSUMER_POLL_TIMEOUT =
+    ConfigBuilder("kafkaConsumer.pollTimeoutMs")
+      .doc("The timeout in milliseconds to poll data from Kafka in executors.")
+      .timeConf(TimeUnit.MILLISECONDS)
+      .createWithDefaultString("512")
+
+  val CONSUMER_CACHE_CAPACITY =
+    ConfigBuilder("spark.sql.kafkaConsumerCache.capacity")
+      .doc("The size of LinkedHashMap for caching kafkaConsumers.")
+      .intConf
+      .createWithDefaultString("64")
 
 Review comment:
   Why `createWithDefaultString` is used everywhere? For `intConf` you can specify an `Int` by using `createWithDefault()`, and so on. 
   
   As `createWithDefault` is type-safe it is less error prone.
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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