Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to java 21 #37

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
fail-fast: false
matrix:
java-version:
- 8
- 11
- 21
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand Down
17 changes: 11 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.airlift</groupId>
<artifactId>airbase</artifactId>
<version>95</version>
<version>153</version>
</parent>

<groupId>io.trino.tpch</groupId>
Expand All @@ -28,25 +28,30 @@

<scm>
<connection>scm:git:git://github.com/trinodb/tpch.git</connection>
<url>https://github.com/trinodb/tpch</url>
<tag>HEAD</tag>
<url>https://github.com/trinodb/tpch</url>
</scm>

<properties>
<project.build.targetJdk>21</project.build.targetJdk>
<air.java.version>21.0.1</air.java.version>

<air.test.jvmsize>2g</air.test.jvmsize>
<air.check.skip-spotbugs>true</air.check.skip-spotbugs>
<air.check.skip-pmd>true</air.check.skip-pmd>
</properties>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<!-- for testing -->
<dependency>
Expand Down
89 changes: 19 additions & 70 deletions src/main/java/io/trino/tpch/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,86 +17,35 @@
import static io.trino.tpch.StringUtils.buildLine;
import static java.util.Objects.requireNonNull;

public class Customer
public record Customer(
long rowNumber,
long customerKey,
String name,
String address,
long nationKey,
String phone,
long accountBalanceInCents,
String marketSegment,
String comment)
implements TpchEntity
{
private final long rowNumber;
private final long customerKey;
private final String name;
private final String address;
private final long nationKey;
private final String phone;
private final long accountBalance;
private final String marketSegment;
private final String comment;

public Customer(long rowNumber, long customerKey, String name, String address, long nationKey, String phone, long accountBalance, String marketSegment, String comment)
{
this.rowNumber = rowNumber;
this.customerKey = customerKey;
this.name = requireNonNull(name, "name is null");
this.address = requireNonNull(address, "address is null");
this.nationKey = nationKey;
this.phone = requireNonNull(phone, "phone is null");
this.accountBalance = accountBalance;
this.marketSegment = requireNonNull(marketSegment, "marketSegment is null");
this.comment = requireNonNull(comment, "comment is null");
}

@Override
public long getRowNumber()
{
return rowNumber;
}

public long getCustomerKey()
{
return customerKey;
}

public String getName()
{
return name;
}

public String getAddress()
{
return address;
}

public long getNationKey()
{
return nationKey;
}

public String getPhone()
{
return phone;
}

public double getAccountBalance()
{
return accountBalance / 100.0;
}

public long getAccountBalanceInCents()
{
return accountBalance;
}

public String getMarketSegment()
public Customer
{
return marketSegment;
requireNonNull(name, "name is null");
requireNonNull(address, "address is null");
requireNonNull(phone, "phone is null");
requireNonNull(marketSegment, "marketSegment is null");
requireNonNull(comment, "comment is null");
}

public String getComment()
public double accountBalance()
{
return comment;
return accountBalanceInCents / 100.0;
}

@Override
public String toLine()
{
return buildLine(customerKey, name, address, nationKey, phone, formatMoney(accountBalance), marketSegment, comment);
return buildLine(customerKey, name, address, nationKey, phone, formatMoney(accountBalanceInCents), marketSegment, comment);
}
}
18 changes: 9 additions & 9 deletions src/main/java/io/trino/tpch/CustomerColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,69 +24,69 @@ public enum CustomerColumn
@Override
public long getIdentifier(Customer customer)
{
return customer.getCustomerKey();
return customer.customerKey();
}
},

NAME("c_name", varchar(25)) {
@Override
public String getString(Customer customer)
{
return customer.getName();
return customer.name();
}
},

ADDRESS("c_address", varchar(40)) {
@Override
public String getString(Customer customer)
{
return customer.getAddress();
return customer.address();
}
},

NATION_KEY("c_nationkey", IDENTIFIER) {
@Override
public long getIdentifier(Customer customer)
{
return customer.getNationKey();
return customer.nationKey();
}
},

PHONE("c_phone", varchar(15)) {
@Override
public String getString(Customer customer)
{
return customer.getPhone();
return customer.phone();
}
},

ACCOUNT_BALANCE("c_acctbal", DOUBLE) {
@Override
public double getDouble(Customer customer)
{
return customer.getAccountBalance();
return customer.accountBalance();
}

@Override
public long getIdentifier(Customer customer)
{
return customer.getAccountBalanceInCents();
return customer.accountBalanceInCents();
}
},

MARKET_SEGMENT("c_mktsegment", varchar(10)) {
@Override
public String getString(Customer customer)
{
return customer.getMarketSegment();
return customer.marketSegment();
}
},

COMMENT("c_comment", varchar(117)) {
@Override
public String getString(Customer customer)
{
return customer.getComment();
return customer.comment();
}
};

Expand Down
Loading
Loading