Skip to content

Commit

Permalink
Move string literals to the left hand side of the expression in a few…
Browse files Browse the repository at this point in the history
… places
  • Loading branch information
coheigea committed Nov 12, 2018
1 parent 8c99d2f commit 2b95624
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void process(ProcessContext ctxt) {
PTransformNode leftRoot = null;
PTransformNode rightRoot = null;
for (PTransformNode root : fusedQP.getRootTransforms()) {
if (root.getId().equals("left")) {
if ("left".equals(root.getId())) {
leftRoot = root;
} else {
rightRoot = root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public MutableNetwork<Node, Edge> forNetwork(MutableNetwork<Node, Edge> network)

// Skip ParDoInstruction nodes that contain payloads without side inputs.
String userFnClassName = userFnSpec.getClassName();
if (userFnClassName.equals("CombineValuesFn") || userFnClassName.equals("KeyedCombineFn")) {
if ("CombineValuesFn".equals(userFnClassName) || "KeyedCombineFn".equals(userFnClassName)) {
continue; // These nodes have CombinePayloads which have no side inputs.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public Node apply(MutableNetwork<Node, Edge> input) {
CloudObject userFnSpec = CloudObject.fromSpec(parDoInstruction.getUserFn());
String userFnClassName = userFnSpec.getClassName();

if (userFnClassName.equals("CombineValuesFn") || userFnClassName.equals("KeyedCombineFn")) {
if ("CombineValuesFn".equals(userFnClassName) || "KeyedCombineFn".equals(userFnClassName)) {
transformSpec = transformCombineValuesFnToFunctionSpec(userFnSpec);
ptransformIdToPCollectionViews.put(ptransformId, Collections.emptyList());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public GrpcWindmillServer(StreamingDataflowWorkerOptions options) throws IOExcep
} else if (!streamingEngineEnabled() && options.getLocalWindmillHostport() != null) {
int portStart = options.getLocalWindmillHostport().lastIndexOf(':');
String endpoint = options.getLocalWindmillHostport().substring(0, portStart);
assert (endpoint.equals("grpc:localhost"));
assert ("grpc:localhost".equals(endpoint));
int port = Integer.parseInt(options.getLocalWindmillHostport().substring(portStart + 1));
this.endpoints = ImmutableSet.<HostAndPort>of(HostAndPort.fromParts("localhost", port));
initializeLocalHost(port);
Expand Down Expand Up @@ -308,7 +308,7 @@ private synchronized void initializeWindmillService(Set<HostAndPort> endpoints)
this.syncStubList.clear();
this.endpoints = ImmutableSet.<HostAndPort>copyOf(endpoints);
for (HostAndPort endpoint : this.endpoints) {
if (endpoint.getHostText().equals("localhost")) {
if ("localhost".equals(endpoint.getHostText())) {
initializeLocalHost(endpoint.getPort());
} else {
CallCredentials creds =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void testCheckpoint() throws Exception {
@Override
public void process(Object elem) throws Exception {
ReadOperation readOperation = readOperationHolder[0];
if (elem.equals("1")) {
if ("1".equals(elem)) {
NativeReader.DynamicSplitResultWithPosition split =
(NativeReader.DynamicSplitResultWithPosition) readOperation.requestCheckpoint();
assertNotNull(split);
Expand Down Expand Up @@ -307,7 +307,7 @@ public void testDynamicSplit() throws Exception {
@Override
public void process(Object elem) throws Exception {
ReadOperation readOperation = operationHolder[0];
if (elem.equals("1")) {
if ("1".equals(elem)) {
NativeReader.DynamicSplitResultWithPosition split =
(NativeReader.DynamicSplitResultWithPosition)
readOperation.requestDynamicSplit(splitRequestAtIndex(8L));
Expand All @@ -318,7 +318,7 @@ public void process(Object elem) throws Exception {
ApproximateReportedProgress progress =
readerProgressToCloudProgress(readOperation.getProgress());
assertEquals(1, progress.getPosition().getRecordIndex().longValue());
} else if (elem.equals("3")) {
} else if ("3".equals(elem)) {
// Should accept a split at an earlier position than previously requested.
// Should reject a split at a later position than previously requested.
// Note that here we're testing our own MockReaderIterator class, so it's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ private Object getTypedCellValue(TableFieldSchema fieldSchema, Object v) {
return values.build();
}

if (fieldSchema.getType().equals("RECORD")) {
if ("RECORD".equals(fieldSchema.getType())) {
@SuppressWarnings("unchecked")
Map<String, Object> typedV = (Map<String, Object>) v;
return getTypedTableRow(fieldSchema.getFields(), typedV);
}

if (fieldSchema.getType().equals("FLOAT")) {
if ("FLOAT".equals(fieldSchema.getType())) {
return Double.parseDouble((String) v);
}

if (fieldSchema.getType().equals("BOOLEAN")) {
if ("BOOLEAN".equals(fieldSchema.getType())) {
return Boolean.parseBoolean((String) v);
}

if (fieldSchema.getType().equals("TIMESTAMP")) {
if ("TIMESTAMP".equals(fieldSchema.getType())) {
return (String) v;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testConvertGenericRecordToTableRow() throws Exception {
List<Schema.Field> avroFields = new ArrayList<>();
for (Schema.Field field : AvroCoder.of(Bird.class).getSchema().getFields()) {
Schema schema = field.schema();
if (field.name().equals("birthdayMoney")) {
if ("birthdayMoney".equals(field.name())) {
// birthdayMoney is a nullable field with type BYTES/DECIMAL.
schema =
Schema.createUnion(
Expand Down

0 comments on commit 2b95624

Please sign in to comment.