Class TPCCConfiguration

java.lang.Object
io.bloviate.gen.tpcc.TPCCConfiguration

public final class TPCCConfiguration extends Object
Builds a complete set of TableConfigurations for the TPC-C schema (see create_tpcc.*.sql), suitable for passing to a DatabaseConfiguration.

The composite primary/foreign keys are populated as a dense, row-ordered cartesian product using CompositeKeyComponentGenerator, so each table receives exactly its cartesian cardinality of rows with unique keys and valid references. Realistic values (last names, zip codes, credit, i_data/s_data) use the TPC-C generators in this package; the remaining non-key columns are configured with bounded generators matching the value ranges and seed values from the TPC-C specification (clause 4.3.3.1).

In line with the spec: each order has a random o_ol_cnt number of order lines in [minLinesPerOrder, maxLinesPerOrder] (default [5, 15]) and order_line holds exactly that many rows per order (see ChildCardinality); new_order holds only the most recent newOrdersPerDistrict orders per district (the highest o_ids) rather than mirroring every order; o_c_id is a per-district random permutation of customer ids (each customer has exactly one order); and c_last enumerates the first 1000 last names per district deterministically, using NURand only for the remainder.

Delivery state is modelled too: the most recent newOrdersPerDistrict orders per district are undelivered (the new_order subset), so their o_carrier_id and the ol_delivery_d of their order lines are NULL, while delivered orders carry a carrier id [1, 10] and a delivery timestamp. The result matches the TPC-C initial database population (clause 4.3.3.1).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default customers (and orders) per district (C), per the spec.
    static final int
    Default districts per warehouse (D), per the spec.
    static final int
    Default number of c_last names enumerated deterministically per district.
    static final int
    Default number of items (I), per the spec.
    static final int
    Default maximum order lines per order (inclusive), per the spec.
    static final int
    Default minimum order lines per order (inclusive), per the spec.
    static final int
    Default most-recent (undelivered) orders per district held in new_order, per the spec.
  • Method Summary

    Modifier and Type
    Method
    Description
    build(int warehouses)
    Builds a TPC-C configuration using the default per-warehouse cardinalities.
    build(int warehouses, int items, int districtsPerWarehouse, int customersPerDistrict, int minLinesPerOrder, int maxLinesPerOrder)
    Builds a TPC-C configuration with explicit cardinalities (useful for tests).
    build(int warehouses, int items, int districtsPerWarehouse, int customersPerDistrict, int minLinesPerOrder, int maxLinesPerOrder, int newOrdersPerDistrict)
    Builds a TPC-C configuration with explicit cardinalities, including the number of new_order rows per district.

    Methods inherited from class Object

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

    • DEFAULT_ITEMS

      public static final int DEFAULT_ITEMS
      Default number of items (I), per the spec.
      See Also:
    • DEFAULT_DISTRICTS_PER_WAREHOUSE

      public static final int DEFAULT_DISTRICTS_PER_WAREHOUSE
      Default districts per warehouse (D), per the spec.
      See Also:
    • DEFAULT_CUSTOMERS_PER_DISTRICT

      public static final int DEFAULT_CUSTOMERS_PER_DISTRICT
      Default customers (and orders) per district (C), per the spec.
      See Also:
    • DEFAULT_MIN_LINES_PER_ORDER

      public static final int DEFAULT_MIN_LINES_PER_ORDER
      Default minimum order lines per order (inclusive), per the spec.
      See Also:
    • DEFAULT_MAX_LINES_PER_ORDER

      public static final int DEFAULT_MAX_LINES_PER_ORDER
      Default maximum order lines per order (inclusive), per the spec.
      See Also:
    • DEFAULT_NEW_ORDERS_PER_DISTRICT

      public static final int DEFAULT_NEW_ORDERS_PER_DISTRICT
      Default most-recent (undelivered) orders per district held in new_order, per the spec.
      See Also:
    • DEFAULT_ENUMERATED_LAST_NAMES

      public static final int DEFAULT_ENUMERATED_LAST_NAMES
      Default number of c_last names enumerated deterministically per district.
      See Also:
  • Method Details

    • build

      public static Set<TableConfiguration> build(int warehouses)
      Builds a TPC-C configuration using the default per-warehouse cardinalities.
      Parameters:
      warehouses - the number of warehouses (the TPC-C scale factor)
      Returns:
      the set of table configurations
    • build

      public static Set<TableConfiguration> build(int warehouses, int items, int districtsPerWarehouse, int customersPerDistrict, int minLinesPerOrder, int maxLinesPerOrder)
      Builds a TPC-C configuration with explicit cardinalities (useful for tests). The number of new_order rows per district defaults to DEFAULT_NEW_ORDERS_PER_DISTRICT, clamped to the orders-per-district.
      Parameters:
      warehouses - number of warehouses (W)
      items - number of items (I)
      districtsPerWarehouse - districts per warehouse (D)
      customersPerDistrict - customers per district (C); also used as orders per district
      minLinesPerOrder - minimum order lines per order (inclusive)
      maxLinesPerOrder - maximum order lines per order (inclusive); pass the same value as minLinesPerOrder for a fixed line count
      Returns:
      the set of table configurations
    • build

      public static Set<TableConfiguration> build(int warehouses, int items, int districtsPerWarehouse, int customersPerDistrict, int minLinesPerOrder, int maxLinesPerOrder, int newOrdersPerDistrict)
      Builds a TPC-C configuration with explicit cardinalities, including the number of new_order rows per district.
      Parameters:
      warehouses - number of warehouses (W)
      items - number of items (I)
      districtsPerWarehouse - districts per warehouse (D)
      customersPerDistrict - customers per district (C); also used as orders per district
      minLinesPerOrder - minimum order lines per order (inclusive)
      maxLinesPerOrder - maximum order lines per order (inclusive); pass the same value as minLinesPerOrder for a fixed line count
      newOrdersPerDistrict - most-recent orders per district mirrored into new_order; clamped to [0, customersPerDistrict]
      Returns:
      the set of table configurations