Abacn commented on issue #33132:
URL: https://github.com/apache/beam/issues/33132#issuecomment-2480002050
A simple test: succeeded prior to the change, failing after the change:
```java
package org.apache.beam.runners.direct;
import com.google.auto.value.AutoValue;
import java.io.Serializable;
import org.apache.beam.sdk.coders.DefaultCoder;
import org.apache.beam.sdk.schemas.AutoValueSchema;
import org.apache.beam.sdk.schemas.SchemaCoder;
import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.transforms.SerializableFunction;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.apache.beam.sdk.values.TypeDescriptors;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class NullableEvaluationTest {
@Rule
public TestPipeline p = TestPipeline.create();
@Test
public void testConstruction() {
// Either annotated with @Nullable or not does not matter
p.apply(Create.of(KV.<String, @Nullable BigQueryTablePartition>of("123",
null)))
.apply(
"MapFileNames",
MapElements.into(TypeDescriptors.kvs(
TypeDescriptor.of(BigQueryTablePartition.class),
TypeDescriptor.of(String.class)))
.via((SerializableFunction<KV<String,
BigQueryTablePartition>, KV<BigQueryTablePartition, String>>) kv ->
KV.of(kv.getValue(), kv.getKey())));
p.run();
}
/** BigQuery table partition metadata. */
@AutoValue
@DefaultCoder(SchemaCoder.class)
@DefaultSchema(AutoValueSchema.class)
public abstract static class BigQueryTablePartition implements
Serializable {
public abstract String getPartitionName();
public static Builder builder() {
return new
AutoValue_NullableEvaluationTest_BigQueryTablePartition.Builder();
}
/** Builder for {@link BigQueryTablePartition}. */
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder setPartitionName(String value);
public abstract BigQueryTablePartition build();
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]