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