You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/05/24 15:32:21 UTC

[GitHub] [beam] johnjcasey opened a new pull request, #17742: [BEAM-14297] add nullable annotations and an integration test

johnjcasey opened a new pull request, #17742:
URL: https://github.com/apache/beam/pull/17742

   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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


[GitHub] [beam] chamikaramj commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
chamikaramj commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136518143

   Run Python_PVR_Flink PreCommit


-- 
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


[GitHub] [beam] asf-ci commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136080335

   Can one of the admins verify this patch?


-- 
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


[GitHub] [beam] asf-ci commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136080337

   Can one of the admins verify this patch?


-- 
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


[GitHub] [beam] asf-ci commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136080346

   Can one of the admins verify this patch?


-- 
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


[GitHub] [beam] asf-ci commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136080355

   Can one of the admins verify this patch?


-- 
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


[GitHub] [beam] johnjcasey commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
johnjcasey commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136227885

   Run Java Precommit


-- 
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


[GitHub] [beam] chamikaramj commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
chamikaramj commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136517946

   Run Java_Examples_Dataflow_Java17 PreCommit


-- 
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


[GitHub] [beam] chamikaramj merged pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
chamikaramj merged PR #17742:
URL: https://github.com/apache/beam/pull/17742


-- 
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


[GitHub] [beam] johnjcasey commented on a diff in pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
johnjcasey commented on code in PR #17742:
URL: https://github.com/apache/beam/pull/17742#discussion_r880905357


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java:
##########
@@ -203,6 +210,47 @@ public void testKafkaIOReadsAndWritesCorrectlyInBatch() throws IOException {
     }
   }
 
+  // This test roundtrips a single KV<Null,Null> to verify that externalWithMetadata
+  // can handle null keys and values correctly.
+  @Test
+  public void testKafkaIOExternalRoundtripWithMetadataAndNullKeysAndValues() {
+
+    List<byte[]> nullList = new ArrayList<>();
+    nullList.add(null);
+    writePipeline
+        .apply(Create.of(nullList))
+        .apply(
+            ParDo.of(
+                new DoFn<byte[], KV<byte[], byte[]>>() {
+                  @ProcessElement
+                  public void processElement(
+                      @Element byte[] element, OutputReceiver<KV<byte[], byte[]>> receiver) {
+                    receiver.output(KV.of(element, element));
+                  }
+                }))
+        .apply(
+            KafkaIO.<byte[], byte[]>write()
+                .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+                .withTopic(options.getKafkaTopic())
+                .withKeySerializer(ByteArraySerializer.class)
+                .withValueSerializer(ByteArraySerializer.class));
+
+    PipelineResult writeResult = writePipeline.run();
+    writeResult.waitUntilFinish();
+
+    readPipeline.apply(
+        KafkaIO.<byte[], byte[]>read()
+            .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+            .withTopic(options.getKafkaTopic())
+            .withKeyDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .withValueDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .externalWithMetadata());
+    PipelineResult readResult = readPipeline.run();
+    readResult.waitUntilFinish();

Review Comment:
   how should I go about adding it to the internal suite?



-- 
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


[GitHub] [beam] asf-ci commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136080357

   Can one of the admins verify this patch?


-- 
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


[GitHub] [beam] johnjcasey commented on a diff in pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
johnjcasey commented on code in PR #17742:
URL: https://github.com/apache/beam/pull/17742#discussion_r880905014


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java:
##########
@@ -203,6 +210,47 @@ public void testKafkaIOReadsAndWritesCorrectlyInBatch() throws IOException {
     }
   }
 
+  // This test roundtrips a single KV<Null,Null> to verify that externalWithMetadata
+  // can handle null keys and values correctly.
+  @Test
+  public void testKafkaIOExternalRoundtripWithMetadataAndNullKeysAndValues() {
+
+    List<byte[]> nullList = new ArrayList<>();
+    nullList.add(null);
+    writePipeline
+        .apply(Create.of(nullList))
+        .apply(
+            ParDo.of(
+                new DoFn<byte[], KV<byte[], byte[]>>() {
+                  @ProcessElement
+                  public void processElement(
+                      @Element byte[] element, OutputReceiver<KV<byte[], byte[]>> receiver) {
+                    receiver.output(KV.of(element, element));
+                  }
+                }))
+        .apply(
+            KafkaIO.<byte[], byte[]>write()
+                .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+                .withTopic(options.getKafkaTopic())
+                .withKeySerializer(ByteArraySerializer.class)
+                .withValueSerializer(ByteArraySerializer.class));
+
+    PipelineResult writeResult = writePipeline.run();
+    writeResult.waitUntilFinish();
+
+    readPipeline.apply(
+        KafkaIO.<byte[], byte[]>read()
+            .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+            .withTopic(options.getKafkaTopic())
+            .withKeyDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .withValueDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .externalWithMetadata());
+    PipelineResult readResult = readPipeline.run();
+    readResult.waitUntilFinish();

Review Comment:
   Yep, ty



-- 
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


[GitHub] [beam] chamikaramj commented on a diff in pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
chamikaramj commented on code in PR #17742:
URL: https://github.com/apache/beam/pull/17742#discussion_r880893185


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java:
##########
@@ -203,6 +210,47 @@ public void testKafkaIOReadsAndWritesCorrectlyInBatch() throws IOException {
     }
   }
 
