Skip to content

Commit aeecaa8

Browse files
committed
hetu core clean code
Signed-off-by: chenpingzeng <[email protected]>
1 parent 509bda8 commit aeecaa8

File tree

12 files changed

+23
-6
lines changed

12 files changed

+23
-6
lines changed

hetu-hive-functions/src/main/java/io/hetu/core/hive/dynamicfunctions/utils/HiveTypeTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private static TypeInfo limitedDepthTranslateToHiveTypeInfo(Type type, int maxDe
197197
if (charLength <= HiveChar.MAX_CHAR_LENGTH) {
198198
return getCharTypeInfo(charLength);
199199
}
200-
throw new PrestoException(NOT_SUPPORTED, String.format("Unsupported Hive type: %s." +
200+
throw new PrestoException(NOT_SUPPORTED, String.format(Locale.ROOT, "Unsupported Hive type: %s." +
201201
" Supported CHAR types: CHAR(<=%d).",
202202
type, HiveChar.MAX_CHAR_LENGTH));
203203
}

presto-main/src/main/java/io/prestosql/dispatcher/DispatchManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private boolean queryCreated(DispatchQuery dispatchQuery)
296296
}
297297
else {
298298
if (!isUiQuery && dispatchQuery.getBasicQueryInfo().getState() == QueryState.FAILED) {
299-
QueryInfo queryInfo = queryHistoryService.toFullQueryInfo(dispatchQuery);
299+
QueryInfo queryInfo = QueryHistoryService.toFullQueryInfo(dispatchQuery);
300300
queryHistoryService.insert(queryInfo);
301301
}
302302
// execution MUST be added to the expiration queue or there will be a leak

presto-main/src/main/java/io/prestosql/failuredetector/AbstractFailureRetryPolicy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ public AbstractFailureRetryPolicy(IBackoff backoff)
2828
this.backoff = backoff;
2929
}
3030

31+
@Override
3132
public IBackoff getBackoff()
3233
{
3334
return this.backoff;
3435
}
3536

37+
@Override
3638
public abstract boolean hasFailed(HostAddress address);
3739
}

presto-main/src/main/java/io/prestosql/operator/scalar/RowToRowCast.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import io.prestosql.sql.gen.CallSiteBinder;
4343

4444
import java.lang.invoke.MethodHandle;
45+
import java.nio.charset.StandardCharsets;
4546
import java.util.List;
4647

4748
import static com.google.common.base.Preconditions.checkArgument;
@@ -102,7 +103,7 @@ private static Class<?> generateRowCast(Type fromType, Type toType, FunctionAndT
102103

103104
// Embed the MD5 hash code of input and output types into the generated class name instead of the raw type names,
104105
// which could prevent the class name from hitting the length limitation and invalid characters.
105-
byte[] md5Suffix = Hashing.md5().hashBytes((fromType + "$" + toType).getBytes()).asBytes();
106+
byte[] md5Suffix = Hashing.md5().hashBytes((fromType + "$" + toType).getBytes(StandardCharsets.UTF_8)).asBytes();
106107

107108
ClassDefinition definition = new ClassDefinition(
108109
a(PUBLIC, FINAL),

presto-main/src/main/java/io/prestosql/server/remotetask/Backoff.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ public Backoff(int minTries, Duration maxFailureInterval, Ticker ticker, List<Du
7272
.toArray();
7373
}
7474

75+
@Override
7576
public synchronized long getFailureCount()
7677
{
7778
return failureCount;
7879
}
7980

81+
@Override
8082
public synchronized Duration getFailureDuration()
8183
{
8284
if (firstFailureTime == 0) {
@@ -86,16 +88,19 @@ public synchronized Duration getFailureDuration()
8688
return new Duration(value, NANOSECONDS);
8789
}
8890

91+
@Override
8992
public synchronized Duration getFailureRequestTimeTotal()
9093
{
9194
return new Duration(max(0, failureRequestTimeTotal), NANOSECONDS);
9295
}
9396

97+
@Override
9498
public synchronized void startRequest()
9599
{
96100
lastRequestStart = ticker.read();
97101
}
98102

103+
@Override
99104
public synchronized void success()
100105
{
101106
lastRequestStart = 0;
@@ -118,6 +123,7 @@ protected synchronized void updateFailureCount()
118123
* @return true if the failure is considered permanent
119124
* min retried and maxErrorDuration is passed.
120125
*/
126+
@Override
121127
public synchronized boolean failure()
122128
{
123129
long now = ticker.read();
@@ -143,6 +149,7 @@ public synchronized boolean failure()
143149
return failureDuration >= maxFailureIntervalNanos;
144150
}
145151

152+
@Override
146153
public synchronized long getBackoffDelayNanos()
147154
{
148155
int tmpFailureCount = (int) min(backoffDelayIntervalsNanos.length, getFailureCount());

presto-main/src/main/java/io/prestosql/spiller/GenericPartitioningSpiller.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ private synchronized SingleStreamSpiller getSpiller(int partition)
267267
return spiller.get();
268268
}
269269

270+
@Override
270271
public Set<Integer> getSpilledPartitions()
271272
{
272273
return spilledPartitions;

presto-redis/src/main/java/io/prestosql/plugin/redis/RedisMetadata.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public RedisTableHandle getTableHandle(final ConnectorSession session, final Sch
120120
keyName);
121121
}
122122

123+
@Override
123124
public ConnectorTableMetadata getTableMetadata(final ConnectorSession session, final ConnectorTableHandle tableHandle)
124125
{
125126
SchemaTableName schemaTableName = ((RedisTableHandle) tableHandle).toSchemaTableName();
@@ -217,6 +218,7 @@ public ColumnMetadata getColumnMetadata(final ConnectorSession session, final Co
217218
return ((RedisColumnHandle) columnHandle).getColumnMetadata();
218219
}
219220

221+
@Override
220222
public boolean usesLegacyTableLayouts()
221223
{
222224
return false;

presto-redis/src/main/java/io/prestosql/plugin/redis/record/RedisRecordSetProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public RedisRecordSetProvider(
5454
this.jedisManager = requireNonNull(jedisManager, "jedisManager is null");
5555
}
5656

57+
@Override
5758
public RecordSet getRecordSet(
5859
final ConnectorTransactionHandle transaction,
5960
final ConnectorSession session,

presto-spi/src/main/java/io/prestosql/spi/function/BuiltInScalarFunctionImplementation.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public BuiltInScalarFunctionImplementation(List<ScalarImplementationChoice> choi
7575
this.choices = ImmutableList.copyOf(choices);
7676
}
7777

78+
@Override
7879
public boolean isNullable()
7980
{
8081
return choices.get(0).isNullable();
@@ -85,6 +86,7 @@ public ArgumentProperty getArgumentProperty(int argumentIndex)
8586
return choices.get(0).argumentProperties.get(argumentIndex);
8687
}
8788

89+
@Override
8890
public MethodHandle getMethodHandle()
8991
{
9092
return choices.get(0).methodHandle;

presto-spi/src/test/java/io/prestosql/spi/block/VariableWidthBlockTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private BloomFilter getBf(int size)
8888

8989
BloomFilter bf = new BloomFilter(size, 0.01);
9090
for (int i = 0; i < 100; i++) {
91-
bf.test(("value" + rnd.nextLong()).getBytes());
91+
bf.test(("value" + rnd.nextLong()).getBytes(StandardCharsets.UTF_8));
9292
}
9393
return bf;
9494
}

0 commit comments

Comments
 (0)