You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Naireen (via GitHub)" <gi...@apache.org> on 2023/11/01 21:14:15 UTC
Re: [PR] Test sink name [beam]
Naireen commented on code in PR #29230:
URL: https://github.com/apache/beam/pull/29230#discussion_r1379339872
##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOWriteTest.java:
##########
@@ -1293,6 +1295,10 @@ private void storageWrite(boolean autoSharding) throws Exception {
p.apply(source).apply("WriteToBQ", write);
p.run().waitUntilFinish();
+ // This should not change, this ensures that the transform name is what the dataflow runner
+ // expects.
+ logged.verifyDebug("/StorageApiLoads");
Review Comment:
Done
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/io/WriteFilesTest.java:
##########
@@ -477,6 +480,39 @@ public void testBuildWrite() {
assertThat(write.getComputeNumShards(), equalTo(originalSharding));
}
+ @Test
+ public void testWriteTransformName() {
+ PipelineOptions options = TestPipeline.testingPipelineOptions();
+ Pipeline pipeline = Pipeline.create(options);
+
+ SimpleSink<Void> sink = makeSimpleSink();
+ WriteFiles<String, ?, String> write =
+ WriteFiles.to(sink).withNumShards(0).withWindowedWrites().withRunnerDeterminedSharding();
+
+ List<String> inputs = Lists.newArrayList();
+ for (int i = 0; i < 100; ++i) {
+ inputs.add("mambo_number_" + i);
+ }
+
+ // Prepare timestamps for the elements.
+ List<Long> timestamps = new ArrayList<>();
+ for (long i = 0; i < inputs.size(); i++) {
+ timestamps.add(i + 1);
+ }
+
+ assertThat((SimpleSink<Void>) write.getSink(), is(sink));
+ assertThat(write.getComputeNumShards(), nullValue());
+
+ pipeline
+ .apply(Create.timestamped(inputs, timestamps).withCoder(StringUtf8Coder.of()))
+ .setIsBoundedInternal(IsBounded.UNBOUNDED)
+ .apply(Window.into(FixedWindows.of(Duration.millis(1))))
+ .apply(write);
+ // This should not change, this ensures that the transform name is what the dataflow runner
+ // expects.
+ logged.verifyDebug("WriteAutoShardedBundlesToTempFiles");
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org