beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-4162) Wire up PubsubIO+JSON to Beam SQL
Date Tue, 08 May 2018 16:12:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 08/May/18 16:11
            Start Date: 08/May/18 16:11
    Worklog Time Spent: 10m 
      Work Description: akedin 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_r186782821
 
 

 ##########
 File path: sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/BeamSqlCli.java
 ##########
 @@ -74,22 +75,31 @@ public String explainQuery(String sqlString) throws Exception {
   /**
    * Executes the given sql.
    */
-  public void execute(String sqlString) throws Exception {
+  public Optional<PCollection<Row>> execute(String sqlString) throws Exception
{
     BeamSqlParser parser = new BeamSqlParser(sqlString);
     SqlNode sqlNode = parser.impl().parseSqlStmtEof();
 
     if (sqlNode instanceof SqlCreateTable) {
       handleCreateTable((SqlCreateTable) sqlNode, metaStore);
-    } else if (sqlNode instanceof SqlDropTable) {
+      return Optional.empty();
+    }
+
+    if (sqlNode instanceof SqlDropTable) {
       handleDropTable((SqlDropTable) sqlNode);
-    } else {
-      PipelineOptions options = PipelineOptionsFactory.fromArgs(new String[] {}).withValidation()
-          .as(PipelineOptions.class);
-      options.setJobName("BeamPlanCreator");
-      Pipeline pipeline = Pipeline.create(options);
-      compilePipeline(sqlString, pipeline, env);
-      pipeline.run();
+      return Optional.empty();
     }
+
+    DirectOptions options =
+        PipelineOptionsFactory
+            .fromArgs()
+            .withValidation()
+            .as(DirectOptions.class);
+
+    options.setJobName("BeamPlanCreator");
+    Pipeline pipeline = Pipeline.create(options);
+    PCollection<Row> result = env.getPlanner().compileBeamPipeline(sqlString, pipeline,
env);
+    pipeline.run();
+    return Optional.of(result);
 
 Review comment:
   Ah, this was the hook for me to check the results. We briefly discussed it at some point,
currently it doesn't make sense, I'll remove this.

----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 99598)
    Time Spent: 4h 40m  (was: 4.5h)

> 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: 4h 40m
>  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)

Mime
View raw message