Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsimsek committed Jun 11, 2024
1 parent a95a120 commit 514864f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private static Map.Entry<Integer, Types.NestedField> debeziumFieldToIcebergField
private static List<Types.NestedField> icebergSchemaFields(JsonNode schemaNode) {
List<Types.NestedField> schemaColumns = new ArrayList<>();
AtomicReference<Integer> fieldId = new AtomicReference<>(1);
if (schemaNode != null && schemaNode.has("fields") && schemaNode.get("fields").isArray()) {
if (schemaNode != null && !schemaNode.isNull() && schemaNode.has("fields") && schemaNode.get("fields").isArray()) {
LOGGER.debug("Converting iceberg schema to debezium:{}", schemaNode);
schemaNode.get("fields").forEach(field -> {
Map.Entry<Integer, Types.NestedField> df = debeziumFieldToIcebergField(field, field.get("field").textValue(), fieldId.get());
Expand Down Expand Up @@ -329,7 +329,7 @@ public int hashCode() {

private Schema icebergSchema() {

if (this.valueSchema == null) {
if (this.valueSchema.isNull()) {
throw new RuntimeException("Failed to get schema from debezium event, event schema is null");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ public IcebergChangeEventBuilder addKeyField(String name, String val) {
public IcebergChangeEvent build() {
return new IcebergChangeEvent(
this.destination,
payload.asText().getBytes(StandardCharsets.UTF_8),
keyPayload.asText().getBytes(StandardCharsets.UTF_8)
("{" +
"\"schema\":" + this.valueSchema() + "," +
"\"payload\":" + payload.toString() +
"} ").getBytes(StandardCharsets.UTF_8),
("{" +
"\"schema\":" + this.keySchema() + "," +
"\"payload\":" + keyPayload.toString() +
"} ").getBytes(StandardCharsets.UTF_8)
);
}

Expand Down

0 comments on commit 514864f

Please sign in to comment.