Skip to content

Commit

Permalink
[Improve][Connector-V2][Clickhouse] Improve performance (#3910)
Browse files Browse the repository at this point in the history
  • Loading branch information
TyrantLucifer authored Jan 11, 2023
1 parent 74fd886 commit aeceb85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion seatunnel-connectors-v2/connector-clickhouse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<artifactId>connector-clickhouse</artifactId>
<properties>
<clickhouse.version>0.3.2-patch9</clickhouse.version>
<clickhouse.version>0.3.2-patch11</clickhouse.version>
<sshd.scp.version>2.7.0</sshd.scp.version>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@

public class StringInjectFunction implements ClickhouseFieldInjectFunction {

private static final ObjectMapper MAPPER = new ObjectMapper();
private String fieldType;

@Override
public void injectFields(PreparedStatement statement, int index, Object value) throws SQLException {
ObjectMapper mapper = new ObjectMapper();
try {
if ("Point".equals(fieldType)) {
statement.setObject(index, mapper.readValue(replace(value.toString()), double[].class));
statement.setObject(index, MAPPER.readValue(replace(value.toString()), double[].class));
} else if ("Ring".equals(fieldType)) {
statement.setObject(index, mapper.readValue(replace(value.toString()), double[][].class));
statement.setObject(index, MAPPER.readValue(replace(value.toString()), double[][].class));
} else if ("Polygon".equals(fieldType)) {
statement.setObject(index, mapper.readValue(replace(value.toString()), double[][][].class));
statement.setObject(index, MAPPER.readValue(replace(value.toString()), double[][][].class));
} else if ("MultiPolygon".equals(fieldType)) {
statement.setObject(index, mapper.readValue(replace(value.toString()), double[][][][].class));
statement.setObject(index, MAPPER.readValue(replace(value.toString()), double[][][][].class));
} else {
statement.setString(index, value.toString());
}
Expand Down

0 comments on commit aeceb85

Please sign in to comment.