[ 
https://issues.apache.org/jira/browse/FLINK-22968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

DaChun updated FLINK-22968:
---------------------------
    Docs Text: 
package com.bytedance.one

import org.apache.flink.streaming.api.scala.{DataStream, 
StreamExecutionEnvironment}
import org.apache.flink.table.api.Table
import org.apache.flink.table.api.bridge.scala.StreamTableEnvironment
import org.apache.flink.api.scala._


object test {
  def main(args: Array[String]): Unit = {


    val env: StreamExecutionEnvironment = StreamExecutionEnvironment
      .createLocalEnvironmentWithWebUI()

    val stream: DataStream[String] = env.readTextFile("data/wc.txt")

    val tableEnvironment: StreamTableEnvironment = 
StreamTableEnvironment.create(env)


    val table: Table = tableEnvironment.fromDataStream(stream)

    tableEnvironment.createTemporaryView("wc", table)

    val res: Table = tableEnvironment.sqlQuery("select * from wc")

    tableEnvironment.toAppendStream[String](res).print()


    env.execute("test")
  }
}



  was:
package com.bytedance.one

import org.apache.flink.streaming.api.scala.{DataStream, 
StreamExecutionEnvironment}
import org.apache.flink.table.api.Table
import org.apache.flink.table.api.bridge.scala.StreamTableEnvironment
import org.apache.flink.api.scala._


object test {
  def main(args: Array[String]): Unit = {


    val env: StreamExecutionEnvironment = StreamExecutionEnvironment
      .createLocalEnvironmentWithWebUI()

    val stream: DataStream[String] = env.readTextFile("data/wc.txt")

    val tableEnvironment: StreamTableEnvironment = 
StreamTableEnvironment.create(env)


    val table: Table = tableEnvironment.fromDataStream(stream)

    tableEnvironment.createTemporaryView("wc", table)

    val res: Table = tableEnvironment.sqlQuery("select * from wc")

    tableEnvironment.toAppendStream[String](res).print()


    env.execute("DataStreamApp")
  }
}




>  String type cannot be used when creating Flink SQL
> ---------------------------------------------------
>
>                 Key: FLINK-22968
>                 URL: https://issues.apache.org/jira/browse/FLINK-22968
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.12.3, 1.13.1
>         Environment: {color:#FF0000}*Flink-1.13.1 and Flink-1.12.1*{color}
>            Reporter: DaChun
>            Priority: Blocker
>         Attachments: test.scala, this_error.txt
>
>
> When I run the program, the error is as follows:
> The specific error is in this_ error.txt,
> But the error prompts me to write an issue
> Caused by: org.apache.flink.api.common.InvalidProgramException: Table program 
> cannot be compiled. This is a bug. Please file an issue.
> It's very easy to read a stream and convert it into a table mode. The generic 
> type is string
> Then an error is reported. The code is in test. Scala and the error is in 
> this_ error.txt
> But I try to create an entity class by myself, and then assign generics to 
> this entity class, and then I can pass it normally,
> Or with row type, do you have to create your own entity class, not with 
> string type?
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to