You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "ffernandez92 (via GitHub)" <gi...@apache.org> on 2024/01/26 16:14:54 UTC
[PR] [YAML] - PubSubLite proto [beam]
ffernandez92 opened a new pull request, #30129:
URL: https://github.com/apache/beam/pull/30129
addresses #28685
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] 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://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-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)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+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 or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921651588
Run Java_Examples_Dataflow 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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921647306
Run Java_Examples_Dataflow PreCommit
Run Java_GCP_IO_Direct 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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1913267083
Run Python_Runners PreCommit 3.9
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1914947084
R: @dpcollins-google
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921656218
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921657474
Run Python_Runners PreCommit 3.8
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921659683
Run Java_GCP_IO_Direct 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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1912607537
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1912606113
R: @Polber
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921655175
Run Python_Runners PreCommit 3.8
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "Polber (via GitHub)" <gi...@apache.org>.
Polber commented on code in PR #30129:
URL: https://github.com/apache/beam/pull/30129#discussion_r1469999801
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/PubsubLiteWriteSchemaTransformProvider.java:
##########
@@ -211,6 +212,24 @@ public PCollectionRowTuple expand(PCollectionRowTuple input) {
"The input schema must have exactly one field of type byte.");
}
toBytesFn = getRowToRawBytesFunction(inputSchema.getField(0).getName());
+ } else if (configuration.getFormat().equals("PROTO")) {
+ String descriptorPath = configuration.getFileDescriptorPath();
+ String schema = configuration.getSchema();
+ String messageName = configuration.getMessageName();
+ if (messageName == null) {
+ throw new IllegalArgumentException("Expecting messageName to be non-null.");
+ }
Review Comment:
Same here
##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/pubsublite/internal/PubsubLiteDlqTest.java:
##########
@@ -471,4 +534,31 @@ public void testPubsubLiteErrorFnWithDedupingSuccess() {
p.run().waitUntilFinish();
}
+
+ @Test
+ public void testPubSubLiteErrorFnReadProto() {
Review Comment:
I think there should either be an error row that is run through the pipeline to check the error message count, or have a separate failure test case.
##########
sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoByteUtils.java:
##########
Review Comment:
Seems like a lot of these methods are for reading from a file (GCS or local), which is already part of the Filesystems library. i.e. (copied from a similar [method](https://github.com/Polber/beam/blob/f5f969bd6e50486068f3f73d323150fa377a9ffd/examples/java/src/main/java/org/apache/beam/examples/complete/kafkatopubsub/kafka/consumer/SslConsumerFactoryFn.java#L121))
```
private static byte[] getFileAsBytes(String fileDescriptorPath) {
try (ReadableByteChannel readerChannel =
FileSystems.open(FileSystems.matchSingleFileSpec(fileDescriptorPath).resourceId()))
ReadableByteChannel decompressedChannel = compression.readDecompressed(readerChannel)
try (InputStream stream = Channels.newInputStream(decompressedChannel)) {
return StreamUtils.getBytesWithoutClosing(stream);
}
} catch (IOException e) {
throw new RuntimeException("Error when finding: " + fileDescriptorPath, e);
}
}
```
##########
sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoByteUtils.java:
##########
Review Comment:
Probably also removes need for the `com.google.cloud:google-cloud-storage` in the `build.gradle`
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/PubsubLiteReadSchemaTransformProvider.java:
##########
@@ -214,6 +215,26 @@ public void finish(FinishBundleContext c) {
beamSchema = Schema.builder().addField("payload", Schema.FieldType.BYTES).build();
valueMapper = getRawBytesToRowFunction(beamSchema);
+ } else if (format != null && format.equals("PROTO")) {
+ String fileDescriptorPath = configuration.getFileDescriptorPath();
+ String messageName = configuration.getMessageName();
+
+ if (messageName == null) {
+ throw new IllegalArgumentException(
+ "To read from PubSubLite in PROTO format, messageName must be provided.");
+ }
Review Comment:
nit: might make sense to have a `validate()` method in the Configuration class that can have checks like this. (and could move the other checks like the one for `inputSchema` below)
##########
sdks/java/extensions/protobuf/src/test/java/org/apache/beam/sdk/extensions/protobuf/ProtoByteUtilsTest.java:
##########
@@ -144,4 +172,23 @@ public void testRowToProtoSchemaFunction() {
Assert.assertNotNull(
ProtoByteUtils.getRowToProtoBytesFromSchema(PROTO_STRING_SCHEMA, "MyMessage").apply(row));
}
+
+ @Test
+ public void testRowToProtoSchemaWithPackageFunction() {
+ Row row =
+ Row.withSchema(SCHEMA)
+ .withFieldValue("id", 1234)
+ .withFieldValue("name", "Doe")
+ .withFieldValue("active", false)
+ .withFieldValue("address.city", "seattle")
+ .withFieldValue("address.street", "fake street")
+ .withFieldValue("address.zip_code", "TO-1234")
+ .withFieldValue("address.state", "wa")
+ .build();
+
+ Assert.assertNotNull(
+ ProtoByteUtils.getRowToProtoBytesFromSchema(
+ PROTO_STRING_PACKAGE_SCHEMA, "com.test.proto.MyMessage")
+ .apply(row));
Review Comment:
I think having at least 1 test case for `getRowToProtoBytesFromSchema` that validates the output proto after invoking `.apply()` would be beneficial (whether it be this test or one of the existing ones)
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921663445
Run Python_Coverage 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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "brucearctor (via GitHub)" <gi...@apache.org>.
brucearctor merged PR #30129:
URL: https://github.com/apache/beam/pull/30129
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1912391634
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @liferoad for label python.
R: @kennknowles for label java.
R: @Abacn for label io.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921660618
Run Python PreCommit 3.9
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on PR #30129:
URL: https://github.com/apache/beam/pull/30129#issuecomment-1921684364
Run Python_Integration PreCommit 3.11
--
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
Re: [PR] [YAML] - PubSubLite proto [beam]
Posted by "ffernandez92 (via GitHub)" <gi...@apache.org>.
ffernandez92 commented on code in PR #30129:
URL: https://github.com/apache/beam/pull/30129#discussion_r1472500453
##########
sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoByteUtils.java:
##########
Review Comment:
That was my expectation as well. However, when I tried with the previous implementation (that didn't have the GCS differentiation), the job failed with: `No filesystem found for scheme gs`
--
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