Class HiveAvroTypeBlockHandler

java.lang.Object
io.trino.hive.formats.avro.HiveAvroTypeBlockHandler
All Implemented Interfaces:
AvroTypeBlockHandler

public class HiveAvroTypeBlockHandler extends Object implements AvroTypeBlockHandler
  • Constructor Details

    • HiveAvroTypeBlockHandler

      public HiveAvroTypeBlockHandler(TimestampType hiveSessionTimestamp)
  • Method Details

    • configure

      public void configure(Map<String,byte[]> fileMetadata)
      Description copied from interface: AvroTypeBlockHandler
      Called when the type manager is reading out data from a data file such as in AvroFileReader This usage implies interior immutability of the block handler. The avro library (and our usage of it) requires the block handler to be defined when opening up a file. However, Hive uses the metadata from the file to define behavior of the block handler. Instead of writing our own version of the Avro file reader, interior mutability is allowed. This will be called once before any data of the file is read, but after the Trino types are defined for the read schema. It will be called once per file.
      Specified by:
      configure in interface AvroTypeBlockHandler
      Parameters:
      fileMetadata - metadata from the file header
    • typeFor

      public Type typeFor(org.apache.avro.Schema schema) throws AvroTypeException
      Description copied from interface: AvroTypeBlockHandler
      Returns the block type to build for this Avro schema.
      Specified by:
      typeFor in interface AvroTypeBlockHandler
      Throws:
      AvroTypeException - in case there is no Type for or misconfiguration with the given schema
    • blockBuildingDecoderFor

      public BlockBuildingDecoder blockBuildingDecoderFor(AvroReadAction readAction) throws AvroTypeException
      Specified by:
      blockBuildingDecoderFor in interface AvroTypeBlockHandler
      Throws:
      AvroTypeException