You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ta...@apache.org on 2017/07/20 23:15:07 UTC

[1/2] beam git commit: remove README.md and update usages in BeamSqlExample

Repository: beam
Updated Branches:
  refs/heads/DSL_SQL ada24c059 -> 0eb8e89ba


remove README.md and update usages in BeamSqlExample


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/f1aa390d
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/f1aa390d
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/f1aa390d

Branch: refs/heads/DSL_SQL
Commit: f1aa390d1989543f2848dae6b26596ffd1a5d8db
Parents: ada24c0
Author: mingmxu <mi...@ebay.com>
Authored: Thu Jul 20 14:32:42 2017 -0700
Committer: mingmxu <mi...@ebay.com>
Committed: Thu Jul 20 14:32:42 2017 -0700

----------------------------------------------------------------------
 dsls/sql/README.md                              | 24 --------------------
 .../beam/dsls/sql/example/BeamSqlExample.java   | 23 +++++++++++--------
 2 files changed, 13 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/f1aa390d/dsls/sql/README.md
----------------------------------------------------------------------
diff --git a/dsls/sql/README.md b/dsls/sql/README.md
deleted file mode 100644
index ae9e0f3..0000000
--- a/dsls/sql/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-    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.
--->
-
-# Beam SQL
-
-Beam SQL provides a new interface, to execute a SQL query as a Beam pipeline.
-
-*It's working in progress...*

http://git-wip-us.apache.org/repos/asf/beam/blob/f1aa390d/dsls/sql/src/main/java/org/apache/beam/dsls/sql/example/BeamSqlExample.java
----------------------------------------------------------------------
diff --git a/dsls/sql/src/main/java/org/apache/beam/dsls/sql/example/BeamSqlExample.java b/dsls/sql/src/main/java/org/apache/beam/dsls/sql/example/BeamSqlExample.java
index 91df2be..4e364e1 100644
--- a/dsls/sql/src/main/java/org/apache/beam/dsls/sql/example/BeamSqlExample.java
+++ b/dsls/sql/src/main/java/org/apache/beam/dsls/sql/example/BeamSqlExample.java
@@ -34,16 +34,19 @@ import org.apache.beam.sdk.values.PBegin;
 import org.apache.beam.sdk.values.PCollection;
 import org.apache.beam.sdk.values.PCollectionTuple;
 import org.apache.beam.sdk.values.TupleTag;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * This is a quick example, which uses Beam SQL DSL to create a data pipeline.
  *
+ * <p>Run the example with
+ * <pre>
+ * mvn -pl dsls/sql compile exec:java \
+ *  -Dexec.mainClass=org.apache.beam.dsls.sql.example.BeamSqlExample \
+ *   -Dexec.args="--runner=DirectRunner" -Pdirect-runner
+ * </pre>
+ *
  */
 class BeamSqlExample {
-  private static final Logger LOG = LoggerFactory.getLogger(BeamSqlExample.class);
-
   public static void main(String[] args) throws Exception {
     PipelineOptions options = PipelineOptionsFactory.fromArgs(args).as(PipelineOptions.class);
     Pipeline p = Pipeline.create(options);
@@ -63,9 +66,9 @@ class BeamSqlExample {
 
     //Case 1. run a simple SQL query over input PCollection with BeamSql.simpleQuery;
     PCollection<BeamSqlRow> outputStream = inputTable.apply(
-        BeamSql.simpleQuery("select c2, c3 from PCOLLECTION where c1=1"));
+        BeamSql.simpleQuery("select c1, c2, c3 from PCOLLECTION where c1=1"));
 
-    //log out the output record;
+    //print the output record of case 1;
     outputStream.apply("log_result",
         MapElements.<BeamSqlRow, Void>via(new SimpleFunction<BeamSqlRow, Void>() {
       public Void apply(BeamSqlRow input) {
@@ -74,12 +77,12 @@ class BeamSqlExample {
       }
     }));
 
-    //Case 2. run the query with BeamSql.query
+    //Case 2. run the query with BeamSql.query over result PCollection of case 1.
     PCollection<BeamSqlRow> outputStream2 =
-        PCollectionTuple.of(new TupleTag<BeamSqlRow>("TABLE_B"), inputTable)
-        .apply(BeamSql.query("select c2, c3 from TABLE_B where c1=1"));
+        PCollectionTuple.of(new TupleTag<BeamSqlRow>("CASE1_RESULT"), outputStream)
+        .apply(BeamSql.query("select c2, c3 from CASE1_RESULT where c1=1"));
 
-    //log out the output record;
+    //print the output record of case 2;
     outputStream2.apply("log_result",
         MapElements.<BeamSqlRow, Void>via(new SimpleFunction<BeamSqlRow, Void>() {
       @Override


[2/2] beam git commit: [BEAM-2555] This closes #3605

Posted by ta...@apache.org.
[BEAM-2555] This closes #3605


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/0eb8e89b
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/0eb8e89b
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/0eb8e89b

Branch: refs/heads/DSL_SQL
Commit: 0eb8e89babbe758c15457bc10d44c815ebaf7709
Parents: ada24c0 f1aa390
Author: Tyler Akidau <ta...@apache.org>
Authored: Thu Jul 20 16:14:51 2017 -0700
Committer: Tyler Akidau <ta...@apache.org>
Committed: Thu Jul 20 16:14:51 2017 -0700

----------------------------------------------------------------------
 dsls/sql/README.md                              | 24 --------------------
 .../beam/dsls/sql/example/BeamSqlExample.java   | 23 +++++++++++--------
 2 files changed, 13 insertions(+), 34 deletions(-)
----------------------------------------------------------------------