[ 
https://issues.apache.org/jira/browse/PHOENIX-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17784037#comment-17784037
 ] 

ASF GitHub Bot commented on PHOENIX-7103:
-----------------------------------------

stoty commented on code in PR #111:
URL: 
https://github.com/apache/phoenix-connectors/pull/111#discussion_r1386572430


##########
phoenix5-spark/src/main/scala/org/apache/phoenix/spark/ConfigurationUtil.scala:
##########
@@ -64,12 +64,21 @@ object ConfigurationUtil extends Serializable {
   }
 
   def setZookeeperURL(conf: Configuration, zkUrl: String) = {
-    val info = PhoenixEmbeddedDriver.ConnectionInfo.create(zkUrl)
-    conf.set(HConstants.ZOOKEEPER_QUORUM, info.getZookeeperQuorum)
-    if (info.getPort != null)
-      conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, info.getPort)
-    if (info.getRootNode != null)
-      conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, info.getRootNode)
+    var zk = zkUrl
+    if (zk.startsWith("jdbc:phoenix:")) {
+      zk = zk.substring("jdbc:phoenix:".length)
+    }
+    if (zk.startsWith("jdbc:phoenix+zk:")) {
+      zk = zk.substring("jdbc:phoenix+zk:".length)
+    }
+    val escapedUrl = zk.replaceAll("\\\\:","=")
+    val parts = escapedUrl.split(":")
+    if (parts.length >= 1)
+      conf.set(HConstants.ZOOKEEPER_QUORUM, parts(0).replaceAll("=", "\\\\:"))
+    if (parts.length >= 2)
+      conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, 
Integer.parseInt(parts(1).replaceAll("=", "\\\\:")))

Review Comment:
   You are right, we should check if the string is empty.





> Phoenix-connectors uses the refactored  ConnectionInfo class
> ------------------------------------------------------------
>
>                 Key: PHOENIX-7103
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7103
>             Project: Phoenix
>          Issue Type: Bug
>          Components: connectors, spark-connector
>    Affects Versions: connectors-6.0.0
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>
> Which no longer exists where it is expected.
> While ideally the whole logic should be changed as in the current Java Spark 
> connector, until that is done, we can just avoid ConnectionInfo, and process 
> the quorum with simple String oprtaions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to