Skip to main content
Package com.gpudb

Class RecordObject

All Implemented Interfaces:
Record, org.apache.avro.generic.GenericContainer, org.apache.avro.generic.IndexedRecord

public abstract class RecordObject extends RecordBase
Abstract base class for objects that contain Record data with a schema defined at compile time. Derived classes should correspond to a GPUdb type and contain public fields, annotated with RecordObject.Column, that correspond to columns in that type. The RecordObject.Type annotation may also be applied to derived classes to provide additional information about the type.
  • Constructor Details

    • RecordObject

      protected RecordObject()
      Creates a new record object instance.
  • Method Details

    • getType

      public static Type getType(Class<? extends RecordObject> type)
      Gets the RecordObject.Type object corresponding to the metadata in the specified RecordObject class.
      Parameters:
      type - the RecordObject class from which to obtain metadata
      Returns:
      the corresponding RecordObject.Type object
    • getSchema

      public static org.apache.avro.Schema getSchema(Class<? extends RecordObject> type)
      Gets the Avro record schema corresponding to the metadata in the specified RecordObject class.
      Parameters:
      type - the RecordObject class from which to obtain metadata
      Returns:
      the corresponding Avro record schema
    • createType

      public static String createType(Class<? extends RecordObject> type, GPUdb gpudb) throws GPUdbException
      Creates a type in GPUdb based on the metadata in the specified RecordObject class and returns the type ID for reference. If an identical type already exists in GPUdb, the type ID of the existing type will be returned and no new type will be created. The specified class will also automatically be added as a known type in the specified GPUdb instance.
      Parameters:
      type - the RecordObject class from which to obtain metadata
      gpudb - the GPUdb instance in which to create the type
      Returns:
      the type ID of the type in GPUdb
      Throws:
      GPUdbException - if an error occurs while creating the type
    • getType

      public Type getType()
      Description copied from interface: Record
      Returns the GPUdb Type of the record.
      Returns:
      the GPUdb type
    • get

      public Object get(int index)
      Description copied from interface: Record
      Returns the value of the specified field.
      Parameters:
      index - the index of the field
      Returns:
      the value of the field
    • put

      public void put(int index, Object value)
      Description copied from interface: Record
      Sets the value of the specified field.
      Parameters:
      index - the index of the field
      value - the new value