Skip to content
Merged
Show file tree
Hide file tree
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 @@ -55,8 +55,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return "null";
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "string", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue()));
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue().getValue()));
return null;
});
codecRegistry.registerFromTapValue(TapTimeValue.class, "string", tapTimeValue -> formatTapDateTime(tapTimeValue.getValue(), "HH:mm:ss.SS"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return "null";
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "STRING", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue()));
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue().getValue()));
return null;
});
codecRegistry.registerFromTapValue(TapTimeValue.class, "STRING", tapTimeValue -> formatTapDateTime(tapTimeValue.getValue(), "HH:mm:ss.SS"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
});
codecRegistry.registerFromTapValue(TapYearValue.class, "FixedString(4)", TapValue::getOriginValue);
codecRegistry.registerFromTapValue(TapBinaryValue.class, "String", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue()));
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue().getValue()));
return null;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec

codecRegistry.registerFromTapValue(TapTimeValue.class, tapTimeValue -> formatTapDateTime(tapTimeValue.getValue(), "HH:mm:ss.SS"));
codecRegistry.registerFromTapValue(TapBinaryValue.class, "String", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue()));
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue().getValue()));
return null;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return 0;
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "text", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return toJson(tapValue.getValue());
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return toJson(tapValue.getValue().getValue());
return "null";
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
.registerFromTapValue(TapMapValue.class, "string", this::registerString)
.registerFromTapValue(TapArrayValue.class, "string", this::registerString)
.registerFromTapValue(TapBinaryValue.class, "string", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue()));
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return new String(Base64.encodeBase64(tapValue.getValue().getValue()));
return null;
}).registerFromTapValue(TapDateTimeValue.class, "timestamp", tapValue -> {
if (tapValue != null && tapValue.getValue() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
});
codecRegistry.registerToTapValue(Binary.class, (value, tapType) -> {
Binary binary = (Binary) value;
return new TapBinaryValue(binary.getData());
ByteData byteData = new ByteData(binary.getType(), binary.getData());
return new TapBinaryValue(byteData);
});

codecRegistry.registerToTapValue(Code.class, (value, tapType) -> {
Expand All @@ -518,7 +519,9 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
codecRegistry.registerFromTapValue(TapDateTimeValue.class, "DATE_TIME", tapDateTimeValue -> tapDateTimeValue.getValue().toDate());
codecRegistry.registerFromTapValue(TapDateValue.class, "DATE_TIME", tapDateValue -> tapDateValue.getValue().toDate());
codecRegistry.registerFromTapValue(TapYearValue.class, "STRING(4)", TapValue::getOriginValue);

codecRegistry.registerFromTapValue(TapBinaryValue.class,"BINARY",tapBinaryValue -> {
return new Binary(tapBinaryValue.getValue().getType(), tapBinaryValue.getValue().getValue());
});
//Handle ObjectId when the source is also mongodb, we convert ObjectId to String before enter incremental engine.
//We need check the TapStringValue, when will write to mongodb, if the originValue is ObjectId, then use originValue instead of the converted String value.
codecRegistry.registerFromTapValue(TapStringValue.class, tapValue -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return 0;
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "text", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return toJson(tapValue.getValue());
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return toJson(tapValue.getValue().getValue());
return "null";
});
//TapTimeValue, TapDateTimeValue and TapDateValue's value is DateTime, need convert into Date object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return 0;
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "text", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return toJson(tapValue.getValue());
return "null";
});
Expand Down Expand Up @@ -515,4 +515,4 @@ protected void dropTable(TapConnectorContext tapConnectorContext, TapDropTableEv
protected void getTableNames(TapConnectionContext tapConnectionContext, int batchSize, Consumer<List<String>> listConsumer) {
selectDbJdbcContext.queryAllTables(TapSimplify.list(), batchSize, listConsumer);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return 0;
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "text", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return "binary";//toJson(tapValue.getValue());
return "null";
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
return 0;
});
codecRegistry.registerFromTapValue(TapBinaryValue.class, "text", tapValue -> {
if (tapValue != null && tapValue.getValue() != null)
return toJson(tapValue.getValue());
if (tapValue != null && tapValue.getValue() != null && tapValue.getValue().getValue() != null)
return toJson(tapValue.getValue().getValue());
return "null";
});
codecRegistry.registerFromTapValue(TapTimeValue.class, "datetime", tapValue -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void registerCapabilities(ConnectorFunctions connectorFunctions, TapCodec
});

codecRegistry.registerFromTapValue(TapBinaryValue.class, "CLOB", tapMapValue -> {
if (tapMapValue != null && tapMapValue.getValue() != null) return toJson(tapMapValue.getValue());
if (tapMapValue != null && tapMapValue.getValue() != null && tapMapValue.getValue().getValue() != null) return toJson(tapMapValue.getValue().getValue());
return "null";
});

Expand Down
Loading