This repository was archived by the owner on Oct 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Changes to make queryPath optional #162
Open
dup05
wants to merge
10
commits into
GoogleCloudPlatform:master
Choose a base branch
from
dup05:reid_changes
base: master
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
10 commits
Select commit
Hold shift + click to select a range
26fe09d
Changes to make queryPath optional
dup05 b0bcfa2
Reid changes
dup05 211b782
minor changes
dup05 6c31dfc
temp changes to test CI
dup05 1ffc3b9
CI changes
dup05 40330a4
Fixes in CI workflow
dup05 21b45f4
removed temp changes
dup05 855e5e1
removed temp changes
dup05 638f2ba
readme changes
dup05 01f8279
Merge branch 'master' into reid_changes
dup05 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
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
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
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 |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| */ | ||
| package com.google.swarm.tokenization.common; | ||
|
|
||
| import autovalue.shaded.org.checkerframework.checker.nullness.qual.Nullable; | ||
| import com.google.api.services.bigquery.model.TableRow; | ||
| import com.google.auto.value.AutoValue; | ||
| import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO; | ||
|
|
@@ -39,6 +40,7 @@ public abstract class BigQueryReadTransform | |
|
|
||
| public abstract Integer keyRange(); | ||
|
|
||
| @Nullable | ||
| public abstract String query(); | ||
|
|
||
| @AutoValue.Builder | ||
|
|
@@ -64,23 +66,28 @@ public PCollection<KV<String, TableRow>> expand(PBegin input) { | |
|
|
||
| switch (readMethod()) { | ||
| case DEFAULT: | ||
| return input | ||
| .apply( | ||
| "ReadFromBigQuery", | ||
| BigQueryIO.readTableRows() | ||
| .fromQuery(query()) | ||
| .usingStandardSql() | ||
| .withMethod(Method.DEFAULT)) | ||
| .apply("AddTableNameAsKey", WithKeys.of(tableRef())); | ||
| if(query()!=null) { | ||
| return input | ||
| .apply( | ||
| "ReadFromBigQuery", | ||
| BigQueryIO.readTableRows() | ||
| .fromQuery(query()) | ||
| .usingStandardSql() | ||
| .withMethod(Method.DEFAULT)) | ||
| .apply("AddTableNameAsKey", WithKeys.of(tableRef())); | ||
| } | ||
| else { | ||
| return input | ||
| .apply( | ||
| "ReadFromBigQuery", | ||
| BigQueryIO.readTableRows() | ||
| .from(tableRef()) | ||
| .withMethod(Method.DEFAULT)) | ||
| .apply("AddTableNameAsKey", WithKeys.of(tableRef())); | ||
| } | ||
|
|
||
| case EXPORT: | ||
|
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. Can we just club EXPORT and DIRECT_READ together and throw the exception "Only DEFAULT Read Method supported"?
|
||
| return input | ||
| .apply( | ||
| "ReadFromBigQuery", | ||
| BigQueryIO.readTableRows() | ||
| .fromQuery(query()) | ||
| .usingStandardSql() | ||
| .withMethod(Method.DEFAULT)) | ||
| .apply("AddTableNameAsKey", WithKeys.of(tableRef())); | ||
| throw new IllegalArgumentException("Export method not supported"); | ||
|
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. May not be the intended behaviour but since the EXPORT case used to work with DEFAULT read earlier, are we declaring that somewhere before removing the support altogether? |
||
|
|
||
| case DIRECT_READ: | ||
| throw new IllegalArgumentException("Direct read not supported"); | ||
Goutam1511 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.