Record Class TableConfiguration

java.lang.Object
java.lang.Record
io.bloviate.db.TableConfiguration
Record Components:
tableName - the name of the table to configure
rowCount - the number of rows to generate for this table
columnConfigurations - optional per-column generator overrides; may be null or empty
partitions - the number of intra-table partitions for parallel fills; 1 (the default) disables intra-table partitioning. Must be >= 1.

public record TableConfiguration(String tableName, long rowCount, Set<ColumnConfiguration> columnConfigurations, int partitions) extends Record
Configuration for customizing how a specific table should be filled with data. This record allows users to specify a custom row count for an individual table (overriding the default row count specified in the DatabaseConfiguration), an optional intra-table partition count for parallel fills, and optional per-column generator overrides.

Intra-table partitioning. When partitions > 1 and the fill runs on the parallel (DataSource + threads) path, this table's rows are split into that many contiguous ranges filled concurrently, one connection per range — useful when a single large table dominates the fill. It is ignored on the sequential (single-Connection) path.

Partitioning is reproducible for a given configuration, including the partition count: key columns and the columns correlated with them (foreign keys, sequences, permutations) are byte-for-byte identical to a sequential fill, so foreign-key validity always holds; only plain non-key random columns take different (but still deterministic) values when the partition count changes. One case is unsupported: partitioning a parent table whose primary key is a plain random generator referenced by a foreign key can orphan those references — partition the child table instead, or use the positional key generators (as the bundled TPC-C/TPC-H configurations do).

Since:
1.0.0
  • Constructor Details

    • TableConfiguration

      public TableConfiguration(String tableName, long rowCount, Set<ColumnConfiguration> columnConfigurations, int partitions)
      Validates and normalizes the partition count: a non-positive value defaults to 1 (no intra-table partitioning).
    • TableConfiguration

      public TableConfiguration(String tableName, long rowCount)
      Creates a table configuration with no per-column overrides and no intra-table partitioning.
      Parameters:
      tableName - the name of the table to configure
      rowCount - the number of rows to generate for this table
    • TableConfiguration

      public TableConfiguration(String tableName, long rowCount, Set<ColumnConfiguration> columnConfigurations)
      Creates a table configuration with per-column overrides and no intra-table partitioning.
      Parameters:
      tableName - the name of the table to configure
      rowCount - the number of rows to generate for this table
      columnConfigurations - optional per-column generator overrides; may be null or empty
    • TableConfiguration

      public TableConfiguration(String tableName, long rowCount, int partitions)
      Creates a table configuration with an intra-table partition count and no per-column overrides.
      Parameters:
      tableName - the name of the table to configure
      rowCount - the number of rows to generate for this table
      partitions - the number of intra-table partitions for parallel fills (>= 1)
  • Method Details

    • columnConfiguration

      public ColumnConfiguration columnConfiguration(String columnName)
      Retrieves the per-column configuration for the given column name.
      Parameters:
      columnName - the name of the column (matched case-insensitively)
      Returns:
      the column configuration if one is defined, or null otherwise
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tableName

      public String tableName()
      Returns the value of the tableName record component.
      Returns:
      the value of the tableName record component
    • rowCount

      public long rowCount()
      Returns the value of the rowCount record component.
      Returns:
      the value of the rowCount record component
    • columnConfigurations

      public Set<ColumnConfiguration> columnConfigurations()
      Returns the value of the columnConfigurations record component.
      Returns:
      the value of the columnConfigurations record component
    • partitions

      public int partitions()
      Returns the value of the partitions record component.
      Returns:
      the value of the partitions record component