Skip to content

feat(bigtable): Support Avro schema bundles in Bigtable's Admin API - #14351

Open
trollyxia wants to merge 4 commits into
googleapis:mainfrom
trollyxia:avro
Open

trollyxia wants to merge 4 commits into
googleapis:mainfrom
trollyxia:avro

Conversation

@trollyxia

Copy link
Copy Markdown
Contributor

No description provided.

@trollyxia
trollyxia requested review from a team as code owners September 10, 2026 21:06

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for Avro schemas in SchemaBundle and its corresponding create and update request builders, along with comprehensive unit and integration tests. The review feedback suggests refining the exception message in SchemaBundle.getAvroSchema() to clearly state that the bundle does not contain an Avro schema, rather than using a generic and potentially misleading message about an invalid type.

@trollyxia trollyxia changed the title feat: Support Avro schema bundles in Bigtable's Admin API feat(bigtable): Support Avro schema bundles in Bigtable's Admin API Sep 10, 2026

/** Sets the avro schema for this schema bundle. */
public UpdateSchemaBundleRequest setAvroSchema(@Nonnull List<String> avroSchema) {
Preconditions.checkNotNull(avroSchema, "avroSchema must be set");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we validate proto schema is not set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

return setAvroSchema(Collections.singletonList(avroSchema));
}

/** Sets the avro schema for this schema bundle. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sets a list of avro schema for this schema bundle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -93,6 +93,9 @@ public UpdateSchemaBundleRequest setProtoSchemaFile(@Nonnull String protoSchemaF

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe the comment should be:

Update the proto schema set on this schema bundle or something.

Also, do we allow a schema bundle to switch between proto schema <-> avro schema? If so, the validation shouldn't be a precondition check (throws error), instead it would be a warning, something along the lines of "This schema bundle already has aavro schema. setting proto schema will unset the avro schema .. blah blah blah"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated comment.

Regarding switching between proto_schema and avro_schema: The backend forbids changing the schema bundle type after creation, but that enforcement is only on the server-side.

The client can only help catch stupid mistakes like chaining .setProtoSchema(...).setAvroSchema(...), in which case the result is still a valid request with an Avro schema bundle, since the first call would be overwritten by the second call.

So it makes sense to degrade the error to a warning log - it warns the user that the previous schema type is being overwritten while staying aligned with standard protobuf oneof behavior. Updated both CreateSchemaBundleRequest and UpdateSchemaBundleRequest accordingly!

…eSchemaBundleRequest instead of throwing exceptions
@mutianf

mutianf commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Thank you, but please make sure to only merge when server side is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants