gaborgsomogyi commented on a change in pull request #23791: 
[SPARK-20597][SQL][SS][WIP] KafkaSourceProvider falls back on path as synonym 
for topic
URL: https://github.com/apache/spark/pull/23791#discussion_r260233264
 
 

 ##########
 File path: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceProvider.scala
 ##########
 @@ -194,6 +194,19 @@ private[kafka010] class KafkaSourceProvider extends 
DataSourceRegister
       throw new IllegalArgumentException("Unknown option")
   }
 
+  private def resolveTopic(parameters: Map[String, String]): Option[String] = {
+    val topicOption = parameters.get(TOPIC_OPTION_KEY).map(_.trim)
+    val pathOption = parameters.get(DataSourceOptions.PATH_KEY).map(_.trim)
+
+    (topicOption, pathOption) match {
+      case (Some(t), Some(p)) if t != p => throw new 
IllegalArgumentException("'topic' and 'path'"
+        + " options should match if both defined: '" + t + "' should match '" 
+ p + "'")
+      case (Some(t), _) => Some(t)
+      case (None, Some(p)) => Option(p)
 
 Review comment:
   +1

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to