caicancai commented on code in PR #8296:
URL: https://github.com/apache/seatunnel/pull/8296#discussion_r1886082845
##########
seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/util/ClickhouseProxy.java:
##########
@@ -274,6 +274,58 @@ public ClickhouseTable getClickhouseTable(String database,
String table) {
}
}
+ /**
+ * Get ClickHouse table info for shard node.
+ *
+ * @param request
+ * @param database
+ * @param table
+ * @return
+ */
+ public ClickhouseTable getClickhouseTableForShardNode(
+ ClickHouseRequest<?> request, String database, String table) {
Review Comment:
This depends on the implementation of clickhouse client. ClickhouseRequest
uses http connection and will randomly access a copy of the corresponding node.
This change is similar to the implementation in ClickhouseFileSinkAggCommitter.
```
private void attachFileToClickhouse(Shard shard, List<String>
clickhouseLocalFiles)
throws ClickHouseException {
ClickHouseRequest<?> request =
getProxy().getClickhouseConnection(shard);
for (String clickhouseLocalFile : clickhouseLocalFiles) {
ClickHouseResponse response =
request.query(
String.format(
"ALTER TABLE %s ATTACH PART
'%s'",
clickhouseTable.getLocalTableName(),
clickhouseLocalFile.substring(
clickhouseLocalFile.lastIndexOf("/") + 1)))
.executeAndWait();
response.close();
}
}
```
--
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]