[
https://issues.apache.org/jira/browse/BEAM-8743?focusedWorklogId=347074&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-347074
]
ASF GitHub Bot logged work on BEAM-8743:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Nov/19 23:44
Start Date: 20/Nov/19 23:44
Worklog Time Spent: 10m
Work Description: kennknowles commented on pull request #10158:
[BEAM-8743] Add support for flat schemas in pubsub
URL: https://github.com/apache/beam/pull/10158#discussion_r348802643
##########
File path:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/pubsub/PubsubMessageToRow.java
##########
@@ -68,8 +69,21 @@
public abstract boolean useDlq();
+ public abstract boolean useFlatSchema();
+
private Schema payloadSchema() {
- return messageSchema().getField(PAYLOAD_FIELD).getType().getRowSchema();
+ if (useFlatSchema()) {
+ Schema.Builder builder = Schema.builder();
+ for (Schema.Field field : messageSchema().getFields()) {
+ if (field.getName().equals(TIMESTAMP_FIELD)) {
+ continue;
+ }
+ builder.addField(field);
+ }
+ return builder.build();
+ } else {
+ return messageSchema().getField(PAYLOAD_FIELD).getType().getRowSchema();
Review comment:
nit: shorter branch first is slightly easier to 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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 347074)
Time Spent: 50m (was: 40m)
> Add support for flat schemas in pubsub
> --------------------------------------
>
> Key: BEAM-8743
> URL: https://issues.apache.org/jira/browse/BEAM-8743
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql
> Reporter: Brian Hulette
> Assignee: Brian Hulette
> Priority: Major
> Fix For: 2.18.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> See
> https://lists.apache.org/thread.html/bf4c37f21bda194d7f8c40f6e7b9a776262415755cc1658412af3c76@%3Cdev.beam.apache.org%3E
--
This message was sent by Atlassian Jira
(v8.3.4#803005)