[ 
https://issues.apache.org/jira/browse/BEAM-8743?focusedWorklogId=347580&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-347580
 ]

ASF GitHub Bot logged work on BEAM-8743:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Nov/19 18:20
            Start Date: 21/Nov/19 18:20
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on pull request #10158: 
[BEAM-8743] Add support for flat schemas in pubsub
URL: https://github.com/apache/beam/pull/10158#discussion_r349244486
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/pubsub/PubsubMessageToRow.java
 ##########
 @@ -95,28 +109,40 @@ public void processElement(ProcessContext context) {
    * payload, and attributes.
    */
   private List<Object> getFieldValues(ProcessContext context) {
+    Row payload = parsePayloadJsonRow(context.element());
     return messageSchema().getFields().stream()
-        .map(field -> getValueForField(field, context.timestamp(), 
context.element()))
+        .map(
+            field ->
+                getValueForField(
+                    field, context.timestamp(), 
context.element().getAttributeMap(), payload))
         .collect(toList());
   }
 
   private Object getValueForField(
-      Schema.Field field, Instant timestamp, PubsubMessage pubsubMessage) {
-
-    switch (field.getName()) {
-      case TIMESTAMP_FIELD:
+      Schema.Field field, Instant timestamp, Map<String, String> attributeMap, 
Row payload) {
+    // TODO: do this check once at construction time, rather than for every 
element.
 
 Review comment:
   Well what I wanted to do was make `PubsubMessageToRow` extend `PTransform` 
and switch out the implementation when expanding, but I keep getting hung up on 
the mutli-output/dlq stuff. 
 
----------------------------------------------------------------
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: 347580)
    Time Spent: 1.5h  (was: 1h 20m)

> 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: 1.5h
>  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)

Reply via email to