Skip to content
Open
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 @@ -18,6 +18,7 @@

import com.google.auto.value.AutoValue;
import java.io.Serializable;
import javax.annotation.Nullable;

@AutoValue
public abstract class BigLakeConfiguration implements Serializable {
Expand All @@ -30,13 +31,15 @@ public abstract class BigLakeConfiguration implements Serializable {
*
* @return value or {@code null} for none
*/
@Nullable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are actually trying to migrate to use JSpecify (timeline for full migration in handwritten libraries is not set). Is it possible to use the JSpecify nullable annotations instead of javax (atleast for new annotations)?

public abstract String getConnectionId();

/**
* Open source file format that the table data is stored in. Currently only PARQUET is supported.
*
* @return value or {@code null} for none
*/
@Nullable
public abstract String getFileFormat();

/**
Expand All @@ -45,13 +48,15 @@ public abstract class BigLakeConfiguration implements Serializable {
*
* @return value or {@code null} for none
*/
@Nullable
public abstract String getStorageUri();

/**
* Open source file format that the table data is stored in. Currently only PARQUET is supported.
* Open source table format that the table data is stored in. Currently only ICEBERG is supported.
*
* @return value or {@code null} for none
*/
@Nullable
public abstract String getTableFormat();
Comment thread
keshavdandeva marked this conversation as resolved.

public static Builder newBuilder() {
Expand All @@ -63,36 +68,36 @@ public static Builder newBuilder() {
@AutoValue.Builder
public abstract static class Builder {
/**
* [Required] Required and immutable. Credential reference for accessing external storage
* system. Normalized as project_id.location_id.connection_id.
* Immutable. Credential reference for accessing external storage system. Normalized as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: What does immutable mean in this case (on a setter)? do you think we can just remove it as it would be implied to not be changing when the class is built?

* project_id.location_id.connection_id.
*
* @param connectionId connectionId or {@code null} for none
*/
public abstract Builder setConnectionId(String connectionId);
public abstract Builder setConnectionId(@Nullable String connectionId);

/**
* [Required] Required and immutable. Open source file format that the table data is stored in.
* Currently only PARQUET is supported.
* Immutable. Open source file format that the table data is stored in. Currently only PARQUET
* is supported.
*
* @param fileFormat fileFormat or {@code null} for none
*/
public abstract Builder setFileFormat(String fileFormat);
public abstract Builder setFileFormat(@Nullable String fileFormat);

/**
* [Required] Required and immutable. Fully qualified location prefix of the external folder
* where data is stored. Starts with "gs://" and ends with "/". Does not contain "*".
* Immutable. Fully qualified location prefix of the external folder where data is stored.
* Starts with "gs://" and ends with "/". Does not contain "*".
*
* @param storageUri storageUri or {@code null} for none
*/
public abstract Builder setStorageUri(String storageUri);
public abstract Builder setStorageUri(@Nullable String storageUri);

/**
* [Required] Required and immutable. Open source file format that the table data is stored in.
* Currently only PARQUET is supported.
* Immutable. Open source table format that the table data is stored in. Currently only ICEBERG
* is supported.
*
* @param tableFormat tableFormat or {@code null} for none
*/
public abstract Builder setTableFormat(String tableFormat);
public abstract Builder setTableFormat(@Nullable String tableFormat);
Comment thread
keshavdandeva marked this conversation as resolved.

public abstract BigLakeConfiguration build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.bigquery;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -61,6 +62,26 @@ void testFromPb() {
BIG_LAKE_CONFIGURATION, BigLakeConfiguration.fromPb(BIG_LAKE_CONFIGURATION_PB));
}

@Test
void testNullFields() {
BigLakeConfiguration configuration = BigLakeConfiguration.newBuilder().build();
assertNull(configuration.getConnectionId());
assertNull(configuration.getFileFormat());
assertNull(configuration.getStorageUri());
assertNull(configuration.getTableFormat());
}

@Test
void testFromPbWithNullFields() {
com.google.api.services.bigquery.model.BigLakeConfiguration pb =
new com.google.api.services.bigquery.model.BigLakeConfiguration();
BigLakeConfiguration configuration = BigLakeConfiguration.fromPb(pb);
assertNull(configuration.getConnectionId());
assertNull(configuration.getFileFormat());
assertNull(configuration.getStorageUri());
assertNull(configuration.getTableFormat());
}

private static void assertBigLakeConfiguration(
BigLakeConfiguration expected, BigLakeConfiguration actual) {
assertEquals(expected.getConnectionId(), actual.getConnectionId());
Expand Down
Loading