@@ -340,15 +340,7 @@ private[kafka010] class KafkaSourceProvider extends DataSourceRegister
340340 // Validate user-specified Kafka options
341341
342342 if (caseInsensitiveParams.contains(s " kafka. ${ConsumerConfig .GROUP_ID_CONFIG }" )) {
343- logWarning(
344- s " It is not recommended to set Kafka option 'kafka. ${ConsumerConfig .GROUP_ID_CONFIG }'. " +
345- " This option is unsafe to use since multiple concurrent queries or sources using the " +
346- " same group id will interfere with each other as they are part of the same consumer " +
347- " group. Restarted queries may also suffer interference from the previous run having the " +
348- " same group id. The user should have only one query per group id, and/or set " +
349- " 'kafka.session.timeout.ms' to be very small so that the Kafka consumers from the " +
350- " previous query are marked dead by the Kafka group coordinator before the restarted " +
351- " query starts running." )
343+ logWarning(CUSTOM_GROUP_ID_ERROR_MESSAGE )
352344 if (caseInsensitiveParams.contains(GROUP_ID_PREFIX )) {
353345 logWarning(" Option 'groupIdPrefix' will be ignored as " +
354346 s " option 'kafka. ${ConsumerConfig .GROUP_ID_CONFIG }' has been set. " )
@@ -475,7 +467,16 @@ private[kafka010] object KafkaSourceProvider extends Logging {
475467 | source option "failOnDataLoss" to "false".
476468 """ .stripMargin
477469
478-
470+ val CUSTOM_GROUP_ID_ERROR_MESSAGE =
471+ s """ Kafka option 'kafka. ${ConsumerConfig .GROUP_ID_CONFIG }' has been set on this query, it is
472+ | not recommended to set this option. This option is unsafe to use since multiple concurrent
473+ | queries or sources using the same group id will interfere with each other as they are part
474+ | of the same consumer group. Restarted queries may also suffer interference from the
475+ | previous run having the same group id. The user should have only one query per group id,
476+ | and/or set the option 'kafka.session.timeout.ms' to be very small so that the Kafka
477+ | consumers from the previous query are marked dead by the Kafka group coordinator before the
478+ | restarted query starts running.
479+ """ .stripMargin
479480
480481 private val serClassName = classOf [ByteArraySerializer ].getName
481482 private val deserClassName = classOf [ByteArrayDeserializer ].getName
0 commit comments