Skip to content

Commit

Permalink
clean up and release alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
shraddha-ca committed Sep 13, 2023
1 parent 6f32ff7 commit 611338b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {
}

// Package version
version = "0.6.1-alpha"
version = "0.7.0-alpha"

repositories {
// Use Maven Central for resolving dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,13 +63,6 @@ class RedShiftComplexDataTypeTransformer<R : ConnectRecord<R>> : 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
Expand Down Expand Up @@ -182,26 +174,6 @@ class RedShiftComplexDataTypeTransformer<R : ConnectRecord<R>> : 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()
Expand Down

0 comments on commit 611338b

Please sign in to comment.