Interface RecordData

  • All Known Implementing Classes:
    BinaryRecordData, GenericRecordData

    @PublicEvolving
    public interface RecordData
    Class RecordData describes the data of changed record (i.e. row) in the external system.

    The mappings from external SQL data types to the internal data structures are listed in the following table:

     +--------------------------------+-----------------------------------------+
     | SQL Data Types                 | Internal Data Structures                |
     +--------------------------------+-----------------------------------------+
     | BOOLEAN                        | boolean                                 |
     +--------------------------------+-----------------------------------------+
     | CHAR / VARCHAR / STRING        | StringData                    |
     +--------------------------------+-----------------------------------------+
     | BINARY / VARBINARY / BYTES     | byte[]                                  |
     +--------------------------------+-----------------------------------------+
     | DECIMAL                        | DecimalData                         |
     +--------------------------------+-----------------------------------------+
     | TINYINT                        | byte                                    |
     +--------------------------------+-----------------------------------------+
     | SMALLINT                       | short                                   |
     +--------------------------------+-----------------------------------------+
     | INT                            | int                                     |
     +--------------------------------+-----------------------------------------+
     | BIGINT                         | long                                    |
     +--------------------------------+-----------------------------------------+
     | FLOAT                          | float                                   |
     +--------------------------------+-----------------------------------------+
     | DOUBLE                         | double                                  |
     +--------------------------------+-----------------------------------------+
     | DATE                           | int (number of days since epoch)        |
     +--------------------------------+-----------------------------------------+
     | TIME                           | int (number of milliseconds of the day) |
     +--------------------------------+-----------------------------------------+
     | TIMESTAMP                      | TimestampData                   |
     +--------------------------------+-----------------------------------------+
     | TIMESTAMP WITH LOCAL TIME ZONE | LocalZonedTimestampData         |
     +--------------------------------+-----------------------------------------+
     | TIMESTAMP WITH TIME ZONE       | ZonedTimestampData              |
     +--------------------------------+-----------------------------------------+
     | ROW                            | RecordData                      |
     +--------------------------------+-----------------------------------------+
     | ARRAY                          | ArrayData                       |
     +--------------------------------+-----------------------------------------+
     | MAP                            | MapData                         |
     +--------------------------------+-----------------------------------------+
     

    Nullability is always handled by the container data structure.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  RecordData.FieldGetter
      Accessor for getting the field of a RecordData during runtime.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static RecordData.FieldGetter createFieldGetter​(DataType fieldType, int fieldPos)
      Creates an accessor for getting elements in an internal RecordData structure at the given position.
      int getArity()
      Returns the number of fields in this record.
      ArrayData getArray​(int pos)
      Returns the array value at the given position.
      byte[] getBinary​(int pos)
      Returns the binary value at the given position.
      boolean getBoolean​(int pos)
      Returns the boolean value at the given position.
      byte getByte​(int pos)
      Returns the byte value at the given position.
      DateData getDate​(int pos)
      Returns the Date data at the given position.
      DecimalData getDecimal​(int pos, int precision, int scale)
      Returns the decimal value at the given position.
      double getDouble​(int pos)
      Returns the double value at the given position.
      float getFloat​(int pos)
      Returns the float value at the given position.
      int getInt​(int pos)
      Returns the integer value at the given position.
      LocalZonedTimestampData getLocalZonedTimestampData​(int pos, int precision)
      Returns the local zoned timestamp value at the given position.
      long getLong​(int pos)
      Returns the long value at the given position.
      MapData getMap​(int pos)
      Returns the map value at the given position.
      RecordData getRow​(int pos, int numFields)
      Returns the row value at the given position.
      short getShort​(int pos)
      Returns the short value at the given position.
      StringData getString​(int pos)
      Returns the string value at the given position.
      TimeData getTime​(int pos)
      Returns the Time data at the given position.
      TimestampData getTimestamp​(int pos, int precision)
      Returns the timestamp value at the given position.
      Variant getVariant​(int pos)
      Returns the variant value at the given position.
      ZonedTimestampData getZonedTimestamp​(int pos, int precision)
      Returns the zoned timestamp value at the given position.
      boolean isNullAt​(int pos)
      Returns true if the field is null at the given position.
    • Method Detail

      • getArity

        int getArity()
        Returns the number of fields in this record.
      • isNullAt

        boolean isNullAt​(int pos)
        Returns true if the field is null at the given position.
      • getBoolean

        boolean getBoolean​(int pos)
        Returns the boolean value at the given position.
      • getByte

        byte getByte​(int pos)
        Returns the byte value at the given position.
      • getShort

        short getShort​(int pos)
        Returns the short value at the given position.
      • getInt

        int getInt​(int pos)
        Returns the integer value at the given position.
      • getLong

        long getLong​(int pos)
        Returns the long value at the given position.
      • getFloat

        float getFloat​(int pos)
        Returns the float value at the given position.
      • getDouble

        double getDouble​(int pos)
        Returns the double value at the given position.
      • getBinary

        byte[] getBinary​(int pos)
        Returns the binary value at the given position.
      • getString

        StringData getString​(int pos)
        Returns the string value at the given position.
      • getDecimal

        DecimalData getDecimal​(int pos,
                               int precision,
                               int scale)
        Returns the decimal value at the given position.

        The precision and scale are required to determine whether the decimal value was stored in a compact representation (see DecimalData).

      • getTimestamp

        TimestampData getTimestamp​(int pos,
                                   int precision)
        Returns the timestamp value at the given position.

        The precision is required to determine whether the timestamp value was stored in a compact representation (see TimestampData).

      • getZonedTimestamp

        ZonedTimestampData getZonedTimestamp​(int pos,
                                             int precision)
        Returns the zoned timestamp value at the given position.

        The precision is required to determine whether the zoned timestamp value was stored in a compact representation (see ZonedTimestampData).

      • getLocalZonedTimestampData

        LocalZonedTimestampData getLocalZonedTimestampData​(int pos,
                                                           int precision)
        Returns the local zoned timestamp value at the given position.

        The precision is required to determine whether the local zoned timestamp value was stored in a compact representation (see LocalZonedTimestampData).

      • getArray

        ArrayData getArray​(int pos)
        Returns the array value at the given position.
      • getMap

        MapData getMap​(int pos)
        Returns the map value at the given position.
      • getRow

        RecordData getRow​(int pos,
                          int numFields)
        Returns the row value at the given position.

        The number of fields is required to correctly extract the record.

      • getDate

        DateData getDate​(int pos)
        Returns the Date data at the given position.
      • getTime

        TimeData getTime​(int pos)
        Returns the Time data at the given position.
      • getVariant

        Variant getVariant​(int pos)
        Returns the variant value at the given position.
      • createFieldGetter

        static RecordData.FieldGetter createFieldGetter​(DataType fieldType,
                                                        int fieldPos)
        Creates an accessor for getting elements in an internal RecordData structure at the given position.
        Parameters:
        fieldType - the element type of the RecordData
        fieldPos - the element position of the RecordData