[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15404074#comment-15404074 ] ASF GitHub Bot commented on FLINK-4180: --- Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/2274 > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15403930#comment-15403930 ] ASF GitHub Bot commented on FLINK-4180: --- Github user twalthr commented on the issue: https://github.com/apache/flink/pull/2274 Thanks @wuchong. I will add some additional comments/formatting and merge it... > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15391206#comment-15391206 ] ASF GitHub Bot commented on FLINK-4180: --- Github user nssalian commented on the issue: https://github.com/apache/flink/pull/2274 LGTM after the nits. But I would request someone else have a pass over it before moving forward since I am new to the code. > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15391205#comment-15391205 ] ASF GitHub Bot commented on FLINK-4180: --- Github user nssalian commented on a diff in the pull request: https://github.com/apache/flink/pull/2274#discussion_r71998373 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/examples/scala/StreamTableExample.scala --- @@ -0,0 +1,56 @@ +/* + * 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.flink.examples.scala + +import org.apache.flink.api.scala._ +import org.apache.flink.api.scala.table._ +import org.apache.flink.api.table.TableEnvironment +import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment} + +/** + * Simple example for demonstrating the use of Table API on Stream Table. + */ +object StreamTableExample { + + case class Order(user: Long, product: String, amount: Int) + + def main(args: Array[String]): Unit = { +val env = StreamExecutionEnvironment.getExecutionEnvironment --- End diff -- Here as well. Would suggest to the same comment as in WordCountSQL.scala: // set up execution environment > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15391203#comment-15391203 ] ASF GitHub Bot commented on FLINK-4180: --- Github user nssalian commented on a diff in the pull request: https://github.com/apache/flink/pull/2274#discussion_r71998370 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/examples/scala/StreamSQLExample.scala --- @@ -0,0 +1,60 @@ +/* + * 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.flink.examples.scala + +import org.apache.flink.api.scala._ +import org.apache.flink.api.scala.table._ +import org.apache.flink.api.table.TableEnvironment +import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment} + +/** + * Simple example for demonstrating the use of SQL on Stream Table. + */ +object StreamSQLExample { + + case class Order(user: Long, product: String, amount: Int) + + def main(args: Array[String]): Unit = { +val env = StreamExecutionEnvironment.getExecutionEnvironment --- End diff -- Same here as well Would suggest to the same comment as in WordCountSQL.scala: // set up execution environment > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15391202#comment-15391202 ] ASF GitHub Bot commented on FLINK-4180: --- Github user nssalian commented on a diff in the pull request: https://github.com/apache/flink/pull/2274#discussion_r71998367 --- Diff: flink-libraries/flink-table/src/main/java/org/apache/flink/examples/java/JavaSQLExample.java --- @@ -0,0 +1,70 @@ +/* + * 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.flink.examples.java; + +import org.apache.flink.api.table.Table; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.table.BatchTableEnvironment; +import org.apache.flink.api.table.TableEnvironment; + +/** + * Simple example that shows how the Batch SQL used in Java. + */ +public class JavaSQLExample { + + public static class WC { + public String word; + public long frequency; + + // Public constructor to make it a Flink POJO + public WC() { + + } + + public WC(String word, long frequency) { + this.word = word; + this.frequency = frequency; + } + + @Override + public String toString() { + return "WC " + word + " " + frequency; + } + } + + public static void main(String[] args) throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); --- End diff -- Would suggest to the same comment as in WordCountSQL.scala: // set up execution environment > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15390991#comment-15390991 ] ASF GitHub Bot commented on FLINK-4180: --- Github user wuchong commented on the issue: https://github.com/apache/flink/pull/2274 @smarthi Thanks for reviewing. I have addressed the typo. > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15390913#comment-15390913 ] ASF GitHub Bot commented on FLINK-4180: --- Github user smarthi commented on a diff in the pull request: https://github.com/apache/flink/pull/2274#discussion_r71981015 --- Diff: flink-libraries/flink-table/src/main/java/org/apache/flink/examples/java/JavaSQLExample.java --- @@ -0,0 +1,70 @@ +/* + * 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.flink.examples.java; + +import org.apache.flink.api.table.Table; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.table.BatchTableEnvironment; +import org.apache.flink.api.table.TableEnvironment; + +/** + * Simple example that shows how the Batch SQL used in Java. + */ +public class JavaSQLExample { + + public static class WC { + public String word; + public long frequence; --- End diff -- knitpick: change that to 'frequency' :) > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15386164#comment-15386164 ] ASF GitHub Bot commented on FLINK-4180: --- GitHub user wuchong opened a pull request: https://github.com/apache/flink/pull/2274 [FLINK-4180] [FLINK-4181] [table] add Batch SQL and Stream SQL and Stream Table API examples [FLINK-4180] [FLINK-4181] [table] add Batch SQL and Stream SQL and Stream Table API examples I add 4 examples for flink-table module 1. `org.apache.flink.examples.java.JavaSQLExample`: Batch SQL in Java 1. `org.apache.flink.examples.scala.WordCountSQL`: Batch SQL in Scala 2. `org.apache.flink.examples.scala.StreamSQLExample`: Stream SQL in Scala 3. `org.apache.flink.examples.scala.StreamTableExample`: Stream Table API in Scala You can merge this pull request into a Git repository by running: $ git pull https://github.com/wuchong/flink table-example Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/2274.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2274 commit 8b3c468adb574f229c6d24da58d4e52c4a025cec Author: Jark WuDate: 2016-07-20T16:31:01Z [FLINK-4180] [FLINK-4181] [table] add Batch SQL and Stream SQL and Stream Table API examples > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther >Assignee: Jark Wu > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4180) Create a batch SQL example
[ https://issues.apache.org/jira/browse/FLINK-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15367808#comment-15367808 ] Jark Wu commented on FLINK-4180: I'll work on this. > Create a batch SQL example > -- > > Key: FLINK-4180 > URL: https://issues.apache.org/jira/browse/FLINK-4180 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL >Reporter: Timo Walther > Labels: starter > > Currently there is no runnable code example in `flink-table` showing a > working batch SQL query with the Table API. > A Scala and Java example should be added. -- This message was sent by Atlassian JIRA (v6.3.4#6332)