Skip to content

Commit

Permalink
[Improve] Make ClickhouseFileSinker support tables containing materia…
Browse files Browse the repository at this point in the history
…lized columns (apache#6956)

* [Improvement] Make ClickhouseFileSinker support tables containing materialized columns by ignoring the materialized columns in the CK table when building the temporary table. In this way, when generating the ck part file, the file corresponding to the materialized column will be automatically generated, otherwise an error will be reported when generating the file.

* Make ClickhouseFileSinker support tables containing materialized columns

---------

Co-authored-by: fandonglai <[email protected]>
  • Loading branch information
ddna1021 and fandonglai authored Jun 7, 2024
1 parent 181f01e commit 87c6adc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ public Map<String, String> getClickhouseTableSchema(
Map<String, String> schema = new LinkedHashMap<>();
try (ClickHouseResponse response = request.query(sql).executeAndWait()) {
response.records()
.forEach(r -> schema.put(r.getValue(0).asString(), r.getValue(1).asString()));
.forEach(
r -> {
if (!"MATERIALIZED".equals(r.getValue(2).asString())) {
schema.put(r.getValue(0).asString(), r.getValue(1).asString());
}
});
} catch (ClickHouseException e) {
throw new ClickhouseConnectorException(
CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED,
Expand Down

0 comments on commit 87c6adc

Please sign in to comment.