Skip to content

Commit

Permalink
Remove dead variable writes
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 13, 2022
1 parent 4d15192 commit 006d49a
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1980,9 +1980,8 @@ private static ParsedTimestamp parseTimestamp(String value)
Optional<String> timezone = Optional.ofNullable(matcher.group("timezone"));

long picosOfSecond = 0;
int precision = 0;
if (fraction != null) {
precision = fraction.length();
int precision = fraction.length();
verify(precision <= 12, "Unsupported timestamp precision %s: %s", precision, value);
long fractionValue = Long.parseLong(fraction);
picosOfSecond = rescale(fractionValue, precision, 12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public Page getOutput()
outputIterator = groupedTopNBuilder.buildResult();
}

Page output = null;
Page output;
if (outputIterator != null && outputIterator.hasNext()) {
// rewrite to expected column ordering
output = outputIterator.next().getColumns(outputChannels);
Expand Down
2 changes: 1 addition & 1 deletion core/trino-spi/src/main/java/io/trino/spi/type/Int128.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static Int128 valueOf(String value)
public static Int128 valueOf(BigInteger value)
{
long low = value.longValue();
long high = 0;
long high;
try {
high = value.shiftRight(64).longValueExact();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public TimestampDecoder(String path)
public void decode(SearchHit hit, Supplier<Object> getter, BlockBuilder output)
{
DocumentField documentField = hit.getFields().get(path);
Object value = null;
Object value;

if (documentField != null) {
if (documentField.getValues().size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,6 @@ public void alterTransactionalTable(HiveIdentity identity, Table table, long tra
delegate.alterTransactionalTable(identity, table, transactionId, writeId, principalPrivileges);
}
finally {
identity = updateIdentity(identity);
invalidateTable(table.getDatabaseName(), table.getTableName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ private static Optional<SSLContext> buildSslContext(
try {
// load KeyStore if configured and get KeyManagers
KeyManager[] keyManagers = null;
KeyStore keyStore = null;
char[] keyManagerPassword = new char[0];
if (keyStorePath.isPresent()) {
KeyStore keyStore;
try {
keyStore = PemReader.loadKeyStore(keyStorePath.get(), keyStorePath.get(), keyStorePassword);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class OrcPageSource
private final FileFormatDataSourceStats stats;

// Row ID relative to all the original files of the same bucket ID before this file in lexicographic order
private Optional<Long> originalFileRowId = Optional.empty();
private final Optional<Long> originalFileRowId;

private long completedPositions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public void checkpoint(String lastReadSequenceNumber)
public String getLastReadSeqNumber()
{
String lastReadSeqNumber = null;
KinesisClientLease oldLease = null;
if (currentIterationNumber > 0) {
KinesisClientLease oldLease;
try {
oldLease = leaseManager.getLease(createCheckpointKey(currentIterationNumber - 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public void clearRecords()

public static class InternalStream
{
private String streamName = "";
private String streamAmazonResourceName = "";
private final String streamName;
private final String streamAmazonResourceName;
private String streamStatus = "CREATING";
private List<InternalShard> shards = new ArrayList<>();
private int sequenceNo = 100;
Expand Down Expand Up @@ -202,8 +202,8 @@ record = record.withData(data).withPartitionKey(partitionKey).withSequenceNumber

public static class ShardIterator
{
public String streamId = "";
public int shardIndex;
public final String streamId;
public final int shardIndex;
public int recordIndex;

public ShardIterator(String streamId, int shardIndex, int recordIndex)
Expand Down Expand Up @@ -398,14 +398,14 @@ public GetRecordsResult getRecords(GetRecordsRequest getRecordsRequest)
}

// TODO: incorporate maximum batch size (getRecordsRequest.getLimit)
GetRecordsResult result = null;
InternalStream stream = this.getStream(iterator.streamId);
if (stream == null) {
throw new AmazonClientException("Unknown stream or bad shard iterator.");
}

InternalShard shard = stream.getShards().get(iterator.shardIndex);

GetRecordsResult result;
if (iterator.recordIndex == 100) {
result = new GetRecordsResult();
List<Record> recs = shard.getRecords();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1746,10 +1746,8 @@ void withTemporaryTable(String rootName, boolean transactional, boolean isPartit
if (transactional) {
ensureTransactionalHive();
}
String tableName = null;
try (TemporaryHiveTable table = TemporaryHiveTable.temporaryHiveTable(tableName(rootName, isPartitioned, bucketingType))) {
tableName = table.getName();
testRunner.accept(tableName);
testRunner.accept(table.getName());
}
}

Expand Down

0 comments on commit 006d49a

Please sign in to comment.