This is an automated email from the ASF dual-hosted git repository.
damccorm 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 09b9c471c8d Add @SchemaFieldDescription annotations and description to
Bigtable config (#36344)
09b9c471c8d is described below
commit 09b9c471c8dbb7c6c606492a5fb25cdfccaac27b
Author: lim1t <[email protected]>
AuthorDate: Wed Oct 1 23:05:38 2025 +0900
Add @SchemaFieldDescription annotations and description to Bigtable config
(#36344)
* Add @SchemaFieldDescription annotations and description to Bigtable
config fields
* Fix formatting using spotless
---
.../bigtable/BigtableReadSchemaTransformProvider.java | 19 +++++++++++++++++++
.../BigtableWriteSchemaTransformProvider.java | 18 ++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadSchemaTransformProvider.java
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadSchemaTransformProvider.java
index 2ed75d7bc7e..ca4caee2e46 100644
---
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadSchemaTransformProvider.java
+++
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableReadSchemaTransformProvider.java
@@ -35,6 +35,7 @@ import
org.apache.beam.sdk.io.gcp.bigtable.BigtableReadSchemaTransformProvider.B
import org.apache.beam.sdk.schemas.AutoValueSchema;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
+import org.apache.beam.sdk.schemas.annotations.SchemaFieldDescription;
import org.apache.beam.sdk.schemas.transforms.SchemaTransform;
import org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider;
import org.apache.beam.sdk.schemas.transforms.TypedSchemaTransformProvider;
@@ -89,6 +90,19 @@ public class BigtableReadSchemaTransformProvider
return "beam:schematransform:org.apache.beam:bigtable_read:v1";
}
+ @Override
+ public String description() {
+ return "Reads data from a Google Cloud Bigtable table.\n"
+ + "The transform requires the project ID, instance ID, and table ID
parameters.\n"
+ + "Optionally, the output can be flattened or nested rows.\n"
+ + "Example usage:\n"
+ + " - type: ReadFromBigTable\n"
+ + " config:\n"
+ + " project: \"my-gcp-project\"\n"
+ + " instance: \"my-bigtable-instance\"\n"
+ + " table: \"my-table\"\n";
+ }
+
@Override
public List<String> outputCollectionNames() {
return Collections.singletonList(OUTPUT_TAG);
@@ -113,12 +127,17 @@ public class BigtableReadSchemaTransformProvider
.setFlatten(true);
}
+ @SchemaFieldDescription("Bigtable table ID to read from.")
public abstract String getTableId();
+ @SchemaFieldDescription("Bigtable instance ID to connect to.")
public abstract String getInstanceId();
+ @SchemaFieldDescription("Google Cloud project ID containing the Bigtable
instance.")
public abstract String getProjectId();
+ @SchemaFieldDescription(
+ "If set to false, output rows are nested; if true or omitted, output
rows are flattened.")
public abstract @Nullable Boolean getFlatten();
/** Builder for the {@link BigtableReadSchemaTransformConfiguration}. */
diff --git
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java
index 45559154389..2b1be006df4 100644
---
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java
+++
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java
@@ -37,6 +37,7 @@ import
org.apache.beam.sdk.io.gcp.bigtable.BigtableWriteSchemaTransformProvider.
import org.apache.beam.sdk.schemas.AutoValueSchema;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
+import org.apache.beam.sdk.schemas.annotations.SchemaFieldDescription;
import org.apache.beam.sdk.schemas.transforms.SchemaTransform;
import org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider;
import org.apache.beam.sdk.schemas.transforms.TypedSchemaTransformProvider;
@@ -83,6 +84,20 @@ public class BigtableWriteSchemaTransformProvider
return "beam:schematransform:org.apache.beam:bigtable_write:v1";
}
+ @Override
+ public String description() {
+ return "Writes data to a Google Cloud Bigtable table.\n"
+ + "This transform requires the Google Cloud project ID, Bigtable
instance ID, and table ID.\n"
+ + "The input PCollection should be schema-compliant mutations or keyed
rows.\n"
+ + "Example usage:\n"
+ + " - type: WriteToBigTable\n"
+ + " input: input\n"
+ + " config:\n"
+ + " project: \"my-gcp-project\"\n"
+ + " instance: \"my-bigtable-instance\"\n"
+ + " table: \"my-table\"\n";
+ }
+
@Override
public List<String> inputCollectionNames() {
return Collections.singletonList(INPUT_TAG);
@@ -108,10 +123,13 @@ public class BigtableWriteSchemaTransformProvider
checkArgument(!this.getProjectId().isEmpty(),
String.format(invalidConfigMessage, "project"));
}
+ @SchemaFieldDescription("Bigtable table ID to write data into.")
public abstract String getTableId();
+ @SchemaFieldDescription("Bigtable instance ID where the table is located.")
public abstract String getInstanceId();
+ @SchemaFieldDescription("Google Cloud project ID containing the Bigtable
instance.")
public abstract String getProjectId();
/** Builder for the {@link BigtableWriteSchemaTransformConfiguration}. */