Skip to content

Commit 27d38bf

Browse files
elharotdcmeehan
authored andcommitted
Remove format() calls for constant strings with no arguments
1 parent 4bdd580 commit 27d38bf

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

presto-bigquery/src/main/java/com/facebook/presto/plugin/bigquery/BigQuerySplitManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static com.facebook.presto.plugin.bigquery.BigQueryErrorCode.BIGQUERY_FAILED_TO_EXECUTE_QUERY;
3737
import static com.google.cloud.bigquery.storage.v1beta1.Storage.ReadSession;
3838
import static com.google.common.collect.ImmutableList.toImmutableList;
39-
import static java.lang.String.format;
4039
import static java.util.Objects.requireNonNull;
4140
import static java.util.stream.Collectors.toList;
4241
import static java.util.stream.IntStream.range;
@@ -131,7 +130,7 @@ private List<BigQuerySplit> createEmptyProjection(TableId tableId, int actualPar
131130
return splits;
132131
}
133132
catch (BigQueryException e) {
134-
throw new PrestoException(BIGQUERY_FAILED_TO_EXECUTE_QUERY, format("Failed to compute empty projection"), e);
133+
throw new PrestoException(BIGQUERY_FAILED_TO_EXECUTE_QUERY, "Failed to compute empty projection", e);
135134
}
136135
}
137136
}

presto-druid/src/main/java/com/facebook/presto/druid/segment/SmooshedColumnSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private void loadSmooshFileMetadata()
8282
BufferedReader in = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(metadata)));
8383
String line = in.readLine();
8484
if (line == null) {
85-
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Malformed metadata file: first line should be version,maxChunkSize,numChunks, got null."));
85+
throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, "Malformed metadata file: first line should be version,maxChunkSize,numChunks, got null.");
8686
}
8787

8888
String[] splits = line.split(",");

presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ protected ScalarFunctionImplementation sqlInvokedFunctionToImplementation(SqlInv
331331
throw new IllegalStateException(
332332
format("SqlInvokedFunction %s has BUILTIN implementation type but %s cannot manage BUILTIN functions", function.getSignature().getName(), this.getClass()));
333333
case CPP:
334-
throw new IllegalStateException(format("Presto coordinator can not resolve implementation of CPP UDF functions"));
334+
throw new IllegalStateException("Presto coordinator can not resolve implementation of CPP UDF functions");
335335
default:
336336
throw new IllegalStateException(format("Unknown function implementation type: %s", implementationType));
337337
}

presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3509,7 +3509,7 @@ protected Optional<TableEncryptionProperties> getTableEncryptionPropertiesFromTa
35093509
}
35103510

35113511
if (seenColumns.contains(columnWithSubfield.toString())) {
3512-
throw new PrestoException(INVALID_TABLE_PROPERTY, format("The same column/subfield cannot have 2 encryption keys"));
3512+
throw new PrestoException(INVALID_TABLE_PROPERTY, "The same column/subfield cannot have 2 encryption keys");
35133513
}
35143514

35153515
if (columnWithSubfield.getSubfieldPath().isPresent()) {

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveIntegrationSmokeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6395,7 +6395,7 @@ public void testAddTableConstraints()
63956395

63966396
// Negative tests
63976397
assertQueryFails(addPrimaryKeyStmt, format("Primary key already exists for: %s.%s", getSession().getSchema().get(), tableName));
6398-
assertQueryFails(addUniqueConstraintStmt, format("Constraint already exists: 'uq3'"));
6398+
assertQueryFails(addUniqueConstraintStmt, "Constraint already exists: 'uq3'");
63996399
String dropNonExistentConstraint = format("ALTER TABLE %s.%s.%s DROP CONSTRAINT missingconstraint", getSession().getCatalog().get(), getSession().getSchema().get(), tableName);
64006400
assertQueryFails(dropNonExistentConstraint, "Constraint 'missingconstraint' not found");
64016401

presto-native-execution/src/test/java/com/facebook/presto/nativeworker/PrestoNativeQueryRunnerUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public static Optional<BiFunction<Integer, URI, Process>> getExternalWorkerLaunc
466466
}
467467
else {
468468
Files.write(catalogDirectoryPath.resolve(format("%s.properties", catalogName)),
469-
format("connector.name=hive").getBytes());
469+
"connector.name=hive".getBytes());
470470
}
471471
// Add catalog with caching always enabled.
472472
Files.write(catalogDirectoryPath.resolve(format("%scached.properties", catalogName)),

presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotBrokerPageSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public int populateFromQueryResults(
391391
throw new PinotException(
392392
PINOT_UNEXPECTED_RESPONSE,
393393
Optional.of(sql),
394-
String.format("Expected data schema in the response"));
394+
"Expected data schema in the response");
395395
}
396396
JsonNode columnDataTypes = dataSchema.get("columnDataTypes");
397397
JsonNode columnNames = dataSchema.get("columnNames");

presto-spark-base/src/test/java/com/facebook/presto/spark/TestPrestoSparkQueryRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ public void testZeroFileCreatorForBucketedTable()
133133
{
134134
assertUpdate(
135135
getSession(),
136-
format("CREATE TABLE hive.hive_test.test_hive_orders_bucketed_join_zero_file WITH (bucketed_by=array['orderkey'], bucket_count=8) AS " +
136+
"CREATE TABLE hive.hive_test.test_hive_orders_bucketed_join_zero_file WITH (bucketed_by=array['orderkey'], bucket_count=8) AS " +
137137
"SELECT orderkey, custkey, orderstatus, totalprice, orderdate, orderpriority, clerk, shippriority, comment " +
138138
"FROM orders_bucketed " +
139-
"WHERE orderkey = 1"),
139+
"WHERE orderkey = 1",
140140
1);
141141
}
142142

0 commit comments

Comments
 (0)