Commit c0309793 by y1sa

修复已知问题

parent 4ffd7dd5
package com.tbyf.cdcengine2.core;
public interface ChangeListener {
default boolean supportsSchema(String schema) {
return true;
}
default boolean supportsTable(String table) {
return true;
}
default boolean supports(String schema, String table) {
return supportsSchema(schema) && supportsTable(table);
}
void onChange(ChangedRecord record);
}
...@@ -69,7 +69,7 @@ public class DefaultChangeEventAdapter implements ChangeEventAdapter { ...@@ -69,7 +69,7 @@ public class DefaultChangeEventAdapter implements ChangeEventAdapter {
if (field.schema().type() == Schema.Type.STRUCT) { if (field.schema().type() == Schema.Type.STRUCT) {
Struct structValue = (Struct) value; Struct structValue = (Struct) value;
// 处理小数类型 // 处理小数类型
if (field.schema().name().equals(VariableScaleDecimal.class.getName())) { if (VariableScaleDecimal.class.getName().equals(field.schema().name())) {
value = new BigDecimal(new BigInteger(structValue.getBytes(VariableScaleDecimal.VALUE_FIELD)), value = new BigDecimal(new BigInteger(structValue.getBytes(VariableScaleDecimal.VALUE_FIELD)),
structValue.getInt32(VariableScaleDecimal.SCALE_FIELD)); structValue.getInt32(VariableScaleDecimal.SCALE_FIELD));
} }
...@@ -77,7 +77,7 @@ public class DefaultChangeEventAdapter implements ChangeEventAdapter { ...@@ -77,7 +77,7 @@ public class DefaultChangeEventAdapter implements ChangeEventAdapter {
if (field.schema().type() == Schema.Type.INT64) { if (field.schema().type() == Schema.Type.INT64) {
Long longValue = (Long) value; Long longValue = (Long) value;
// 处理时间类型 // 处理时间类型
if (field.schema().name().equals(Timestamp.class.getName())) { if (Timestamp.class.getName().equals(field.schema().name())) {
value = LocalDateTime.ofInstant(Instant.ofEpochMilli(longValue), ZoneOffset.UTC); value = LocalDateTime.ofInstant(Instant.ofEpochMilli(longValue), ZoneOffset.UTC);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment