Skip to content

Commit

Permalink
Update tpch to 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Mar 22, 2024
1 parent 51eea3a commit 92f04cf
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ private static Page generatePage(List<Type> types, int rowCount, Iterator<LineIt
for (int column = 0; column < types.size(); column++) {
Type type = types.get(column);
if (BIGINT.equals(type)) {
BIGINT.writeLong(pageBuilder.getBlockBuilder(column), lineItem.getOrderKey());
BIGINT.writeLong(pageBuilder.getBlockBuilder(column), lineItem.orderKey());
}
else if (VARCHAR.equals(type)) {
VARCHAR.writeString(pageBuilder.getBlockBuilder(column), lineItem.getComment());
VARCHAR.writeString(pageBuilder.getBlockBuilder(column), lineItem.comment());
}
else if (DOUBLE.equals(type)) {
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(column), lineItem.getExtendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(column), lineItem.extendedPrice());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private static List<Page> createInputPages(int positionsPerPage)
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
BIGINT.writeLong(pageBuilder.getBlockBuilder(0), lineItem.getOrderKey());
BIGINT.writeLong(pageBuilder.getBlockBuilder(0), lineItem.orderKey());

if (pageBuilder.getPositionCount() == positionsPerPage) {
pages.add(pageBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ private static Page createInputPage(int positions, List<Type> types)
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.getExtendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.getDiscount());
VARCHAR.writeString(pageBuilder.getBlockBuilder(STATUS), lineItem.getStatus());
BIGINT.writeLong(pageBuilder.getBlockBuilder(QUANTITY), lineItem.getQuantity());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.extendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.discount());
VARCHAR.writeString(pageBuilder.getBlockBuilder(STATUS), lineItem.status());
BIGINT.writeLong(pageBuilder.getBlockBuilder(QUANTITY), lineItem.quantity());
}
return pageBuilder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ private static Page createInputPage(int positions, List<Type> types)
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.getExtendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.getDiscount());
DATE.writeLong(pageBuilder.getBlockBuilder(SHIP_DATE), lineItem.getShipDate());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.getQuantity());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.extendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.discount());
DATE.writeLong(pageBuilder.getBlockBuilder(SHIP_DATE), lineItem.shipDate());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.quantity());
}
return pageBuilder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ private static List<Page> createInputPages(int positionsPerPage, List<Type> type
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.getExtendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.getDiscount());
DATE.writeLong(pageBuilder.getBlockBuilder(SHIP_DATE), lineItem.getShipDate());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.getQuantity());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.extendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.discount());
DATE.writeLong(pageBuilder.getBlockBuilder(SHIP_DATE), lineItem.shipDate());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.quantity());

if (pageBuilder.getPositionCount() == positionsPerPage) {
pages.add(pageBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ private List<Page> createInputPages()
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
BIGINT.writeLong(pageBuilder.getBlockBuilder(0), lineItem.getOrderKey());
BIGINT.writeLong(pageBuilder.getBlockBuilder(1), lineItem.getDiscountPercent());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(2), lineItem.getDiscount());
VARCHAR.writeString(pageBuilder.getBlockBuilder(3), lineItem.getReturnFlag());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(4), lineItem.getExtendedPrice());
BIGINT.writeLong(pageBuilder.getBlockBuilder(0), lineItem.orderKey());
BIGINT.writeLong(pageBuilder.getBlockBuilder(1), lineItem.discountPercent());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(2), lineItem.discount());
VARCHAR.writeString(pageBuilder.getBlockBuilder(3), lineItem.returnFlag());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(4), lineItem.extendedPrice());
}
pages.add(pageBuilder.build());
pageBuilder.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ private static Page createInputPage()
pageBuilder.declarePosition();

