Class AvroGenericRecordToRowDataMapper

java.lang.Object
org.apache.iceberg.flink.sink.AvroGenericRecordToRowDataMapper
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.functions.MapFunction<org.apache.avro.generic.GenericRecord,org.apache.flink.table.data.RowData>

public class AvroGenericRecordToRowDataMapper extends Object implements org.apache.flink.api.common.functions.MapFunction<org.apache.avro.generic.GenericRecord,org.apache.flink.table.data.RowData>
This util class converts Avro GenericRecord to Flink RowData.

Internally it uses Flink AvroToRowDataConverters. Because of the precision difference between how Iceberg schema (micro) and Flink AvroToRowDataConverters (milli) deal with time type, we can't directly use the Avro Schema converted from Iceberg schema via AvroSchemaUtil.convert(org.apache.iceberg.Schema, String).
See Also:
  • Method Details

    • map

      public org.apache.flink.table.data.RowData map(org.apache.avro.generic.GenericRecord genericRecord) throws Exception
      Specified by:
      map in interface org.apache.flink.api.common.functions.MapFunction<org.apache.avro.generic.GenericRecord,org.apache.flink.table.data.RowData>
      Throws:
      Exception
    • forAvroSchema

      public static AvroGenericRecordToRowDataMapper forAvroSchema(org.apache.avro.Schema avroSchema)
      Create a mapper based on Avro schema.