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

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

                Author: ASF GitHub Bot
            Created on: 30/Apr/18 22:46
            Start Date: 30/Apr/18 22:46
    Worklog Time Spent: 10m 
      Work Description: apilloud commented on a change in pull request #5253: 
[BEAM-4162][SQL] Wire up PubsubIO to SQL
URL: https://github.com/apache/beam/pull/5253#discussion_r185131687
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/pubsub/PubsubJsonTableProvider.java
 ##########
 @@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.extensions.sql.meta.provider.pubsub;
+
+import static 
org.apache.beam.sdk.extensions.sql.meta.provider.MetaUtils.getSchema;
+
+import com.alibaba.fastjson.JSONObject;
+import java.util.Collections;
+import java.util.List;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.annotations.Internal;
+import org.apache.beam.sdk.extensions.sql.BeamSqlTable;
+import org.apache.beam.sdk.extensions.sql.meta.Table;
+import org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider;
+import org.apache.beam.sdk.io.gcp.pubsub.PubsubIO;
+import org.apache.beam.sdk.schemas.Schema;
+
+/**
+ * {@link TableProvider} for {@link PubsubIOJsonTable} which wraps {@link 
PubsubIO} for Beam SQL.
+ */
+@Internal
+@Experimental
+public class PubsubJsonTableProvider implements TableProvider {
+
+  @Override
+  public BeamSqlTable buildBeamSqlTable(Table table) {
+    Schema tableSchema = getSchema(table);
+
+    JSONObject tableProperties = table.getProperties();
+    String timestampAttributeKey = 
tableProperties.getString("timestampAttributeKey");
+
+    if (timestampAttributeKey == null) {
+      throw new IllegalArgumentException(
+          "Unable to find 'timestampAttributeKey' property "
+          + "in TBLPROPERTIES JSON. At the moment Pubsub table "
+          + "have to explicitly declare the 'timestampAttributeKey', "
+          + "so that event time can be determined. Publish time "
 
 Review comment:
   I thought we talked about using publish time for alpha so we wouldn't have 
to worry about late data?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 96871)
    Time Spent: 20m  (was: 10m)

> Wire up PubsubIO+JSON to Beam SQL
> ---------------------------------
>
>                 Key: BEAM-4162
>                 URL: https://issues.apache.org/jira/browse/BEAM-4162
>             Project: Beam
>          Issue Type: New Feature
>          Components: dsl-sql
>            Reporter: Anton Kedin
>            Assignee: Anton Kedin
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Read JSON messages from Pubsub, convert them to Rows (BEAM-4160), wire up to 
> Beam SQL.
>  
> Use publication time as event timestamp



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to