LineItem lineItem = iterator.next();
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.getExtendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.getDiscount());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(EXTENDED_PRICE), lineItem.extendedPrice());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(DISCOUNT), lineItem.discount());
VARCHAR.writeSlice(pageBuilder.getBlockBuilder(SHIP_DATE), Slices.wrappedBuffer(LineItemColumn.SHIP_DATE.getString(lineItem).getBytes(UTF_8)));
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.getQuantity());
DOUBLE.writeDouble(pageBuilder.getBlockBuilder(QUANTITY), lineItem.quantity());
}
return pageBuilder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ private void testCloseIdleWriters(DataSize idleWritersMinFileSize, int expectedT
List<HiveColumnHandle> columnHandles = getPartitionedColumnHandles(SHIP_MODE.getColumnName());
Location location = makeFileName(config);
ConnectorPageSink pageSink = createPageSink(fileSystemFactory, transaction, config, sortingFileWriterConfig, metastore, location, stats, columnHandles);
Page truckPage = createPage(lineItem -> lineItem.getShipMode().equals("TRUCK"));
Page shipPage = createPage(lineItem -> lineItem.getShipMode().equals("SHIP"));
Page truckPage = createPage(lineItem -> lineItem.shipMode().equals("TRUCK"));
Page shipPage = createPage(lineItem -> lineItem.shipMode().equals("SHIP"));

pageSink.appendPage(truckPage);
pageSink.appendPage(shipPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void testFullFileReadOriginalFilesTable()
assertThat(result.size()).isEqualTo(expected.size());
int deletedRowKey = 24;
String deletedRowNameColumn = "UNITED STATES";
assertThat(result.stream().anyMatch(acidNationRow -> acidNationRow.getName().equals(deletedRowNameColumn) && acidNationRow.getNationKey() == deletedRowKey))
assertThat(result.stream().anyMatch(acidNationRow -> acidNationRow.name().equals(deletedRowNameColumn) && acidNationRow.nationKey() == deletedRowKey))
.describedAs("Deleted row shouldn't be present in the result")
.isFalse();
}
Expand All @@ -202,10 +202,10 @@ private static List<Nation> expectedResult(OptionalLong nationKeyPredicate, Long
{
List<Nation> expected = new ArrayList<>();
for (Nation nation : ImmutableList.copyOf(new NationGenerator().iterator())) {
if (nationKeyPredicate.isPresent() && nationKeyPredicate.getAsLong() != nation.getNationKey()) {
if (nationKeyPredicate.isPresent() && nationKeyPredicate.getAsLong() != nation.nationKey()) {
continue;
}
if (deletedRows.test(nation.getNationKey())) {
if (deletedRows.test(nation.nationKey())) {
continue;
}
expected.addAll(nCopies(replicationFactor, nation));
Expand Down Expand Up @@ -344,10 +344,10 @@ private static void assertEqualsByColumns(Set<NationColumn> columns, List<Nation
for (int i = 0; i < actualRows.size(); i++) {
Nation actual = actualRows.get(i);
Nation expected = expectedRows.get(i);
assertThat(actual.getNationKey()).isEqualTo(columns.contains(NATION_KEY) ? expected.getNationKey() : -42);
assertThat(actual.getName()).isEqualTo(columns.contains(NAME) ? expected.getName() : "<not read>");
assertThat(actual.getRegionKey()).isEqualTo(columns.contains(REGION_KEY) ? expected.getRegionKey() : -42);
assertThat(actual.getComment()).isEqualTo(columns.contains(COMMENT) ? expected.getComment() : "<not read>");
assertThat(actual.nationKey()).isEqualTo(columns.contains(NATION_KEY) ? expected.nationKey() : -42);
assertThat(actual.name()).isEqualTo(columns.contains(NAME) ? expected.name() : "<not read>");
assertThat(actual.regionKey()).isEqualTo(columns.contains(REGION_KEY) ? expected.regionKey() : -42);
assertThat(actual.comment()).isEqualTo(columns.contains(COMMENT) ? expected.comment() : "<not read>");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public double getDouble(E entity)
@Override
public long getIdentifier(E entity)
{
return entity.getRowNumber();
return entity.rowNumber();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@
<dependency>
<groupId>io.trino.tpch</groupId>
<artifactId>tpch</artifactId>
<version>1.2</version>
<version>1.4</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 92f04cf

Please sign in to comment.