public static void assertPartialMD5(int scaleFactor, int step, int children, String expectedMD5) { assertEntityLinesMD5(new CustomerGenerator(scaleFactor, step, children), expectedMD5); } }
public CustomerGenerator(BufferAllocator allocator, GenerationDefinition def, int partitionIndex, String...includedColumns) { super(TpchTable.CUSTOMER, allocator, def, partitionIndex, includedColumns); // setup fields. this.customerKey = int8("c_custkey"); this.customerName = varChar("c_name"); this.address = varChar("c_address"); this.nationKey = int8("c_nationkey"); this.phone = varChar("c_phone"); this.accountBalance = int8("c_acctbal"); this.marketSegment = varChar("c_mktsegment"); this.comment = varChar("c_comment"); this.date = varChar("c_date"); finalizeSetup(); }
protected void generateRecord(long globalRecordIndex, int outputIndex){ final long customerKey = globalRecordIndex; final long nationKey = nationKeyRandom.nextValue(); this.customerKey.setSafe(outputIndex, customerKey); this.nationKey.setSafe(outputIndex, nationKey); this.accountBalance.setSafe(outputIndex, accountBalanceRandom.nextValue()); set(outputIndex, customerName, String.format(ENGLISH, "Customer#%09d", customerKey)); set(outputIndex, address, addressRandom.nextValue()); set(outputIndex, phone, phoneRandom.nextValue(nationKey)); set(outputIndex, marketSegment, marketSegmentRandom.nextValue()); set(outputIndex, comment, commentRandom.nextValue()); set(outputIndex, date, LocalDate.of(yearRandom.nextValue(),1,1).toString()); }
/** * Create a monolithic partition generator. * @param table * @param target * @param scale * @return */ public static TpchGenerator singleGenerator(GenerationDefinition.TpchTable table, double scale, BufferAllocator allocator, String... includedColumns) { GenerationDefinition def = new GenerationDefinition(scale, Long.MAX_VALUE); switch(table){ case CUSTOMER: return new CustomerGenerator(allocator, def, 1, includedColumns); case REGION: return new RegionGenerator(allocator, def, includedColumns); case NATION: return new NationGenerator(allocator, def, includedColumns); default: throw new UnsupportedOperationException(); } } }