[ 
https://issues.apache.org/jira/browse/FLINK-3727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15250606#comment-15250606
 ] 

ASF GitHub Bot commented on FLINK-3727:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1917#discussion_r60477908
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/sql/streaming/test/SelectITCase.scala
 ---
    @@ -0,0 +1,117 @@
    +/*
    + * 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.api.scala.sql.streaming.test
    +
    +import org.apache.flink.api.scala._
    +import org.apache.flink.api.scala.table._
    +import 
org.apache.flink.api.scala.table.streaming.test.utils.{StreamITCase, 
StreamTestData}
    +import org.apache.flink.api.table.{Row, TableEnvironment}
    +import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
    +import org.apache.flink.streaming.util.StreamingMultipleProgramsTestBase
    +import org.junit.Assert._
    +import org.junit._
    +
    +import scala.collection.mutable
    +
    +class SelectITCase extends StreamingMultipleProgramsTestBase {
    +
    +  @Test
    +  def testSelectStarFromTable(): Unit = {
    +
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.testResults = mutable.MutableList()
    +
    +    val sqlQuery = "SELECT STREAM * FROM MyTable"
    +
    +    val t = StreamTestData.getSmall3TupleDataStream(env).toTable(tEnv)
    +    tEnv.registerTable("MyTable", t)
    +
    +    val result = tEnv.sql(sqlQuery).toDataStream[Row]
    +    result.addSink(new StreamITCase.StringSink)
    +    env.execute()
    +
    +    val expected = mutable.MutableList(
    +      "1,1,Hi",
    +      "2,2,Hello",
    +      "3,2,Hello world")
    +    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
    +  }
    +
    +  @Test
    +  def testSelectFirstFromTable(): Unit = {
    +
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.testResults = mutable.MutableList()
    +
    +    val sqlQuery = "SELECT STREAM a FROM MyTable"
    +
    +    val t = 
StreamTestData.getSmall3TupleDataStream(env).toTable(tEnv).as('a, 'b, 'c)
    +    tEnv.registerTable("MyTable", t)
    +
    +    val result = tEnv.sql(sqlQuery).toDataStream[Row]
    +    result.addSink(new StreamITCase.StringSink)
    +    env.execute()
    +
    +    val expected = mutable.MutableList("1", "2", "3")
    +    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
    +  }
    +
    +  @Test
    +  def testSelectExpressionFromTable(): Unit = {
    +
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.testResults = mutable.MutableList()
    +
    +    val sqlQuery = "SELECT STREAM a * 2, b - 1 FROM MyTable"
    +
    +    val t = 
StreamTestData.getSmall3TupleDataStream(env).toTable(tEnv).as('a, 'b, 'c)
    +    tEnv.registerTable("MyTable", t)
    +
    +    val result = tEnv.sql(sqlQuery).toDataStream[Row]
    +    result.addSink(new StreamITCase.StringSink)
    +    env.execute()
    +
    +    val expected = mutable.MutableList("2,0", "4,1", "6,1")
    +    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
    +  }
    +
    +
    +  @Test
    +  def testSelectSecondFromDataStream(): Unit = {
    --- End diff --
    
    This test might be removed.


> Add support for embedded streaming SQL (projection, filter, union)
> ------------------------------------------------------------------
>
>                 Key: FLINK-3727
>                 URL: https://issues.apache.org/jira/browse/FLINK-3727
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API
>    Affects Versions: 1.1.0
>            Reporter: Vasia Kalavri
>            Assignee: Vasia Kalavri
>
> Similar to the support for SQL embedded in batch Table API programs, this 
> issue tracks the support for SQL embedded in stream Table API programs. The 
> only currently supported operations on streaming Tables are projection, 
> filtering, and union.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to