Class CustomerLastNameGenerator

java.lang.Object
io.bloviate.gen.AbstractDataGenerator<String>
io.bloviate.gen.tpcc.CustomerLastNameGenerator
All Implemented Interfaces:
DataGenerator<String>

public class CustomerLastNameGenerator extends AbstractDataGenerator<String>
Generates TPC-C customer last names (clause 4.3.2.3): three concatenated syllables selected from a fixed set by a number in [0, 999]. The result is at most 15 characters, fitting the c_last varchar(16) column.

By default the number is drawn via NURand for every row. To match the load procedure (clause 4.3.3.1), configure groupSize (the customers per district) and enumeratedCount (typically 1000): the first enumeratedCount customers of each district then enumerate the numbers 0..enumeratedCount-1 deterministically — guaranteeing every distinct last name is present — and only the remaining customers use NURand.

  • Field Details

    • MAX_ENUMERATED

      public static final int MAX_ENUMERATED
      The spec enumerates last-name numbers [0, 999] for the first 1000 customers per district.
      See Also:
  • Method Details

    • generate

      public String generate()
      Description copied from interface: DataGenerator
      Generates a random value of type T.
      Returns:
      a generated value, may be null if the generator supports nullable columns
    • lastName

      public static String lastName(int num)
      Builds the TPC-C last name for a number in [0, 999] by indexing the syllable set with its three decimal digits.
      Parameters:
      num - a value in [0, 999]
      Returns:
      the concatenated three-syllable last name
    • get

      public String get(ResultSet resultSet, int columnIndex) throws SQLException
      Description copied from interface: DataGenerator
      Retrieves a value from a ResultSet column.
      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