This is an automated email from the ASF dual-hosted git repository.

stankiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new b88e57e3437 [BEAM-20503] Replace inert nullness suppressions in 
BigQueryIOPushDownIT (#40301)
b88e57e3437 is described below

commit b88e57e3437d8f765bb07d43fcb3f7740c833ce6
Author: Nitin Ware <[email protected]>
AuthorDate: Tue Sep 29 07:54:56 2026 -0500

    [BEAM-20503] Replace inert nullness suppressions in BigQueryIOPushDownIT 
(#40301)
    
    The three @SuppressWarnings("initialization.*") annotations used misspelled
    keys (initialization.static.fields.uninitialized / 
initialization.fields.uninitialized,
    plural "fields") that never matched the checker's actual keys
    (...field.uninitialized, singular), so they suppressed nothing.
    
    Replace them with the idiomatic fix: mark the fields @MonotonicNonNull
    (set once in @BeforeClass/@Before, never nulled) and guard the read sites
    that occur in a different method with checkStateNotNull.
    
    Verified locally by temporarily enabling the nullness checker on this
    module's test sources (checkerFramework { excludeTests = false }) and
    running :sdks:java:extensions:sql:perf-tests:compileTestJava --rerun-tasks
    to BUILD SUCCESSFUL, then reverting the build change. CI does not re-verify
    because Beam excludes tests from the checker (BEAM-11436).
---
 .../meta/provider/bigquery/BigQueryIOPushDownIT.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/sdks/java/extensions/sql/perf-tests/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryIOPushDownIT.java
 
b/sdks/java/extensions/sql/perf-tests/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryIOPushDownIT.java
index c1fd5ad7b4c..6f02e1653f7 100644
--- 
a/sdks/java/extensions/sql/perf-tests/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryIOPushDownIT.java
+++ 
b/sdks/java/extensions/sql/perf-tests/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryIOPushDownIT.java
@@ -18,6 +18,7 @@
 package org.apache.beam.sdk.extensions.sql.meta.provider.bigquery;
 
 import static 
org.apache.beam.sdk.extensions.sql.impl.planner.BeamRuleSets.getRuleSets;
+import static org.apache.beam.sdk.util.Preconditions.checkStateNotNull;
 import static org.junit.Assert.assertNotEquals;
 
 import com.google.cloud.Timestamp;
@@ -49,6 +50,7 @@ import 
org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.plan.RelOptRule
 import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.tools.RuleSet;
 import 
org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.tools.RuleSets;
 import 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -88,17 +90,13 @@ public class BigQueryIOPushDownIT {
   private static final String SELECT_STATEMENT =
       "SELECT `by` as author, type, title, score from HACKER_NEWS where 
(type='story' or type='job') and score>2";
 
-  //  https://github.com/typetools/checker-framework/issues/1525
-  @SuppressWarnings("initialization.static.fields.uninitialized")
-  private static SQLBigQueryPerfTestOptions options;
+  private static @MonotonicNonNull SQLBigQueryPerfTestOptions options;
 
-  @SuppressWarnings("initialization.static.fields.uninitialized")
-  private static InfluxDBSettings settings;
+  private static @MonotonicNonNull InfluxDBSettings settings;
 
   @Rule public TestPipeline pipeline = TestPipeline.create();
 
-  @SuppressWarnings("initialization.fields.uninitialized")
-  private BeamSqlEnv sqlEnv;
+  private @MonotonicNonNull BeamSqlEnv sqlEnv;
 
   @BeforeClass
   public static void setUp() {
@@ -118,6 +116,7 @@ public class BigQueryIOPushDownIT {
 
   @Test
   public void readUsingDirectReadMethodPushDown() {
+    BeamSqlEnv sqlEnv = checkStateNotNull(this.sqlEnv);
     sqlEnv.executeDdl(String.format(CREATE_TABLE_STATEMENT, 
Method.DIRECT_READ));
 
     BeamRelNode beamRelNode = sqlEnv.parseQuery(SELECT_STATEMENT);
@@ -163,6 +162,7 @@ public class BigQueryIOPushDownIT {
 
   @Test
   public void readUsingDefaultMethod() {
+    BeamSqlEnv sqlEnv = checkStateNotNull(this.sqlEnv);
     sqlEnv.executeDdl(String.format(CREATE_TABLE_STATEMENT, Method.DEFAULT));
 
     BeamRelNode beamRelNode = sqlEnv.parseQuery(SELECT_STATEMENT);
@@ -183,7 +183,9 @@ public class BigQueryIOPushDownIT {
     Set<Function<MetricsReader, NamedTestResult>> readSuppliers = 
getReadSuppliers(uuid, timestamp);
     IOITMetrics readMetrics =
         new IOITMetrics(readSuppliers, readResult, NAMESPACE, uuid, timestamp);
-    
readMetrics.publishToInflux(settings.copyWithMeasurement(settings.measurement + 
postfix));
+    InfluxDBSettings currentSettings = checkStateNotNull(settings);
+    readMetrics.publishToInflux(
+        currentSettings.copyWithMeasurement(currentSettings.measurement + 
postfix));
   }
 
   private Set<Function<MetricsReader, NamedTestResult>> getReadSuppliers(

Reply via email to