edmondop commented on code in PR #853: URL: https://github.com/apache/datafusion-comet/pull/853#discussion_r1724172367
########## spark/src/main/scala/org/apache/spark/Plugins.scala: ########## @@ -44,6 +45,20 @@ class CometDriverPlugin extends DriverPlugin with Logging with ShimCometDriverPl override def init(sc: SparkContext, pluginContext: PluginContext): ju.Map[String, String] = { logInfo("CometDriverPlugin init") + // register CometSparkSessionExtensions if it isn't already registered + val extensionKey = StaticSQLConf.SPARK_SESSION_EXTENSIONS.key + val extensionClass = classOf[CometSparkSessionExtensions].getName + if (sc.conf.contains(extensionKey)) { + val extensions = sc.conf.get(extensionKey) + if (!extensions.split(",").map(_.trim).contains(extensionClass)) { + sc.conf.set(extensionKey, s"$extensions,$extensionClass") + } else { + sc.conf.set(extensionKey, extensionClass) + } + } else { + sc.conf.set(extensionKey, extensionClass) + } Review Comment: The else clause it's also suspicious, are we sure if there are multiple extensions with the key we want to override everything? I suspect the code doesn't need an else branch in reality -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org