Skip to content

Convert org.apache.kafka.connect.data.Date to epoch millis before sending to Elasticsearch #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,11 @@ Schema preProcessSchema(Schema schema) {
switch (schemaName) {
case Decimal.LOGICAL_NAME:
return copySchemaBasics(schema, SchemaBuilder.float64()).build();
case Date.LOGICAL_NAME:
case Time.LOGICAL_NAME:
case Timestamp.LOGICAL_NAME:
return schema;
case Date.LOGICAL_NAME:
return copySchemaBasics(schema, SchemaBuilder.int64()).build();
default:
// User type or unknown logical type
break;
Expand Down Expand Up @@ -408,10 +409,11 @@ private Object preProcessLogicalValue(String schemaName, Object value) {
switch (schemaName) {
case Decimal.LOGICAL_NAME:
return ((BigDecimal) value).doubleValue();
case Date.LOGICAL_NAME:
case Time.LOGICAL_NAME:
case Timestamp.LOGICAL_NAME:
return value;
case Date.LOGICAL_NAME:
return ((java.util.Date) value).getTime();
default:
// User-defined type or unknown built-in
return null;
Expand Down