From 611338b059f9ee07d13d22c44fb8be959dec76ff Mon Sep 17 00:00:00 2001 From: Shraddha Patel Date: Wed, 13 Sep 2023 18:01:52 +1000 Subject: [PATCH] clean up and release alpha --- build.gradle.kts | 2 +- .../RedShiftComplexDataTypeTransformer.kt | 28 ------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5d204be..8b44297 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ plugins { } // Package version -version = "0.6.1-alpha" +version = "0.7.0-alpha" repositories { // Use Maven Central for resolving dependencies. diff --git a/src/main/kotlin/com/cultureamp/kafka/connect/plugins/transforms/RedShiftComplexDataTypeTransformer.kt b/src/main/kotlin/com/cultureamp/kafka/connect/plugins/transforms/RedShiftComplexDataTypeTransformer.kt index b5e8c2f..08f65e6 100644 --- a/src/main/kotlin/com/cultureamp/kafka/connect/plugins/transforms/RedShiftComplexDataTypeTransformer.kt +++ b/src/main/kotlin/com/cultureamp/kafka/connect/plugins/transforms/RedShiftComplexDataTypeTransformer.kt @@ -5,7 +5,6 @@ import org.apache.kafka.common.cache.LRUCache import org.apache.kafka.common.cache.SynchronizedCache import org.apache.kafka.common.config.ConfigDef import org.apache.kafka.connect.connector.ConnectRecord -import org.apache.kafka.connect.data.Field import org.apache.kafka.connect.data.Schema import org.apache.kafka.connect.data.SchemaBuilder import org.apache.kafka.connect.data.Struct @@ -64,13 +63,6 @@ class RedShiftComplexDataTypeTransformer> : Transformation< ) } - private fun updateSchema(field: Field): Schema { - if (field.schema().type() == Schema.Type.ARRAY || field.schema().type() == Schema.Type.MAP) { - return SchemaBuilder.string().build() - } - return field.schema() - } - private fun fieldName(prefix: String, fieldName: String): String { if (prefix.isEmpty()) { return fieldName @@ -182,26 +174,6 @@ class RedShiftComplexDataTypeTransformer> : Transformation< buildWithSchema(sourceValue, "", updatedValue) return newRecord(record, updatedSchema, updatedValue) } - - /*val builder = SchemaUtil.copySchemaBasics(sourceSchema, SchemaBuilder.struct()) - for (field in sourceSchema.fields()) { - builder.field(field.name(), updateSchema(field)) - } - val newSchema = builder.build() - val targetPayload = Struct(newSchema) - for (field in newSchema.fields()) { - val fieldVal = sourceValue.get(field.name()) - val fieldSchema = sourceSchema.field(field.name()).schema() - if (field.schema().type() == fieldSchema.type()) { - targetPayload.put(field.name(), fieldVal) - } else { - //val converted = jsonConverter.fromConnectData("", fieldSchema, fieldVal) - //var fieldString = objectMapper.readTree(converted).toString() - val fieldString = convertToString(fieldSchema, fieldVal) - targetPayload.put(field.name(), fieldString) - } - } - return newRecord(record, targetPayload.schema(), targetPayload)*/ } private val objectMapper = ObjectMapper()