Skip to content

Commit b83b302

Browse files
authored
Merge pull request #7523: Apply spotless across Beam
2 parents 1891410 + 2662f2b commit b83b302

File tree

216 files changed

+642
-857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+642
-857
lines changed

examples/java/src/main/java/org/apache/beam/examples/WindowedWordCount.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ static void runWindowedWordCount(Options options) throws IOException {
186186
pipeline
187187
/* Read from the GCS file. */
188188
.apply(TextIO.read().from(options.getInputFile()))
189-
// Concept #2: Add an element timestamp, using an artificial time just to show windowing.
189+
// Concept #2: Add an element timestamp, using an artificial time just to show
190+
// windowing.
190191
// See AddTimestampFn for more detail on this.
191192
.apply(ParDo.of(new AddTimestampFn(minTimestamp, maxTimestamp)));
192193

examples/java/src/main/java/org/apache/beam/examples/common/ExampleUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ private static Bigquery.Builder newBigQueryClient(BigQueryOptions options) {
224224
Transport.getJsonFactory(),
225225
chainHttpRequestInitializer(
226226
options.getGcpCredential(),
227-
// Do not log 404. It clutters the output and is possibly even required by the caller.
227+
// Do not log 404. It clutters the output and is possibly even required by the
228+
// caller.
228229
new RetryHttpRequestInitializer(ImmutableList.of(404))))
229230
.setApplicationName(options.getAppName())
230231
.setGoogleClientRequestInitializer(options.getGoogleApiTrace());
@@ -237,7 +238,8 @@ private static Pubsub.Builder newPubsubClient(PubsubOptions options) {
237238
Transport.getJsonFactory(),
238239
chainHttpRequestInitializer(
239240
options.getGcpCredential(),
240-
// Do not log 404. It clutters the output and is possibly even required by the caller.
241+
// Do not log 404. It clutters the output and is possibly even required by the
242+
// caller.
241243
new RetryHttpRequestInitializer(ImmutableList.of(404))))
242244
.setRootUrl(options.getPubsubRootUrl())
243245
.setApplicationName(options.getAppName())

examples/java/src/main/java/org/apache/beam/examples/cookbook/TriggerExample.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
* and then exits.
123123
*/
124124
public class TriggerExample {
125-
//Numeric value of fixed window duration, in minutes
125+
// Numeric value of fixed window duration, in minutes
126126
public static final int WINDOW_DURATION = 30;
127127
// Constants used in triggers.
128128
// Speeding up ONE_MINUTE or FIVE_MINUTES helps you get an early approximation of results.
@@ -189,18 +189,22 @@ public PCollectionList<TableRow> expand(PCollection<KV<String, Integer>> flowInf
189189
.apply(
190190
"Default",
191191
Window
192-
// The default window duration values work well if you're running the default input
192+
// The default window duration values work well if you're running the default
193+
// input
193194
// file. You may want to adjust the window duration otherwise.
194195
.<KV<String, Integer>>into(
195196
FixedWindows.of(Duration.standardMinutes(windowDuration)))
196-
// The default trigger first emits output when the system's watermark passes the end
197+
// The default trigger first emits output when the system's watermark passes
198+
// the end
197199
// of the window.
198200
.triggering(Repeatedly.forever(AfterWatermark.pastEndOfWindow()))
199201
// Late data is dropped
200202
.withAllowedLateness(Duration.ZERO)
201203
// Discard elements after emitting each pane.
202-
// With no allowed lateness and the specified trigger there will only be a single
203-
// pane, so this doesn't have a noticeable effect. See concept 2 for more details.
204+
// With no allowed lateness and the specified trigger there will only be a
205+
// single
206+
// pane, so this doesn't have a noticeable effect. See concept 2 for more
207+
// details.
204208
.discardingFiredPanes())
205209
.apply(new TotalFlow("default"));
206210

@@ -229,7 +233,8 @@ public PCollectionList<TableRow> expand(PCollection<KV<String, Integer>> flowInf
229233
FixedWindows.of(Duration.standardMinutes(windowDuration)))
230234
// Late data is emitted as it arrives
231235
.triggering(Repeatedly.forever(AfterWatermark.pastEndOfWindow()))
232-
// Once the output is produced, the pane is dropped and we start preparing the next
236+
// Once the output is produced, the pane is dropped and we start preparing the
237+
// next
233238
// pane for the window
234239
.discardingFiredPanes()
235240
// Late data is handled up to one day
@@ -264,8 +269,10 @@ public PCollectionList<TableRow> expand(PCollection<KV<String, Integer>> flowInf
264269
AfterProcessingTime.pastFirstElementInPane()
265270
// Speculative every ONE_MINUTE
266271
.plusDelayOf(ONE_MINUTE)))
267-
// After emitting each pane, it will continue accumulating the elements so that each
268-
// approximation includes all of the previous data in addition to the newly arrived
272+
// After emitting each pane, it will continue accumulating the elements so
273+
// that each
274+
// approximation includes all of the previous data in addition to the newly
275+
// arrived
269276
// data.
270277
.accumulatingFiredPanes()
271278
.withAllowedLateness(ONE_DAY))
@@ -414,7 +421,7 @@ public void processElement(ProcessContext c) throws Exception {
414421
return;
415422
}
416423
if (laneInfo.length < VALID_NUM_FIELDS) {
417-
//Skip the invalid input.
424+
// Skip the invalid input.
418425
return;
419426
}
420427
String freeway = laneInfo[2];

examples/java/src/test/java/org/apache/beam/examples/complete/game/LeaderBoardTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ public void testTeamScoresSpeculative() {
129129
.addElements(
130130
event(TestUser.BLUE_ONE, 3, Duration.standardSeconds(3)),
131131
event(TestUser.BLUE_ONE, 2, Duration.standardMinutes(1)))
132-
// Some time passes within the runner, which causes a speculative pane containing the blue
132+
// Some time passes within the runner, which causes a speculative pane containing the
133+
// blue
133134
// team's score to be emitted
134135
.advanceProcessingTime(Duration.standardMinutes(10))
135136
.addElements(event(TestUser.RED_TWO, 5, Duration.standardMinutes(3)))
136137
// Some additional time passes and we get a speculative pane for the red team
137138
.advanceProcessingTime(Duration.standardMinutes(12))
138139
.addElements(event(TestUser.BLUE_TWO, 3, Duration.standardSeconds(22)))
139-
// More time passes and a speculative pane containing a refined value for the blue pane is
140+
// More time passes and a speculative pane containing a refined value for the blue pane
141+
// is
140142
// emitted
141143
.advanceProcessingTime(Duration.standardMinutes(10))
142144
// Some more events occur
@@ -238,7 +240,8 @@ public void testTeamScoresObservablyLate() {
238240
event(TestUser.RED_TWO, 2, Duration.ZERO),
239241
event(TestUser.RED_TWO, 5, Duration.standardMinutes(1)),
240242
event(TestUser.RED_TWO, 3, Duration.standardMinutes(3)))
241-
// A late refinement is emitted due to the advance in processing time, but the window has
243+
// A late refinement is emitted due to the advance in processing time, but the window
244+
// has
242245
// not yet closed because the watermark has not advanced
243246
.advanceProcessingTime(Duration.standardMinutes(12))
244247
// These elements should appear in the final pane
@@ -303,7 +306,8 @@ public void testTeamScoresDroppablyLate() {
303306
.plus(ALLOWED_LATENESS)
304307
.plus(TEAM_WINDOW_DURATION)
305308
.plus(Duration.standardMinutes(1)))
306-
// These elements within the expired window are droppably late, and will not appear in the
309+
// These elements within the expired window are droppably late, and will not appear in
310+
// the
307311
// output
308312
.addElements(
309313
event(

runners/apex/src/main/java/org/apache/beam/runners/apex/TestApexRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class TestApexRunner extends PipelineRunner<ApexRunnerResult> {
3333

3434
private TestApexRunner(ApexPipelineOptions options) {
3535
options.setEmbeddedExecution(true);
36-
//options.setEmbeddedExecutionDebugMode(false);
36+
// options.setEmbeddedExecutionDebugMode(false);
3737
this.delegate = ApexRunner.fromOptions(options);
3838
}
3939

runners/apex/src/main/java/org/apache/beam/runners/apex/translation/ParDoTranslator.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ public void translate(ParDo.MultiOutput<InputT, OutputT> transform, TranslationC
7777
List<PCollectionView<?>> sideInputs = transform.getSideInputs();
7878

7979
Map<TupleTag<?>, Coder<?>> outputCoders =
80-
outputs
81-
.entrySet()
82-
.stream()
80+
outputs.entrySet().stream()
8381
.filter(e -> e.getValue() instanceof PCollection)
8482
.collect(
8583
Collectors.toMap(e -> e.getKey(), e -> ((PCollection) e.getValue()).getCoder()));
@@ -138,9 +136,7 @@ public void translate(
138136
List<PCollectionView<?>> sideInputs = transform.getSideInputs();
139137

140138
Map<TupleTag<?>, Coder<?>> outputCoders =
141-
outputs
142-
.entrySet()
143-
.stream()
139+
outputs.entrySet().stream()
144140
.filter(e -> e.getValue() instanceof PCollection)
145141
.collect(
146142
Collectors.toMap(e -> e.getKey(), e -> ((PCollection) e.getValue()).getCoder()));
@@ -221,8 +217,8 @@ private static PCollection<?> unionSideInputs(
221217
.getWindowingStrategy()
222218
.equals(firstSideInput.getWindowingStrategy())) {
223219
// TODO: check how to handle this in stream codec
224-
//String msg = "Multiple side inputs with different window strategies.";
225-
//throw new UnsupportedOperationException(msg);
220+
// String msg = "Multiple side inputs with different window strategies.";
221+
// throw new UnsupportedOperationException(msg);
226222
LOG.warn(
227223
"Side inputs union with different windowing strategies {} {}",
228224
firstSideInput.getWindowingStrategy(),

runners/apex/src/main/java/org/apache/beam/runners/apex/translation/operators/ApexParDoOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ private void processWatermark(ApexStreamTuple.WatermarkTuple<?> mark) {
382382
checkState(
383383
minEventTimeTimer >= currentInputWatermark,
384384
"Event time timer processing generates new timer(s) behind watermark.");
385-
//LOG.info("Processing time timer {} registered behind watermark {}", minProcessingTimeTimer,
385+
// LOG.info("Processing time timer {} registered behind watermark {}", minProcessingTimeTimer,
386386
// currentInputWatermark);
387387

388388
// TODO: is this the right way to trigger processing time timers?

runners/apex/src/test/java/org/apache/beam/runners/apex/ApexYarnLauncherTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public void testGetYarnDeployDependencies() throws Exception {
5656
List<File> deps = ApexYarnLauncher.getYarnDeployDependencies();
5757
String depsToString = deps.toString();
5858
// the beam dependencies are not present as jar when running within the Maven build reactor
59-
//assertThat(depsToString, containsString("beam-runners-core-"));
60-
//assertThat(depsToString, containsString("beam-runners-apex-"));
59+
// assertThat(depsToString, containsString("beam-runners-core-"));
60+
// assertThat(depsToString, containsString("beam-runners-apex-"));
6161
assertThat(depsToString, containsString("apex-common-"));
6262
assertThat(depsToString, not(containsString("hadoop-")));
6363
assertThat(depsToString, not(containsString("zookeeper-")));

runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/CombineTranslation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public static class Registrar implements TransformPayloadTranslatorRegistrar {
9292
/** Produces a {@link RunnerApi.CombinePayload} from a {@link Combine}. */
9393
static <K, InputT, OutputT> CombinePayload payloadForCombine(
9494
final AppliedPTransform<
95-
PCollection<KV<K, InputT>>, PCollection<KV<K, OutputT>>,
95+
PCollection<KV<K, InputT>>,
96+
PCollection<KV<K, OutputT>>,
9697
Combine.PerKey<K, InputT, OutputT>>
9798
combine,
9899
final SdkComponents components)

runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/CreatePCollectionViewTranslation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public class CreatePCollectionViewTranslation {
5353
@Deprecated
5454
public static <ElemT, ViewT> PCollectionView<ViewT> getView(
5555
AppliedPTransform<
56-
PCollection<ElemT>, PCollection<ElemT>,
56+
PCollection<ElemT>,
57+
PCollection<ElemT>,
5758
PTransform<PCollection<ElemT>, PCollection<ElemT>>>
5859
application)
5960
throws IOException {

0 commit comments

Comments
 (0)