+  // This test roundtrips a single KV<Null,Null> to verify that externalWithMetadata
+  // can handle null keys and values correctly.
+  @Test
+  public void testKafkaIOExternalRoundtripWithMetadataAndNullKeysAndValues() {
+
+    List<byte[]> nullList = new ArrayList<>();
+    nullList.add(null);
+    writePipeline
+        .apply(Create.of(nullList))
+        .apply(
+            ParDo.of(
+                new DoFn<byte[], KV<byte[], byte[]>>() {
+                  @ProcessElement
+                  public void processElement(
+                      @Element byte[] element, OutputReceiver<KV<byte[], byte[]>> receiver) {
+                    receiver.output(KV.of(element, element));
+                  }
+                }))
+        .apply(
+            KafkaIO.<byte[], byte[]>write()
+                .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+                .withTopic(options.getKafkaTopic())
+                .withKeySerializer(ByteArraySerializer.class)
+                .withValueSerializer(ByteArraySerializer.class));
+
+    PipelineResult writeResult = writePipeline.run();
+    writeResult.waitUntilFinish();
+
+    readPipeline.apply(
+        KafkaIO.<byte[], byte[]>read()
+            .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+            .withTopic(options.getKafkaTopic())
+            .withKeyDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .withValueDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .externalWithMetadata());
+    PipelineResult readResult = readPipeline.run();
+    readResult.waitUntilFinish();

Review Comment:
   Verify that a single element with null values was read ?



-- 
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


[GitHub] [beam] johnjcasey commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
johnjcasey commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136329770

   r: @chamikaramj 


-- 
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


[GitHub] [beam] johnjcasey commented on pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
johnjcasey commented on PR #17742:
URL: https://github.com/apache/beam/pull/17742#issuecomment-1136232504

   Run Java Postcommit


-- 
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


[GitHub] [beam] chamikaramj commented on a diff in pull request #17742: [BEAM-14297] add nullable annotations and an integration test

Posted by GitBox <gi...@apache.org>.
chamikaramj commented on code in PR #17742:
URL: https://github.com/apache/beam/pull/17742#discussion_r880907978


##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java:
##########
@@ -203,6 +210,47 @@ public void testKafkaIOReadsAndWritesCorrectlyInBatch() throws IOException {
     }
   }
 
+  // This test roundtrips a single KV<Null,Null> to verify that externalWithMetadata
+  // can handle null keys and values correctly.
+  @Test
+  public void testKafkaIOExternalRoundtripWithMetadataAndNullKeysAndValues() {
+
+    List<byte[]> nullList = new ArrayList<>();
+    nullList.add(null);
+    writePipeline
+        .apply(Create.of(nullList))
+        .apply(
+            ParDo.of(
+                new DoFn<byte[], KV<byte[], byte[]>>() {
+                  @ProcessElement
+                  public void processElement(
+                      @Element byte[] element, OutputReceiver<KV<byte[], byte[]>> receiver) {
+                    receiver.output(KV.of(element, element));
+                  }
+                }))
+        .apply(
+            KafkaIO.<byte[], byte[]>write()
+                .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+                .withTopic(options.getKafkaTopic())
+                .withKeySerializer(ByteArraySerializer.class)
+                .withValueSerializer(ByteArraySerializer.class));
+
+    PipelineResult writeResult = writePipeline.run();
+    writeResult.waitUntilFinish();
+
+    readPipeline.apply(
+        KafkaIO.<byte[], byte[]>read()
+            .withBootstrapServers(options.getKafkaBootstrapServerAddresses())
+            .withTopic(options.getKafkaTopic())
+            .withKeyDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .withValueDeserializerAndCoder(
+                ByteArrayDeserializer.class, NullableCoder.of(ByteArrayCoder.of()))
+            .externalWithMetadata());
+    PipelineResult readResult = readPipeline.run();
+    readResult.waitUntilFinish();

Review Comment:
   I don't think you need additional changes in this PR for that. Thanks.



-- 
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