Skip to content

Commit

Permalink
fix debezium test
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedabu98 committed Apr 14, 2024
1 parent e770eac commit 3184255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ protected SchemaTransform(ConfigT configuration, String identifier) {

Class<ConfigT> typedClass = (Class<ConfigT>) parameterizedType.getActualTypeArguments()[0];

SchemaRegistry registry = SchemaRegistry.createDefault();
try {
// Get initial row with values
Row row = SchemaRegistry.createDefault().getToRowFunction(typedClass).apply(configuration);
Row row = registry.getToRowFunction(typedClass).apply(configuration);
// Get sorted Schema and recreate the Row
Schema configurationSchema = SchemaRegistry.createDefault().getSchema(typedClass).sorted();
Schema configurationSchema = registry.getSchema(typedClass).sorted();
this.configurationRow =
configurationSchema.getFields().stream()
.map(field -> row.getValue(field.getName()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.beam.sdk.coders.RowCoder;
import org.apache.beam.sdk.schemas.AutoValueSchema;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
import org.apache.beam.sdk.schemas.transforms.SchemaTransform;
import org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider;
import org.apache.beam.sdk.schemas.transforms.TypedSchemaTransformProvider;
Expand Down Expand Up @@ -169,6 +171,7 @@ public PCollectionRowTuple expand(PCollectionRowTuple input) {
return Collections.singletonList("output");
}

@DefaultSchema(AutoValueSchema.class)
@AutoValue
public abstract static class DebeziumReadSchemaTransformConfiguration {
public abstract String getUsername();
Expand Down

0 comments on commit 3184255

Please sign in to comment.