BenJFan commented on a change in pull request #1369:
URL:
https://github.com/apache/incubator-seatunnel/pull/1369#discussion_r819202361
##########
File path:
seatunnel-connectors/seatunnel-connector-spark-clickhouse/src/main/scala/org/apache/seatunnel/spark/sink/Clickhouse.scala
##########
@@ -131,12 +198,77 @@ class Clickhouse extends SparkBatchSink {
schema
}
+ private def getClusterShardList(conn: ClickHouseConnectionImpl, clusterName:
String,
+ database: String, port: String):
ListBuffer[Shard] = {
+ val rs = conn.createStatement().executeQuery(
+ s"select shard_num,shard_weight,replica_num,host_name,host_address," +
+ s"port from system.clusters where cluster = '$clusterName'")
+ // TODO The port will be used for data communication of the tcp protocol
in the future
+ // port is tcp protocol, need http protocol port at now
+ val nodeList = mutable.ListBuffer[Shard]()
+ while (rs.next()) {
+ nodeList += new Shard(rs.getInt(1), rs.getInt(2),
+ rs.getInt(3), rs.getString(4), rs.getString(5),
+ port, database)
Review comment:
Use field is ok, but use offset could be faster.
--
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]