Class UpdateCommand.TupleUpdater

  • All Implemented Interfaces:
    TupleProcessor
    Enclosing class:
    UpdateCommand

    private static class UpdateCommand.TupleUpdater
    extends java.lang.Object
    implements TupleProcessor
    An implementation of the tuple processor interface used by the UpdateCommand to update each tuple.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Environment environment
      The environment used to evaluate the update expressions.
      private EventDispatcher eventDispatcher
      The event dispatcher for firing row-update events.
      private java.util.HashMap<java.lang.String,​java.lang.Object> newValues
      The map containing column names and their new values for the update operation.
      private Schema schema
      The schema of the input tuples produced by the query evaluation.
      private TableInfo tableInfo
      The table whose tuples will be modified.
      private TupleFile tupleFile  
      private java.util.List<UpdateValue> values
      This is the list of values to change in the UPDATE statement.
    • Constructor Summary

      Constructors 
      Constructor Description
      TupleUpdater​(EventDispatcher eventDispatcher, TableInfo tableInfo, java.util.List<UpdateValue> values)
      Initialize the tuple-updater object with the details it needs to modify tuples in the specified table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finish()
      This function is called when all tuples have been produced and passed to the tuple processor.
      void process​(Tuple tuple)
      This implementation updates each tuple it is handed, based on the set of update-specs that were given in the constructor.
      void setSchema​(Schema schema)
      Stores the schema that will be produced during result evaluation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tableInfo

        private TableInfo tableInfo
        The table whose tuples will be modified.
      • eventDispatcher

        private EventDispatcher eventDispatcher
        The event dispatcher for firing row-update events.
      • values

        private java.util.List<UpdateValue> values
        This is the list of values to change in the UPDATE statement.
      • schema

        private Schema schema
        The schema of the input tuples produced by the query evaluation. The update-expressions are evaluated in the context of this schema.
      • environment

        private Environment environment
        The environment used to evaluate the update expressions. This object is created once and reused throughout the update operation.
      • newValues

        private java.util.HashMap<java.lang.String,​java.lang.Object> newValues
        The map containing column names and their new values for the update operation. This object is created once and reused throughout the update operation.
    • Constructor Detail

      • TupleUpdater

        TupleUpdater​(EventDispatcher eventDispatcher,
                     TableInfo tableInfo,
                     java.util.List<UpdateValue> values)
        Initialize the tuple-updater object with the details it needs to modify tuples in the specified table.
        Parameters:
        tableInfo - details of the table that will be modified
        values - the list of columns to be updated, along with the corresponding expressions to generate the new values
    • Method Detail

      • setSchema

        public void setSchema​(Schema schema)
        Stores the schema that will be produced during result evaluation. Currently this will almost certainly be the table-file's schema, but if multiple-table update support is added then this could be an aggregated schema.
        Specified by:
        setSchema in interface TupleProcessor
      • process

        public void process​(Tuple tuple)
        This implementation updates each tuple it is handed, based on the set of update-specs that were given in the constructor.
        Specified by:
        process in interface TupleProcessor
        Parameters:
        tuple - The tuple to process.
      • finish

        public void finish()
        Description copied from interface: TupleProcessor
        This function is called when all tuples have been produced and passed to the tuple processor.
        Specified by:
        finish in interface TupleProcessor