This is an automated email from the ASF dual-hosted git repository.
lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new d264cf9 Fixes a typo in type signature of
TextIO.TypedWrite.to(DynamicDestinations) that made it unusable
d264cf9 is described below
commit d264cf9d5e80cf100880a456a61bc5077b9ff437
Author: Eugene Kirpichov <[email protected]>
AuthorDate: Fri Dec 22 11:39:50 2017 -0800
Fixes a typo in type signature of TextIO.TypedWrite.to(DynamicDestinations)
that made it unusable
---
.../src/main/java/org/apache/beam/sdk/io/TextIO.java | 5 +++--
.../java/org/apache/beam/sdk/io/TextIOWriteTest.java | 20 +++++++++++++++++++-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/TextIO.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/TextIO.java
index e16a43d..0dbf735 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/TextIO.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/TextIO.java
@@ -713,8 +713,9 @@ public class TextIO {
*/
@Deprecated
public <NewDestinationT> TypedWrite<UserT, NewDestinationT> to(
- DynamicDestinations<UserT, DestinationT, String> dynamicDestinations) {
- return (TypedWrite)
toBuilder().setDynamicDestinations(dynamicDestinations).build();
+ DynamicDestinations<UserT, NewDestinationT, String>
dynamicDestinations) {
+ return (TypedWrite)
+ toBuilder().setDynamicDestinations((DynamicDestinations)
dynamicDestinations).build();
}
/**
diff --git
a/sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java
index 313e974..e53745f 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java
@@ -151,6 +151,16 @@ public class TextIOWriteTest {
@Test
@Category(NeedsRunner.class)
public void testDynamicDestinations() throws Exception {
+ testDynamicDestinations(false);
+ }
+
+ @Test
+ @Category(NeedsRunner.class)
+ public void testDynamicDestinationsWithCustomType() throws Exception {
+ testDynamicDestinations(true);
+ }
+
+ private void testDynamicDestinations(boolean customType) throws Exception {
ResourceId baseDir =
FileSystems.matchNewResource(
Files.createTempDirectory(tempFolder.getRoot().toPath(),
"testDynamicDestinations")
@@ -159,7 +169,15 @@ public class TextIOWriteTest {
List<String> elements = Lists.newArrayList("aaaa", "aaab", "baaa", "baab",
"caaa", "caab");
PCollection<String> input =
p.apply(Create.of(elements).withCoder(StringUtf8Coder.of()));
- input.apply(TextIO.write().to(new
TestDynamicDestinations(baseDir)).withTempDirectory(baseDir));
+ if (customType) {
+ input.apply(
+ TextIO.<String>writeCustomType()
+ .to(new TestDynamicDestinations(baseDir))
+ .withTempDirectory(baseDir));
+ } else {
+ input.apply(
+ TextIO.write().to(new
TestDynamicDestinations(baseDir)).withTempDirectory(baseDir));
+ }
p.run();
assertOutputFiles(
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].