flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3829: [FLINK-6442] [table] Extend TableAPI Support Sink ...
Date Fri, 14 Jul 2017 13:55:33 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3829#discussion_r127459823
  
    --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/batch/sql/TableWithSQLITCase.scala
---
    @@ -113,4 +116,31 @@ class TableWithSQLITCase(
         val results = result.toDataSet[Row].collect()
         TestBaseUtils.compareResultAsText(results.asJava, expected)
       }
    +
    +  /** test insert into **/
    +  @Test
    +  def testInsertIntoTable(): Unit = {
    +    val tmpFile = File.createTempFile("flink-sql-table-sink-test1", ".tmp")
    +    tmpFile.deleteOnExit()
    +    val path = tmpFile.toURI.toString
    +
    +    val env = ExecutionEnvironment.getExecutionEnvironment
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +
    +    val t = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv).as('a, 'b, 'c)
    +    tEnv.registerTable("sourceTable", t)
    +
    +    val fieldTypes = tEnv.scan("sourceTable").getSchema.getTypes
    +    val fieldNames = Seq("d", "e", "f").toArray
    +    val sink = new CsvSQLTableSink(path, fieldTypes, fieldNames, ",")
    --- End diff --
    
    We could also implement a `TableSink` which stores results in a `static List` guarded
by a lock to synchronize this inserts. This would make the test faster and more reliable (going
of the the filesystem is a reason for flaky tests).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message