Class OrderLineDeliveryDateGenerator

java.lang.Object
io.bloviate.gen.AbstractDataGenerator<Timestamp>
io.bloviate.gen.tpcc.OrderLineDeliveryDateGenerator
All Implemented Interfaces:
DataGenerator<Timestamp>, IndexedDataGenerator

public class OrderLineDeliveryDateGenerator extends AbstractDataGenerator<Timestamp> implements IndexedDataGenerator
Generates ol_delivery_d for the order_line table under variable order-line cardinality: a delivery timestamp for the lines of delivered orders, and NULL for the lines of the most recent (undelivered) orders.

An order is delivered when its o_id is at or below deliveredThreshold (the lower o_ids of each district; the higher ones are the undelivered new_order subset). Because order_line has a variable number of rows per order, this generator reuses a ChildKeyComponentGenerator configured to emit each line's parent o_id as an independent lockstep walker over the shared ChildCardinality — so it needs no walk state of its own and stays consistent with the order_line key columns.

The delivery timestamp approximates the spec's ol_delivery_d = o_entry_d; the fidelity that matters is that undelivered orders' lines are NULL.

  • Method Details

    • generate

      public Timestamp generate()
      Description copied from interface: DataGenerator
      Generates a random value of type T.
      Specified by:
      generate in interface DataGenerator<Timestamp>
      Returns:
      a generated value, may be null if the generator supports nullable columns
    • seek

      public void seek(long rowIndex)
      Positions this generator so the next DataGenerator.generate() returns the value for the given absolute (0-based) row index.

      The delivered/undelivered (timestamp-vs-NULL) decision is positional — it comes entirely from the wrapped ChildKeyComponentGenerator walker — so seeking delegates to it, keeping the column aligned with the order_line keys under intra-table partitioning.

      Specified by:
      seek in interface IndexedDataGenerator
      Parameters:
      rowIndex - the absolute, 0-based row index to seek to; must be >= 0
    • set

      public void set(Connection connection, PreparedStatement statement, int parameterIndex, Timestamp value) throws SQLException
      Description copied from interface: DataGenerator
      Sets a specific value on a PreparedStatement parameter.
      Specified by:
      set in interface DataGenerator<Timestamp>
      Overrides:
      set in class AbstractDataGenerator<Timestamp>
      Parameters:
      connection - the database connection
      statement - the prepared statement to set the parameter on
      parameterIndex - the 1-based parameter index
      value - the value to set
      Throws:
      SQLException - if the database operation fails
    • get

      public Timestamp get(ResultSet resultSet, int columnIndex) throws SQLException
      Description copied from interface: DataGenerator
      Retrieves a value from a ResultSet column.
      Specified by:
      get in interface DataGenerator<Timestamp>
      Parameters:
      resultSet - the result set to read from
      columnIndex - the 1-based column index
      Returns:
      the value from the result set, properly cast to type T
      Throws:
      SQLException - if the database operation fails