-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(bigtable): add protobuf decoding to Bigtable Change Streams to BigQuery #3572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MattiasMTS
wants to merge
7
commits into
GoogleCloudPlatform:main
Choose a base branch
from
MattiasMTS:ms/bt-bq-proto
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dc90c38
feat(bigtable): add protobuf decoding to change streams template
MattiasMTS 024da4e
feat(bigtable): add column-mapping value transformations
MattiasMTS 2a093db
refactor(bigtable): unify proto decoding with columnTransforms
MattiasMTS d375c53
test(bigtable): add integration tests for column transforms and proto…
MattiasMTS 446fb3a
refactor(bigtable): simplify proto decode and registry internals
MattiasMTS ed946bc
feat(bigtable): bound proto-decoded value size to prevent Dataflow el…
MattiasMTS d2ae237
refactor(bigtable): simplify bounded-decode plumbing
MattiasMTS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,4 +149,110 @@ public interface BigtableChangeStreamToBigQueryOptions | |
| String getDlqDirectory(); | ||
|
|
||
| void setDlqDirectory(String value); | ||
|
|
||
| @TemplateParameter.Text( | ||
| order = 11, | ||
| optional = true, | ||
| description = "Column value transforms", | ||
| helpText = | ||
| "A comma-separated list of column value transforms. Each entry has the format " | ||
| + "column_family:column_qualifier:TRANSFORM_TYPE. Supported TRANSFORM_TYPE values: " | ||
| + "BIG_ENDIAN_TIMESTAMP (interprets 8-byte big-endian values as Unix epoch millis), " | ||
| + "PROTO_DECODE(package.MessageName) (decodes protobuf-encoded values to JSON; " | ||
| + "requires protoSchemaPath). For complex transformations, consider using a " | ||
| + "JavaScript UDF. Note that column qualifiers containing commas are not supported " | ||
| + "since comma is used as the entry delimiter.") | ||
| @Default.String("") | ||
| String getColumnTransforms(); | ||
|
|
||
| void setColumnTransforms(String value); | ||
|
|
||
| @TemplateParameter.GcsReadFile( | ||
| order = 12, | ||
| optional = true, | ||
| description = "Cloud Storage path to the proto schema file", | ||
| helpText = | ||
| "The Cloud Storage location of the self-contained proto schema file. " | ||
| + "For example, gs://path/to/my/file.pb. This file can be generated with the " | ||
| + "--descriptor_set_out flag of the protoc command. The --include_imports flag " | ||
| + "guarantees that the file is self-contained. Required when using " | ||
| + "PROTO_DECODE() in columnTransforms. For legacy compatibility, when set along " | ||
| + "with fullProtoMessageName, protoColumnFamily, and protoColumn, the pipeline " | ||
| + "automatically generates a columnTransforms entry. Prefer using " | ||
| + "columnTransforms with PROTO_DECODE() directly for multi-column proto decoding.") | ||
| @Default.String("") | ||
| String getProtoSchemaPath(); | ||
|
|
||
| void setProtoSchemaPath(String value); | ||
|
|
||
| @TemplateParameter.Text( | ||
| order = 13, | ||
| optional = true, | ||
| regexes = {"^.+([a-zA-Z][a-zA-Z0-9_]+\\.?)+[a-zA-Z0-9_]$"}, | ||
| description = "Full proto message name", | ||
| helpText = | ||
| "The full proto message name. For example, package.name.MessageName, " | ||
| + "where package.name is the value provided for the package statement " | ||
| + "and not the java_package statement. Used with the legacy proto options. " | ||
| + "Prefer using columnTransforms with PROTO_DECODE() for new configurations.") | ||
| @Default.String("") | ||
| String getFullProtoMessageName(); | ||
|
|
||
| void setFullProtoMessageName(String value); | ||
|
|
||
| @TemplateParameter.Text( | ||
| order = 14, | ||
| optional = true, | ||
| description = "Column family containing proto values", | ||
| helpText = | ||
| "The Bigtable column family containing protobuf-encoded values to decode. " | ||
| + "Used with the legacy proto options. Together with protoColumn, this defines " | ||
| + "the proto-mapped column. Prefer using columnTransforms with PROTO_DECODE() " | ||
| + "for multi-column proto decoding.") | ||
| @Default.String("") | ||
| String getProtoColumnFamily(); | ||
|
|
||
| void setProtoColumnFamily(String value); | ||
|
|
||
| @TemplateParameter.Text( | ||
| order = 15, | ||
| optional = true, | ||
| description = "Column qualifier containing proto values", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Grouping together multiple data into single proto column is a best practice, but it's not always the case, what if you have second proto in other column family or another column. |
||
| helpText = | ||
| "The Bigtable column qualifier containing protobuf-encoded values to decode. " | ||
| + "Used with the legacy proto options. Together with protoColumnFamily, this " | ||
| + "defines the proto-mapped column. Prefer using columnTransforms with " | ||
| + "PROTO_DECODE() for multi-column proto decoding.") | ||
| @Default.String("") | ||
| String getProtoColumn(); | ||
|
|
||
| void setProtoColumn(String value); | ||
|
|
||
| @TemplateParameter.Boolean( | ||
| order = 16, | ||
| optional = true, | ||
| description = "Preserve proto field names in JSON output", | ||
| helpText = | ||
| "When set to true, preserves original proto field names (snake_case) in the " | ||
| + "JSON output. When set to false, uses lowerCamelCase. Defaults to false.") | ||
| @Default.Boolean(false) | ||
| Boolean getPreserveProtoFieldNames(); | ||
|
|
||
| void setPreserveProtoFieldNames(Boolean value); | ||
|
|
||
| @TemplateParameter.Long( | ||
| order = 17, | ||
| optional = true, | ||
| description = "Maximum decoded value size in bytes", | ||
| helpText = | ||
| "Maximum allowed size, in bytes, of a value after applying a columnTransforms " | ||
| + "decoder (e.g. PROTO_DECODE). Values whose decoded output would exceed this " | ||
| + "threshold are routed to the dead-letter queue with metadata only, and are " | ||
| + "not written to BigQuery. The default of 10000000 (10 MB) matches BigQuery " | ||
| + "Storage Write API's maximum row size, ensuring a single predictable error " | ||
| + "funnel. Increase this if you write to a sink that accepts larger rows.") | ||
| @Default.Long(10_000_000L) | ||
| Long getMaxDecodedValueBytes(); | ||
|
|
||
| void setMaxDecodedValueBytes(Long value); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for being consistent with src/main/java/com/google/cloud/teleport/v2/templates/PubsubProtoToBigQuery.java