Skip to content

Commit 8ca4bf2

Browse files
authored
Fix lint errors (#3440)
1 parent de824ee commit 8ca4bf2

File tree

6 files changed

+59
-31
lines changed

6 files changed

+59
-31
lines changed

dataflow/encryption-keys/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2020
<modelVersion>4.0.0</modelVersion>
2121

22+
<parent>
23+
<groupId>com.google.cloud.samples</groupId>
24+
<artifactId>shared-configuration</artifactId>
25+
<version>1.0.17</version>
26+
</parent>
27+
2228
<groupId>com.example</groupId>
2329
<artifactId>dataflow-bigquery-kms-key</artifactId>
2430
<version>1.0</version>

dataflow/encryption-keys/src/main/java/com/example/dataflow/cmek/BigQueryKmsKey.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import com.google.api.services.bigquery.model.TableSchema;
1919
import java.util.Arrays;
2020
import org.apache.beam.sdk.Pipeline;
21-
import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.Write.WriteDisposition;
2221
import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO;
22+
import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.Write.WriteDisposition;
2323
import org.apache.beam.sdk.options.Description;
2424
import org.apache.beam.sdk.options.PipelineOptions;
2525
import org.apache.beam.sdk.options.PipelineOptionsFactory;
@@ -29,10 +29,12 @@ public class BigQueryKmsKey {
2929
public interface BigQueryKmsKeyOptions extends PipelineOptions {
3030
@Description("Cloud Key Management Service key name")
3131
String getKmsKey();
32+
3233
void setKmsKey(String value);
3334

3435
@Description("Output BigQuery table spec in the format 'PROJECT:DATASET.TABLE'")
3536
String getOutputBigQueryTable();
37+
3638
void setOutputBigQueryTable(String value);
3739
}
3840

@@ -41,9 +43,9 @@ public static void main(String[] args) {
4143
// Query from the NASA wildfires public dataset:
4244
// https://console.cloud.google.com/bigquery?p=bigquery-public-data&d=nasa_wildfire&t=past_week&page=table
4345
String query =
44-
"SELECT latitude,longitude,acq_date,acq_time,bright_ti4,confidence " +
45-
"FROM `bigquery-public-data.nasa_wildfire.past_week` " +
46-
"LIMIT 10";
46+
"SELECT latitude,longitude,acq_date,acq_time,bright_ti4,confidence "
47+
+ "FROM `bigquery-public-data.nasa_wildfire.past_week` "
48+
+ "LIMIT 10";
4749

4850
// Schema for the output BigQuery table.
4951
final TableSchema outputSchema = new TableSchema().setFields(Arrays.asList(
@@ -61,7 +63,8 @@ public static void main(String[] args) {
6163
// String outputBigQueryTable = "<project>:<dataset>.<table>";
6264
String outputBigQueryTable = options.getOutputBigQueryTable();
6365

64-
// String kmsKey = "projects/<project>/locations/<kms-location>/keyRings/<kms-keyring>/cryptoKeys/<kms-key>";
66+
// String kmsKey =
67+
// "projects/<project>/locations/<kms-location>/keyRings/<kms-keyring>/cryptoKeys/<kms-key>";
6568
String kmsKey = options.getKmsKey();
6669

6770
// Create and run an Apache Beam pipeline.

dataflow/flex-templates/kafka_to_bigquery/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2020
<modelVersion>4.0.0</modelVersion>
2121

22+
<parent>
23+
<groupId>com.google.cloud.samples</groupId>
24+
<artifactId>shared-configuration</artifactId>
25+
<version>1.0.17</version>
26+
</parent>
27+
2228
<groupId>org.apache.beam.samples</groupId>
2329
<artifactId>kafka-to-bigquery</artifactId>
2430
<version>1.0</version>

dataflow/flex-templates/kafka_to_bigquery/src/main/java/org/apache/beam/samples/KafkaToBigQuery.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*/
18-
package org.apache.beam.samples;
1+
// Copyright 2019 Google Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1914

20-
import java.util.Arrays;
15+
package org.apache.beam.samples;
2116

2217
import com.google.api.services.bigquery.model.TableFieldSchema;
2318
import com.google.api.services.bigquery.model.TableRow;
2419
import com.google.api.services.bigquery.model.TableSchema;
2520
import com.google.gson.Gson;
26-
21+
import java.util.Arrays;
2722
import org.apache.avro.reflect.Nullable;
2823
import org.apache.beam.sdk.Pipeline;
2924
import org.apache.beam.sdk.coders.AvroCoder;
@@ -61,16 +56,20 @@ public interface Options extends StreamingOptions {
6156
@Description("Apache Kafka topic to read from.")
6257
@Validation.Required
6358
String getInputTopic();
59+
6460
void setInputTopic(String value);
6561

66-
@Description("BigQuery table to write to, in the form 'project:dataset.table' or 'dataset.table'.")
62+
@Description(
63+
"BigQuery table to write to, in the form 'project:dataset.table' or 'dataset.table'.")
6764
@Default.String("beam_samples.streaming_beam_sql")
6865
String getOutputTable();
66+
6967
void setOutputTable(String value);
7068

7169
@Description("Apache Kafka bootstrap servers in the form 'hostname:port'.")
7270
@Default.String("localhost:9092")
7371
String getBootstrapServer();
72+
7473
void setBootstrapServer(String value);
7574
}
7675

@@ -103,7 +102,8 @@ public static void main(final String[] args) {
103102
.apply("Parse JSON", MapElements.into(TypeDescriptor.of(PageRating.class))
104103
.via(message -> GSON.fromJson(message, PageRating.class)))
105104

106-
.apply("Add processing time", WithTimestamps.of((pageRating) -> new Instant(pageRating.processingTime)))
105+
.apply("Add processing time", WithTimestamps
106+
.of((pageRating) -> new Instant(pageRating.processingTime)))
107107
.apply("Fixed-size windows", Window.into(FixedWindows.of(Duration.standardMinutes(1))))
108108

109109
.apply("Convert to BigQuery TableRow", MapElements.into(TypeDescriptor.of(TableRow.class))

dataflow/templates/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2020
<modelVersion>4.0.0</modelVersion>
2121

22+
<parent>
23+
<groupId>com.google.cloud.samples</groupId>
24+
<artifactId>shared-configuration</artifactId>
25+
<version>1.0.17</version>
26+
</parent>
27+
2228
<groupId>com.example</groupId>
2329
<artifactId>dataflow-templates</artifactId>
2430
<version>1.0</version>

dataflow/templates/src/main/java/com/example/dataflow/templates/WordCount.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414

1515
package com.example.dataflow.templates;
1616

17+
import java.util.Arrays;
1718
import org.apache.beam.sdk.Pipeline;
1819
import org.apache.beam.sdk.io.TextIO;
19-
import org.apache.beam.sdk.options.*;
20+
import org.apache.beam.sdk.options.Default;
21+
import org.apache.beam.sdk.options.Description;
22+
import org.apache.beam.sdk.options.PipelineOptions;
23+
import org.apache.beam.sdk.options.PipelineOptionsFactory;
24+
import org.apache.beam.sdk.options.ValueProvider;
2025
import org.apache.beam.sdk.options.ValueProvider.NestedValueProvider;
2126
import org.apache.beam.sdk.options.ValueProvider.StaticValueProvider;
2227
import org.apache.beam.sdk.transforms.Count;
@@ -28,8 +33,6 @@
2833
import org.apache.beam.sdk.values.KV;
2934
import org.apache.beam.sdk.values.TypeDescriptors;
3035

31-
import java.util.Arrays;
32-
3336

3437
public class WordCount {
3538
// [START word_count_options]
@@ -38,23 +41,27 @@ public interface WordCountOptions extends PipelineOptions {
3841
@Description("Google Cloud Storage file pattern glob of the file(s) to read from")
3942
@Default.String("gs://apache-beam-samples/shakespeare/kinglear.txt")
4043
ValueProvider<String> getInputFile();
44+
4145
void setInputFile(ValueProvider<String> value);
4246

4347
// Required argument (made required via the metadata file).
4448
@Description("Google Cloud Storage bucket to store the outputs")
4549
ValueProvider<String> getOutputBucket();
50+
4651
void setOutputBucket(ValueProvider<String> value);
4752

4853
// Optional argument.
4954
@Description("Filter only words containing the specified substring")
5055
@Default.String("")
5156
ValueProvider<String> getWithSubstring();
57+
5258
void setWithSubstring(ValueProvider<String> value);
5359

5460
// Template option available only at template creation.
5561
@Description("Whether to make it case sensitive or not")
5662
@Default.Boolean(true)
5763
Boolean getIsCaseSensitive();
64+
5865
void setIsCaseSensitive(Boolean value);
5966
}
6067
// [END word_count_options]
@@ -112,7 +119,7 @@ public static void main(String[] args) {
112119
options.getOutputBucket(),
113120
(String bucket) -> String.format("gs://%s/samples/dataflow/wordcount/outputs", bucket)
114121
)));
115-
// [END nested_value_provider]
122+
// [END nested_value_provider]
116123
pipeline.run();
117124
}
118125
}

0 commit comments

Comments
 (0)