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

Commit

Permalink
add replace_include and replace_exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
RickyHuo committed Dec 8, 2017
1 parent 348d54a commit bb30049
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/sina/bip/hangout/outputs/Clickhouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void prepare() {

if (this.config.containsKey("replace_include_fields") && this.config.containsKey("replace_exclude_fields")) {
System.out.println("Replace_include_fields and replace_exclude_fields exist at the same time," +
" please use one of them");
" please use one of them.");
System.exit(1);
}

Expand Down Expand Up @@ -136,7 +136,7 @@ protected StringBuilder makeUpSql(List<Map> events) {
String fieldValue = e.get(field).toString();
if ((this.replace_include_fields != null && this.replace_include_fields.contains(field)) ||
(this.replace_exclude_fields != null && !this.replace_exclude_fields.contains(field))) {
dealWithQuote(fieldValue);
value += "'" + dealWithQuote(fieldValue) + "'";
} else {
value += "'" + fieldValue + "'";
}
Expand Down Expand Up @@ -171,6 +171,7 @@ protected void bulkInsert(Map event) throws Exception{
Connection conn = balanced.getConnection();
try {
conn.createStatement().execute(sqls.toString());
conn.close();
} catch (SQLException e){
System.out.println(sqls.toString());
System.out.println(e.toString());
Expand Down

0 comments on commit bb30049

Please sign in to comment.