For the Kafka scheduler using Avro parser, is ENUM type supported?

For the Kafka scheduler using Avro parser, is ENUM type in Avro schema supported? We tried to add an attribute of enum type in the schema, and try to the messages with Vertica Kafka scheduler. As a result, all columns are populated with correct data, except that the colums related to the enum attributes are NULL. B.T.W. our destination columns are of varchar type.

Comments

  • SruthiASruthiA Vertica Employee Administrator

    Are you using favroparser to parse data?? If so, enums are supported.  can you share me sample avro data and table structure in vertica database?? 

  • I used KafkaAVROParser parser as per the document. Is there favroparser?

     

    The attached indus_sc_smartEvent.avsc is the schema definition.

    The datamart.ddl is the table structure.

    The test_metrics_consumer_input.json is sample data.

     

    I use the following code to transform json data to Avro record.

     

    public static SpecificRecord jsonToAvroObject(String json, Schema schema) {
    InputStream input = null;
    DatumReader<SpecificRecord> reader;
    try {
    reader = new SpecificDatumReader<SpecificRecord>(schema);
    input = new ByteArrayInputStream(json.getBytes());
    DataInputStream din = new DataInputStream(input);
    Decoder decoder = DecoderFactory.get().jsonDecoder(schema, din);
    SpecificRecord datum = null;
    datum = reader.read(null, decoder);
    return datum;
    } catch (Exception e) {
    e.printStackTrace();
    }
    return null;
    }

     

     

     

  • Any idea for this thread? My problem is that when I use Enum type in avro schema, the NULL is inserted in the target table column.

  • SruthiASruthiA Vertica Employee Administrator

    Hi,

     

        Can you open a support case for this issue. It is not an issue which can be answered in one line. I hope you understand

     

    Sruthi

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file