kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Custenborder (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KAFKA-4855) Struct SchemaBuilder should not allow duplicate fields.
Date Mon, 06 Mar 2017 22:14:33 GMT
Jeremy Custenborder created KAFKA-4855:

             Summary: Struct SchemaBuilder should not allow duplicate fields.
                 Key: KAFKA-4855
                 URL: https://issues.apache.org/jira/browse/KAFKA-4855
             Project: Kafka
          Issue Type: Bug
          Components: KafkaConnect
    Affects Versions:
            Reporter: Jeremy Custenborder

I would expect this to fail at the build() on schema. It actually makes it all the way to
Struct.validate() and throws a cryptic error message. .field() should throw an exception if
a field is already used.

  public void duplicateFields() {
    final Schema schema = SchemaBuilder.struct()
        .field("id", SchemaBuilder.string().doc("").build())
        .field("id", SchemaBuilder.string().doc("").build())
    final Struct struct = new Struct(schema)
        .put("id", "testing");

org.apache.kafka.connect.errors.DataException: Invalid value: null used for required field
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:212)
	at org.apache.kafka.connect.data.Struct.validate(Struct.java:232)
	at io.confluent.kafka.connect.jms.RecordConverterTest.duplicateFieldRepro(RecordConverterTest.java:289)

This message was sent by Atlassian JIRA

View raw message