andygrove commented on code in PR #853:
URL: https://github.com/apache/datafusion-comet/pull/853#discussion_r1725109058


##########
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:
   Thanks for the review @edmondop. You are correct that the original code was 
not correct. I have added a unit test and fixed the issue. It is close to your 
suggestion.



-- 
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

Reply via email to