public static class DatastoreIO.Source extends BoundedSource<DatastoreV1.Entity>
Source that reads the result rows of a Datastore query as Entity objects.BoundedSource.BoundedReader<T>Source.Reader<T>| Modifier and Type | Method and Description |
|---|---|
BoundedSource.BoundedReader<DatastoreV1.Entity> |
createReader(PipelineOptions pipelineOptions)
Returns a new
BoundedSource.BoundedReader that reads from this source. |
String |
getDataset() |
Coder<DatastoreV1.Entity> |
getDefaultOutputCoder()
Returns the default
Coder to use for the data read from this source. |
long |
getEstimatedSizeBytes(PipelineOptions options)
An estimate of the total size (in bytes) of the data that would be read from this source.
|
String |
getHost() |
String |
getNamespace() |
DatastoreV1.Query |
getQuery() |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
boolean |
producesSortedKeys(PipelineOptions options)
Whether this source is known to produce key/value pairs sorted by lexicographic order on
the bytes of the encoded key.
|
List<DatastoreIO.Source> |
splitIntoBundles(long desiredBundleSizeBytes,
PipelineOptions options)
Splits the source into bundles of approximately
desiredBundleSizeBytes. |
String |
toString() |
void |
validate()
Checks that this source is valid, before it can be used in a pipeline.
|
DatastoreIO.Source |
withDataset(String datasetId) |
DatastoreIO.Source |
withHost(String host) |
DatastoreIO.Source |
withNamespace(String namespace) |
DatastoreIO.Source |
withQuery(DatastoreV1.Query query)
Returns a new
Source that reads the results of the specified query. |
public String getHost()
public String getDataset()
public DatastoreV1.Query getQuery()
public DatastoreIO.Source withDataset(String datasetId)
public DatastoreIO.Source withQuery(DatastoreV1.Query query)
Source that reads the results of the specified query.
Does not modify this object.
Note: Normally, a Cloud Dataflow job will read from Cloud Datastore in parallel
across many workers. However, when the DatastoreV1.Query is configured with a limit using
DatastoreV1.Query.Builder.setLimit(int), then all
returned results will be read by a single Dataflow worker in order to ensure correct data.
public DatastoreIO.Source withHost(String host)
public DatastoreIO.Source withNamespace(@Nullable String namespace)
public Coder<DatastoreV1.Entity> getDefaultOutputCoder()
SourceCoder to use for the data read from this source.getDefaultOutputCoder in class Source<DatastoreV1.Entity>public boolean producesSortedKeys(PipelineOptions options)
BoundedSourceproducesSortedKeys in class BoundedSource<DatastoreV1.Entity>public List<DatastoreIO.Source> splitIntoBundles(long desiredBundleSizeBytes, PipelineOptions options) throws Exception
BoundedSourcedesiredBundleSizeBytes.splitIntoBundles in class BoundedSource<DatastoreV1.Entity>Exceptionpublic BoundedSource.BoundedReader<DatastoreV1.Entity> createReader(PipelineOptions pipelineOptions) throws IOException
BoundedSourceBoundedSource.BoundedReader that reads from this source.createReader in class BoundedSource<DatastoreV1.Entity>IOExceptionpublic void validate()
SourceIt is recommended to use Preconditions for implementing
this method.
validate in class Source<DatastoreV1.Entity>public long getEstimatedSizeBytes(PipelineOptions options) throws Exception
BoundedSourcegetEstimatedSizeBytes in class BoundedSource<DatastoreV1.Entity>Exceptionpublic void populateDisplayData(DisplayData.Builder builder)
SourcepopulateDisplayData(DisplayData.Builder) is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData). Implementations may call
super.populateDisplayData(builder) in order to register display data in the current
namespace, but should otherwise use subcomponent.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.
populateDisplayData in interface HasDisplayDatapopulateDisplayData in class Source<DatastoreV1.Entity>builder - The builder to populate with display data.HasDisplayData