[ https://issues.apache.org/jira/browse/KAFKA-6684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16458262#comment-16458262 ]
Ewen Cheslack-Postava commented on KAFKA-6684: ---------------------------------------------- The idea here seems quite similar to the SimpleHeaderConverter included with KIP-145. We might want to consider a) standardizing all these casts/transformations across the different mechanisms (Cast transformation and SimpleHeaderConverter) and b) reusing as much code as possible. For (b), we might be able to just check whether something is a logical type and then always delegate to shared code from SimpleHeaderConverter so we get a minimal implementation w/ all the support for different types. > Support casting values with bytes schema to string > --------------------------------------------------- > > Key: KAFKA-6684 > URL: https://issues.apache.org/jira/browse/KAFKA-6684 > Project: Kafka > Issue Type: Improvement > Components: KafkaConnect > Reporter: Amit Sela > Priority: Critical > Fix For: 2.0.0 > > > Casting from BYTES is not supported, which means that casting LogicalTypes is > not supported. > This proposes to allow casting anything to a string, kind of like Java's > {{toString()}}, such that if the object is actually a LogicalType it can be > "serialized" as string instead of bytes+schema. > > {noformat} > Examples: > BigDecimal will cast to the string representation of the number. > Timestamp will cast to the string representation of the timestamp, or maybe > UTC yyyymmddTHH:MM:SS.f format? > {noformat} > > Worst case, bytes are "casted" to whatever the {{toString()}} returns - its > up to the user to know the data. > This would help when using a JSON sink, or anything that's not Avro. -- This message was sent by Atlassian JIRA (v7.6.3#76005)