Class WriteComputeSchemaConverter

  • public class WriteComputeSchemaConverter
    extends java.lang.Object
    This class converts a Avro Schema.Type.RECORD schema to its write compute schema. Note that the input schema must be of type Schema.Type.RECORD. Currently, it supports record partial update, collection merging and deletion See WriteComputeOperation for details. N.B. 1. We should keep WriteComputeOperation backward compatible. That's being said, if you change it, make sure to release SN earlier than Samza/VPJ plugin. 2. We should ask partners to assign a default value or wrap the field with nullable union if they intent to use "partial put" to create new k/v pair (when the key is not existing in the store). 3. nested parsing is not allowed in order to reduce the complexity. Only the top level fields will be converted. Nested Record/Array/Map will remain the same after parsing.
    • Method Detail

      • convertFromValueRecordSchemaStr

        public org.apache.avro.Schema convertFromValueRecordSchemaStr​(java.lang.String valueRecordSchemaStr)
      • convertFromValueRecordSchema

        public org.apache.avro.Schema convertFromValueRecordSchema​(org.apache.avro.Schema valueRecordSchema)
        This method is the only entry point! Convert schema of a store value to its write-compute schema. Note that the value record schema must be of a Record type because write compute only works with Avro Record and each field needs to have a default value.
        valueRecordSchema - schema of store value.
        Generated write-compute schema.
      • convert

        public org.apache.avro.Schema convert​(java.lang.String schemaStr)
      • convert

        public org.apache.avro.Schema convert​(org.apache.avro.Schema schema)
      • getNoOpOperation

        public org.apache.avro.Schema getNoOpOperation​(java.lang.String namespace)