Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Update clickhouse.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RickyHuo committed Nov 28, 2017
1 parent 0d3c728 commit df8beb8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/sina/bip/hangout/outputs/Clickhouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ protected void bulkInsert(Map event) throws Exception {
String value = "(";
for (int j =0; j < fields.size(); j++) {
String field = fields.get(j);
if (this.fieldGetterMap.get(field).getField(e) != null) {
Object fieldValue = this.fieldGetterMap.get(field).getField(e);
if (fieldValue != null) {
if (this.fieldGetterMap.get(field).getField(e) instanceof String) {
String fieldValue = this.fieldGetterMap.get(field).getField(e).toString();
if (!(fieldValue.indexOf("'") > 0)){
value += "'" + this.fieldGetterMap.get(field).getField(e).toString() + "'";
if (!(fieldValue.toString().indexOf("'") > 0)){
value += "'" + fieldValue.toString() + "'";
} else {
value += "''";
}
} else {
value += this.fieldGetterMap.get(field).getField(e).toString();
value += fieldValue;
}
} else {
value += ClickhouseUtils.renderDefault(this.schema.get(ClickhouseUtils.realField(field)));
Expand All @@ -135,7 +135,7 @@ protected void bulkInsert(Map event) throws Exception {

Connection conn = balanced.getConnection();
try {
System.out.println(sqls.toString());
// System.out.println(sqls.toString());
conn.createStatement().execute(sqls.toString());
} catch (SQLException e){
System.out.println(e.toString());
Expand Down

0 comments on commit df8beb8

Please sign in to comment.