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


##########
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:
   `parts(1).replaceAll("=", "\\\\:"))` should be a number, and I am not sure 
if it will be
   if the zk Url is something like: 
`jdbc:phoenix+zk:zk1-1\\:2181,zk1-2\\:2181::/hbase`
   
   escapedUrl will be like: zk1-1=2181,zk1-2=2181 : : /hbase
   So the ports are in the part(0)
   Is the zkUrl different than I think?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to