diff --git a/examples/src/main/java/com/google/cloud/dataflow/examples/complete/AutoComplete.java b/examples/src/main/java/com/google/cloud/dataflow/examples/complete/AutoComplete.java index 1bccc4ace2..f897338889 100644 --- a/examples/src/main/java/com/google/cloud/dataflow/examples/complete/AutoComplete.java +++ b/examples/src/main/java/com/google/cloud/dataflow/examples/complete/AutoComplete.java @@ -57,6 +57,7 @@ import com.google.cloud.dataflow.sdk.values.PBegin; import com.google.cloud.dataflow.sdk.values.PCollection; import com.google.cloud.dataflow.sdk.values.PCollectionList; +import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import org.joda.time.Duration; @@ -432,10 +433,14 @@ private static interface Options extends ExamplePubsubTopicOptions, ExampleBigQu Boolean getOutputToBigQuery(); void setOutputToBigQuery(Boolean value); - @Description("Whether output to Datastoree") + @Description("Whether output to Datastore") @Default.Boolean(false) Boolean getOutputToDatastore(); void setOutputToDatastore(Boolean value); + + @Description("Datastore output dataset ID, defaults to project ID") + String getOutputDataset(); + void setOutputDataset(String value); } public static void main(String[] args) throws IOException { @@ -477,7 +482,8 @@ public static void main(String[] args) throws IOException { if (options.getOutputToDatastore()) { toWrite .apply(ParDo.named("FormatForDatastore").of(new FormatForDatastore(options.getKind()))) - .apply(DatastoreIO.writeTo(options.getProject())); + .apply(DatastoreIO.writeTo(MoreObjects.firstNonNull( + options.getOutputDataset(), options.getProject()))); } if (options.getOutputToBigQuery()) { dataflowUtils.setupBigQueryTable();