Class StringRowSerializer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T decode​(Type type, byte[] value)
      Generic function to decode the given byte array to a Java object based on the given type.
      void deserialize​(Map.Entry<org.apache.accumulo.core.data.Key,​org.apache.accumulo.core.data.Value> entry)
      Deserialize the given Accumulo entry, retrieving data for the Trino column.
      byte[] encode​(Type type, Object value)
      Encodes a Trino Java object to a byte array based on the given type.
      Block getArray​(String name, Type type)
      Gets the array Block of the given Trino column.
      boolean getBoolean​(String name)
      Gets the Boolean value of the given Trino column.
      byte getByte​(String name)
      Gets the Byte value of the given Trino column.
      Date getDate​(String name)
      Gets the Date value of the given Trino column.
      double getDouble​(String name)
      Gets the Double value of the given Trino column.
      float getFloat​(String name)
      Gets the Float value of the given Trino column.
      int getInt​(String name)
      Gets the Integer value of the given Trino column.
      long getLong​(String name)
      Gets the Long value of the given Trino column.
      Block getMap​(String name, Type type)
      Gets the Map value of the given Trino column and Map type.
      short getShort​(String name)
      Gets the Short value of the given Trino column.
      Time getTime​(String name)
      Gets the Time value of the given Trino column.
      Timestamp getTimestamp​(String name)
      Gets the Timestamp value of the given Trino column.
      byte[] getVarbinary​(String name)
      Gets the Varbinary value of the given Trino column.
      String getVarchar​(String name)
      Gets the String value of the given Trino column.
      boolean isNull​(String name)
      Gets a Boolean value indicating whether or not the Trino column is a null value.
      void reset()
      Reset the state of the serializer to prepare for a new set of entries with the same row ID.
      void setArray​(org.apache.hadoop.io.Text text, Type type, Block block)
      Encode the given array Block into the given Text object.
      void setBoolean​(org.apache.hadoop.io.Text text, Boolean value)
      Encode the given Boolean value into the given Text object.
      void setByte​(org.apache.hadoop.io.Text text, Byte value)
      Encode the given Byte value into the given Text object.
      void setDate​(org.apache.hadoop.io.Text text, Date value)
      Encode the given Date value into the given Text object.
      void setDouble​(org.apache.hadoop.io.Text text, Double value)
      Encode the given Double value into the given Text object.
      void setFloat​(org.apache.hadoop.io.Text text, Float value)
      Encode the given Float value into the given Text object.
      void setInt​(org.apache.hadoop.io.Text text, Integer value)
      Encode the given Integer value into the given Text object.
      void setLong​(org.apache.hadoop.io.Text text, Long value)
      Encode the given Long value into the given Text object.
      void setMap​(org.apache.hadoop.io.Text text, Type type, Block block)
      Encode the given map Block into the given Text object.
      void setMapping​(String name, String family, String qualifier)
      Sets the mapping for the Trino column name to Accumulo family and qualifier.
      void setRowIdName​(String name)
      Sets the Trino name which maps to the Accumulo row ID.
      void setRowOnly​(boolean rowOnly)
      Sets a Boolean value indicating whether or not only the row ID is going to be retrieved from the serializer.
      void setShort​(org.apache.hadoop.io.Text text, Short value)
      Encode the given Short value into the given Text object.
      void setTime​(org.apache.hadoop.io.Text text, Time value)
      Encode the given Time value into the given Text object.
      void setTimestamp​(org.apache.hadoop.io.Text text, Timestamp value)
      Encode the given Timestamp value into the given Text object.
      void setVarbinary​(org.apache.hadoop.io.Text text, byte[] value)
      Encode the given byte[] value into the given Text object.
      void setVarchar​(org.apache.hadoop.io.Text text, String value)
      Encode the given String value into the given Text object.
    • Constructor Detail

      • StringRowSerializer

        public StringRowSerializer()
    • Method Detail

      • setRowOnly

        public void setRowOnly​(boolean rowOnly)
        Description copied from interface: AccumuloRowSerializer
        Sets a Boolean value indicating whether or not only the row ID is going to be retrieved from the serializer.
        Specified by:
        setRowOnly in interface AccumuloRowSerializer
        Parameters:
        rowOnly - True if only the row ID is set, false otherwise
      • setMapping

        public void setMapping​(String name,
                               String family,
                               String qualifier)
        Description copied from interface: AccumuloRowSerializer
        Sets the mapping for the Trino column name to Accumulo family and qualifier.
        Specified by:
        setMapping in interface AccumuloRowSerializer
        Parameters:
        name - Trino name
        family - Accumulo family
        qualifier - Accumulo qualifier
      • reset

        public void reset()
        Description copied from interface: AccumuloRowSerializer
        Reset the state of the serializer to prepare for a new set of entries with the same row ID.
        Specified by:
        reset in interface AccumuloRowSerializer
      • deserialize

        public void deserialize​(Map.Entry<org.apache.accumulo.core.data.Key,​org.apache.accumulo.core.data.Value> entry)
        Description copied from interface: AccumuloRowSerializer
        Deserialize the given Accumulo entry, retrieving data for the Trino column.
        Specified by:
        deserialize in interface AccumuloRowSerializer
        Parameters:
        entry - Entry to deserialize
      • isNull

        public boolean isNull​(String name)
        Description copied from interface: AccumuloRowSerializer
        Gets a Boolean value indicating whether or not the Trino column is a null value.
        Specified by:
        isNull in interface AccumuloRowSerializer
        Parameters:
        name - Column name
        Returns:
        True if null, false otherwise.
      • setArray

        public void setArray​(org.apache.hadoop.io.Text text,
                             Type type,
                             Block block)
        Description copied from interface: AccumuloRowSerializer
        Encode the given array Block into the given Text object.
        Specified by:
        setArray in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        type - Array type
        block - Array block
      • setBoolean

        public void setBoolean​(org.apache.hadoop.io.Text text,
                               Boolean value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Boolean value into the given Text object.
        Specified by:
        setBoolean in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setByte

        public void setByte​(org.apache.hadoop.io.Text text,
                            Byte value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Byte value into the given Text object.
        Specified by:
        setByte in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setDate

        public void setDate​(org.apache.hadoop.io.Text text,
                            Date value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Date value into the given Text object.
        Specified by:
        setDate in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setDouble

        public void setDouble​(org.apache.hadoop.io.Text text,
                              Double value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Double value into the given Text object.
        Specified by:
        setDouble in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setFloat

        public void setFloat​(org.apache.hadoop.io.Text text,
                             Float value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Float value into the given Text object.
        Specified by:
        setFloat in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setInt

        public void setInt​(org.apache.hadoop.io.Text text,
                           Integer value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Integer value into the given Text object.
        Specified by:
        setInt in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setLong

        public void setLong​(org.apache.hadoop.io.Text text,
                            Long value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Long value into the given Text object.
        Specified by:
        setLong in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setMap

        public void setMap​(org.apache.hadoop.io.Text text,
                           Type type,
                           Block block)
        Description copied from interface: AccumuloRowSerializer
        Encode the given map Block into the given Text object.
        Specified by:
        setMap in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        type - Map type
        block - Map block
      • setShort

        public void setShort​(org.apache.hadoop.io.Text text,
                             Short value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Short value into the given Text object.
        Specified by:
        setShort in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setTime

        public void setTime​(org.apache.hadoop.io.Text text,
                            Time value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Time value into the given Text object.
        Specified by:
        setTime in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setTimestamp

        public void setTimestamp​(org.apache.hadoop.io.Text text,
                                 Timestamp value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given Timestamp value into the given Text object.
        Specified by:
        setTimestamp in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setVarbinary

        public void setVarbinary​(org.apache.hadoop.io.Text text,
                                 byte[] value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given byte[] value into the given Text object.
        Specified by:
        setVarbinary in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • setVarchar

        public void setVarchar​(org.apache.hadoop.io.Text text,
                               String value)
        Description copied from interface: AccumuloRowSerializer
        Encode the given String value into the given Text object.
        Specified by:
        setVarchar in interface AccumuloRowSerializer
        Parameters:
        text - Text object to set
        value - Value to encode
      • encode

        public byte[] encode​(Type type,
                             Object value)
        Description copied from interface: AccumuloRowSerializer
        Encodes a Trino Java object to a byte array based on the given type.

        Java Lists and Maps can be converted to Blocks using AccumuloRowSerializer.getBlockFromArray(Type, java.util.List) and AccumuloRowSerializer.getBlockFromMap(Type, Map)

        Type to Encode Expected Java Object
        ARRAY io.trino.spi.block.Block
        BIGINT Integer or Long
        BOOLEAN Boolean
        DATE java.sql.Date, Long
        DOUBLE Double
        INTEGER Integer
        Map io.trino.spi.block.Block
        REAL Float
        SMALLINT Short
        TIME java.sql.Time, Long
        TIMESTAMP java.sql.Timestamp, Long
        TINYINT Byte
        VARBINARY io.airlift.slice.Slice or byte[]
        VARCHAR io.airlift.slice.Slice or String
        Specified by:
        encode in interface AccumuloRowSerializer
        Parameters:
        type - The Trino Type
        value - The Java object per the table in the method description
        Returns:
        Encoded bytes
      • decode

        public <T> T decode​(Type type,
                            byte[] value)
        Description copied from interface: AccumuloRowSerializer
        Generic function to decode the given byte array to a Java object based on the given type.

        Blocks from ARRAY and MAP types can be converted to Java Lists and Maps using AccumuloRowSerializer.getArrayFromBlock(Type, Block) and AccumuloRowSerializer.getMapFromBlock(Type, Block)

        Encoded Type Returned Java Object
        ARRAY List<?>
        BIGINT Long
        BOOLEAN Boolean
        DATE Long
        DOUBLE Double
        Map Map<?,?>
        REAL Double
        SMALLINT Long
        TIME Long
        TIMESTAMP Long
        TINYINT Long
        VARBINARY byte[]
        VARCHAR String
        Specified by:
        decode in interface AccumuloRowSerializer
        Type Parameters:
        T - The Java type of the object that has been encoded to the given byte array
        Parameters:
        type - The Trino Type
        value - Encoded bytes to decode
        Returns:
        The Java object per the table in the method description