Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.beam.runners.spark.metrics;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import org.apache.beam.runners.core.metrics.MetricsContainerStepMap;
import org.apache.beam.runners.spark.SparkPipelineOptions;
Expand Down Expand Up @@ -82,6 +83,10 @@ public static void init(SparkPipelineOptions opts, JavaSparkContext jsc) {
}
}

@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Spark merges only the accumulator instance the driver registered. A copy would collect metrics that nothing reports.")
public static MetricsContainerStepMapAccumulator getInstance() {
if (instance == null) {
throw new IllegalStateException("Metrics accumulator has not been instantiated");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.beam.runners.spark.structuredstreaming.metrics;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.beam.runners.core.metrics.MetricsContainerStepMap;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.annotations.VisibleForTesting;
import org.apache.spark.sql.SparkSession;
Expand Down Expand Up @@ -85,6 +86,10 @@ public MetricsContainerStepMap value() {
* Get the {@link MetricsAccumulator} on this driver. If there's no such accumulator yet, it will
* be created and registered using the provided {@link SparkSession}.
*/
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Spark merges only the accumulator instance the driver registered. A copy would collect metrics that nothing reports.")
public static MetricsAccumulator getInstance(SparkSession session) {
MetricsAccumulator current = instance;
if (current != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

<!-- TODO(https://github.com/apache/beam/issues/35312) resolve findings-->
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
<Bug pattern="MS_EXPOSE_REP"/>

<!--
Many test classes are captured by lambdas and marked `implements Serializable`. They are not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkNotNull;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -122,6 +123,10 @@ private static Lineage createLineage(PipelineOptions options, LineageDirection d
}

/** {@link Lineage} representing sources and optionally side inputs. */
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Every reporter writes into the same metric cell, so all callers need the one shared instance. A copy would drop the lineage it records.")
public static Lineage getSources() {
Lineage localSources = sources;
if (localSources == null) {
Expand All @@ -131,6 +136,10 @@ public static Lineage getSources() {
}

/** {@link Lineage} representing sinks. */
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Every reporter writes into the same metric cell, so all callers need the one shared instance. A copy would drop the lineage it records.")
public static Lineage getSinks() {
Lineage localSinks = sinks;
if (localSinks == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.beam.sdk.metrics;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Joiner;

/** Standard {@link org.apache.beam.sdk.io.Source} Metrics. */
Expand Down Expand Up @@ -69,6 +70,10 @@ public static Counter bytesReadBySplit(String splitId) {
}

/** Gauge for source backlog in bytes. */
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"A Gauge is a handle onto one metric cell, not a value. A copy would send the reading nowhere.")
public static Gauge backlogBytes() {
return BACKLOG_BYTES_GAUGE;
}
Expand All @@ -84,6 +89,10 @@ public static Gauge backlogBytesOfSplit(String splitId) {
}

/** Gauge for source backlog in elements. */
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"A Gauge is a handle onto one metric cell, not a value. A copy would send the reading nowhere.")
public static Gauge backlogElements() {
return BACKLOG_ELEMENTS_GAUGE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkState;

import com.google.auto.value.AutoValue;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Set;
import org.apache.beam.model.pipeline.v1.RunnerApi.Coder;
import org.apache.beam.model.pipeline.v1.RunnerApi.FunctionSpec;
Expand Down Expand Up @@ -97,6 +98,12 @@ private ModelCoders() {}
SHARDED_KEY_CODER_URN,
NULLABLE_CODER_URN);

@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Returns a Guava ImmutableSet."
+ " Spotbugs matches its known-immutable list by fully qualified name, so it cannot recognise collections relocated into org.apache.beam.vendor.guava."
+ " See https://github.com/spotbugs/spotbugs/issues/1601.")
public static Set<String> urns() {
return MODEL_CODER_URNS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.apache.beam.sdk.util.construction.BeamUrns.getUrn;
import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkState;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -417,6 +418,12 @@ public RunnerApi.PTransform translate(
knownPayloadTranslators;

@Internal
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Returns a Guava ImmutableMap."
+ " Spotbugs matches its known-immutable list by fully qualified name, so it cannot recognise collections relocated into org.apache.beam.vendor.guava."
+ " See https://github.com/spotbugs/spotbugs/issues/1601.")
public static Map<Class<? extends PTransform>, TransformPayloadTranslator>
getKnownPayloadTranslators() {
if (knownPayloadTranslators == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static java.util.Collections.unmodifiableMap;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
Expand Down Expand Up @@ -121,6 +122,10 @@ private ThriftSchema(Map<String, FieldType> typedefs) {
*
* @see #custom() for how to manually pass the beam type for container typedefs
*/
@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"The default provider holds an empty typedef map that is never mutated. Callers needing typedefs go through custom(), which builds a separate instance.")
public static @NonNull SchemaProvider provider() {
return defaultProvider;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.beam.sdk.testutils;

import com.google.cloud.bigquery.LegacySQLTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Map;
import org.apache.beam.sdk.testutils.publishing.InfluxDBPublisher;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -83,6 +84,12 @@ public Map<String, Object> toMap() {
.build();
}

@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Returns a Guava ImmutableMap."
+ " Spotbugs matches its known-immutable list by fully qualified name, so it cannot recognise collections relocated into org.apache.beam.vendor.guava."
+ " See https://github.com/spotbugs/spotbugs/issues/1601.")
public static Map<String, String> getSchema() {
return schema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
*/
package org.apache.beam.sdk.tpcds;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap;

@SuppressFBWarnings(
value = "MS_EXPOSE_REP",
justification =
"Fixed TPC-DS table definitions, built once at class load."
+ " Schema is mutable only through setUUID, which no caller here uses, and copying twenty-four schemas on every accessor call would cost real time in a benchmark harness.")
public class TpcdsSchemas {
/**
* Get all tpcds table schemas automatically by reading json files. In this case all field will be
Expand Down
Loading