Class RowProjectionGenerator<E>
- Type Parameters:
E- the entity type
- All Implemented Interfaces:
DataGenerator<String>, IndexedDataGenerator
public final class RowProjectionGenerator<E>
extends AbstractDataGenerator<String>
implements IndexedDataGenerator
Emits one field of a
RowContext's per-row entity. Several projections of the same context
share that context, so they produce a consistent tuple per row (issue #473).
Each projection keeps its own row counter and is seekable, so the
projections of a row advance in lockstep, stay order-independent, and reproduce the sequential
output under intra-table partitioning (each partition seeks to its first row, then walks). The
value is a pure function of the row index via the shared context, so partitioned output is
byte-identical to a sequential fill.
- Since:
- 2.12.0
-
Field Summary
Fields inherited from class AbstractDataGenerator
random, randomUtils -
Method Summary
Modifier and TypeMethodDescriptiongenerate()Projects the selected field of the entity for the current row, then advances this projection's row counter by one.Reads this projection's value back from aResultSetas a string.voidseek(long rowIndex) Positions this projection's row counter at the given row index, so the nextgenerate()projects that row's entity.Methods inherited from class AbstractDataGenerator
generateAndSet, generateAsString, reseed, set
-
Method Details
-
generate
Projects the selected field of the entity for the current row, then advances this projection's row counter by one. The entity is resolved from the sharedRowContextfor the current row index, so sibling projections of the same context yield a consistent tuple.- Specified by:
generatein interfaceDataGenerator<E>- Returns:
- the selected field of the current row's entity, as a string
-
seek
public void seek(long rowIndex) Positions this projection's row counter at the given row index, so the nextgenerate()projects that row's entity. Used for positional or partitioned access, where each partition seeks to its first row and then walks forward.- Specified by:
seekin interfaceIndexedDataGenerator- Parameters:
rowIndex- the zero-based row index to position at- Throws:
IllegalArgumentException- ifrowIndexis negative
-
get
Reads this projection's value back from aResultSetas a string.- Specified by:
getin interfaceDataGenerator<E>- Parameters:
resultSet- the result set positioned on the row to readcolumnIndex- the one-based column index to read- Returns:
- the column value as a string
- Throws:
SQLException- if the value cannot be read from the result set
-