Class TableSerDe

  • All Implemented Interfaces:
    Deserializer, SerDe, Serializer

    public class TableSerDe
    extends AbstractSerDe
    Concrete implementation of TableSerDeBase that performs deserialization and/or serialization of data loaded into a KVStore via the PrimaryKey based Table API.
    • Constructor Detail

      • TableSerDe

        public TableSerDe()
    • Method Detail

      • validateParams

        protected void validateParams​(Properties tbl)
                               throws SerDeException
        Verifies that the names and types of the fields in the KV Store table correctly map to the names and types of the Hive table against which the Hive query is to be executed. Note that this method assumes that both the KVStore parameters and the serde parameters have been initialized. If a mismatch is found between KV Store fields and Hive columns, then a SerDeException will be thrown with a descriptive message.
        Throws:
        SerDeException
      • deserialize

        public Object deserialize​(Writable field)
                           throws SerDeException
        Deserializes the given Writable parameter and returns a Java Object representing the contents of that parameter. The field parameter of this method references a field from a row of the KVStore table having the name specified by the tableName field of this class. Thus, the Object returned by this method references the contents of that table field.
        Specified by:
        deserialize in interface Deserializer
        Parameters:
        field - The Writable object containing a serialized object from a row of the KVStore table with name specified by tableName.
        Returns:
        A Java object representing the contents in the given table field parameter.
        Throws:
        SerDeException
      • serialize

        public Writable serialize​(Object obj,
                                  ObjectInspector objectInspector)
                           throws SerDeException
        Serialize the given Object by navigating inside the Object with the given ObjectInspector. The given Object references a Hive row and the return value is an instance of Writable that references a KVStore table fieldName:fieldValue pair.
        Specified by:
        serialize in interface Serializer
        Parameters:
        obj - The Object whose contents are examined and from which the return value is constructed.
        objectInspector - The object to use to navigate the given Object's contents.
        Returns:
        A Writable object representing the contents in the given Object to seriaize.
        Throws:
        SerDeException
      • setStore

        protected void setStore​(KVStore testStore)
        For testing only; to support the use of a mocked store.