Skip to content

Commit 9432ace

Browse files
committed
Refactoring
1 parent 7fb0778 commit 9432ace

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

it/google-cloud-platform/src/main/resources/test-artifact.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

it/iceberg/src/main/resources/test-artifact.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

it/iceberg/src/test/java/org/apache/beam/it/iceberg/IcebergIOLT.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ private static void setTempLocation(TestPipeline pipeline) {
281281
private static class MapToIcebergFormat extends DoFn<Long, Row> {
282282

283283
private final int valueSizeBytes;
284+
private transient Random random;
284285

285286
private MapToIcebergFormat(int valueSizeBytes) {
286287
if (valueSizeBytes <= 0) {
@@ -290,6 +291,11 @@ private MapToIcebergFormat(int valueSizeBytes) {
290291
this.valueSizeBytes = valueSizeBytes;
291292
}
292293

294+
@Setup
295+
public void setup() {
296+
random = new Random();
297+
}
298+
293299
@ProcessElement
294300
public void processElement(@Element Long index, OutputReceiver<Row> output) {
295301

@@ -299,7 +305,8 @@ public void processElement(@Element Long index, OutputReceiver<Row> output) {
299305
* Using the row index as the seed makes retries deterministic. Random data also prevents
300306
* compression from making the generated payload significantly smaller than configured.
301307
*/
302-
new Random(index).nextBytes(value);
308+
random.setSeed(index);
309+
random.nextBytes(value);
303310

304311
output.output(Row.withSchema(ROW_SCHEMA).addValues(index, value).build());
305312
}

0 commit comments

Comments
 (0)