Skip to content

Commit

Permalink
fix(elasticsearch-sink): convert Time/Timestamp/Timestamptz type in…
Browse files Browse the repository at this point in the history
…to string (#13619)
  • Loading branch information
xuefengze authored Nov 24, 2023
1 parent 90ce699 commit 93ec8d3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ private Map<String, Object> buildDoc(SinkRow row)
Object col = row.get(i);
switch (type) {
case DATE:
case TIME:
case TIMESTAMP:
case TIMESTAMPTZ:
// es client doesn't natively support java.sql.Timestamp/Time/Date
// so we need to convert Date type into a string as suggested in
// so we need to convert Date/Time/Timestamp type into a string as suggested in
// https://github.com/elastic/elasticsearch/issues/31377#issuecomment-398102292
col = col.toString();
break;
Expand All @@ -214,7 +217,6 @@ private Map<String, Object> buildDoc(SinkRow row)
default:
break;
}
if (col instanceof Date) {}

doc.put(getTableSchema().getColumnDesc(i).getName(), col);
}
Expand Down

0 comments on commit 93ec8d3

Please sign in to comment.