Class BigQueryIO.TypedRead<T>
- All Implemented Interfaces:
Serializable
,ProjectionProducer<PTransform<PBegin,
,PCollection<T>>> HasDisplayData
- Enclosing class:
BigQueryIO
BigQueryIO.read(SerializableFunction)
.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Determines the method used to read data from BigQuery.static enum
An enumeration type for the priority of a query. -
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactuateProjectionPushdown
(Map<TupleTag<?>, FieldAccessDescriptor> outputFields) Actuate a projection pushdown.Override this method to specify how thisPTransform
should be expanded on the givenInputT
.from
(TableReference table) from
(ValueProvider<String> tableSpec) fromQuery
(ValueProvider<String> query) abstract BigQueryIO.TypedRead.Method
getTable()
void
populateDisplayData
(DisplayData.Builder builder) Register display data for the given transform or component.static <T> void
readSource
(PipelineOptions options, TupleTag<T> rowTag, DoFn.MultiOutputReceiver outputReceiver, BoundedSource<T> streamSource, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ErrorHandlingParseFn<T> errorHandlingParseFn, BadRecordRouter badRecordRouter) boolean
Whetherthis
supports projection pushdown.void
validate
(PipelineOptions options) Called before running the Pipeline to verify this transform is fully and correctly specified.withBeamRowConverters
(TypeDescriptor<T> typeDescriptor, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ToBeamRowFunction<T> toRowFn, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.FromBeamRowFunction<T> fromRowFn) Sets the functions to convert elements to/fromRow
objects.Sets aCoder
for the result of the parse function.withErrorHandler
(ErrorHandler<BadRecord, ?> badRecordErrorHandler) withFormat
(com.google.cloud.bigquery.storage.v1.DataFormat format) SeeDataFormat
.withKmsKey
(String kmsKey) For query sources, use this Cloud KMS key to encrypt any temporary tables created.withQueryLocation
(String location) BigQuery geographic location where the query job will be executed.withQueryTempDataset
(String queryTempDatasetRef) Temporary dataset reference when usingfromQuery(String)
.withQueryTempProjectAndDataset
(String queryTempProjectRef, String queryTempDatasetRef) withRowRestriction
(String rowRestriction) withRowRestriction
(ValueProvider<String> rowRestriction) Read only rows which match the specified filter, which must be a SQL expression compatible with Google standard SQL.withSelectedFields
(List<String> selectedFields) withSelectedFields
(ValueProvider<List<String>> selectedFields) Read only the specified fields (columns) from a BigQuery table.withTestServices
(BigQueryServices testServices) Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate
-
Constructor Details
-
TypedRead
public TypedRead()
-
-
Method Details
-
getMethod
-
validate
Description copied from class:PTransform
Called before running the Pipeline to verify this transform is fully and correctly specified.By default, does nothing.
- Overrides:
validate
in classPTransform<PBegin,
PCollection<T>>
-
expand
Description copied from class:PTransform
Override this method to specify how thisPTransform
should be expanded on the givenInputT
.NOTE: This method should not be called directly. Instead apply the
PTransform
should be applied to theInputT
using theapply
method.Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
- Specified by:
expand
in classPTransform<PBegin,
PCollection<T>>
-
readSource
public static <T> void readSource(PipelineOptions options, TupleTag<T> rowTag, DoFn.MultiOutputReceiver outputReceiver, BoundedSource<T> streamSource, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ErrorHandlingParseFn<T> errorHandlingParseFn, BadRecordRouter badRecordRouter) throws Exception - Throws:
Exception
-
populateDisplayData
Description copied from class:PTransform
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData)
. Implementations may callsuper.populateDisplayData(builder)
in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)
to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayData
in interfaceHasDisplayData
- Overrides:
populateDisplayData
in classPTransform<PBegin,
PCollection<T>> - Parameters:
builder
- The builder to populate with display data.- See Also:
-
getTableProvider
-
getTable
-
withCoder
Sets aCoder
for the result of the parse function. This may be required if a coder can not be inferred automatically. -
withKmsKey
For query sources, use this Cloud KMS key to encrypt any temporary tables created. -
withBeamRowConverters
public BigQueryIO.TypedRead<T> withBeamRowConverters(TypeDescriptor<T> typeDescriptor, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ToBeamRowFunction<T> toRowFn, org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.FromBeamRowFunction<T> fromRowFn) -
from
-
from
-
fromQuery
-
fromQuery
-
from
-
withoutValidation
-
withoutResultFlattening
-
usingStandardSql
-
withQueryPriority
-
withQueryLocation
BigQuery geographic location where the query job will be executed. If not specified, Beam tries to determine the location by examining the tables referenced by the query. Location must be specified for queries not executed in US or EU, or when you are reading from an authorized view. See BigQuery Jobs: query. -
withQueryTempDataset
Temporary dataset reference when usingfromQuery(String)
. When reading from a query, BigQuery will create a temporary dataset and a temporary table to store the results of the query. With this option, you can set an existing dataset to create the temporary table. BigQueryIO will create a temporary table in that dataset, and will remove it once it is not needed. No other tables in the dataset will be modified. If your job does not have permissions to create a new dataset, and you want to usefromQuery(String)
(for instance, to read from a view), you should use this option. Remember that the dataset must exist and your job needs permissions to create and remove tables inside that dataset. -
withQueryTempProjectAndDataset
public BigQueryIO.TypedRead<T> withQueryTempProjectAndDataset(String queryTempProjectRef, String queryTempDatasetRef) -
withMethod
-
withFormat
SeeDataFormat
. -
withSelectedFields
-
withSelectedFields
Read only the specified fields (columns) from a BigQuery table. Fields may not be returned in the order specified. If no value is specified, then all fields are returned.Requires
BigQueryIO.TypedRead.Method.DIRECT_READ
. Not compatible withfromQuery(String)
. -
withRowRestriction
-
withRowRestriction
Read only rows which match the specified filter, which must be a SQL expression compatible with Google standard SQL. If no value is specified, then all rows are returned.Requires
BigQueryIO.TypedRead.Method.DIRECT_READ
. Not compatible withfromQuery(String)
. -
withErrorHandler
-
withTemplateCompatibility
-
withTestServices
-
useAvroLogicalTypes
-
supportsProjectionPushdown
public boolean supportsProjectionPushdown()Description copied from interface:ProjectionProducer
Whetherthis
supports projection pushdown.- Specified by:
supportsProjectionPushdown
in interfaceProjectionProducer<T>
-
actuateProjectionPushdown
public PTransform<PBegin,PCollection<T>> actuateProjectionPushdown(Map<TupleTag<?>, FieldAccessDescriptor> outputFields) Description copied from interface:ProjectionProducer
Actuate a projection pushdown.- Specified by:
actuateProjectionPushdown
in interfaceProjectionProducer<T>
- Parameters:
outputFields
- Map keyed by theTupleTag
for each output on which pushdown is requested. The value is theFieldAccessDescriptor
containing the list of fields needed for that output; fields not present in the descriptor should be dropped.- Returns:
T
that implements the projection pushdown. The return value is assumed to be a drop-in replacement forthis
; it must have all the same functionality. For this reason,T
is usually the same class asthis
.
-