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

Nicholas Jiang edited comment on FLINK-22968 at 6/16/21, 11:55 AM:
-------------------------------------------------------------------

[~jark], If the 'toAppendStream' is deprecated, there is no need to improve the 
message for this method and this issue could be closed.

[~twalthr], what do you think about?


was (Author: nicholasjiang):
[~jark], If the 'toAppendStream' is deprecated, there is no need to improve the 
message for this method and this issue could be closed.
[~twalthr], what do you think about?

> Improve exception message when using toAppendStream[String]
> -----------------------------------------------------------
>
>                 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
>            Assignee: Nicholas Jiang
>            Priority: Major
>         Attachments: test.scala, this_error.txt
>
>
> {code:scala}
> 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")
>   }
> }
> {code}
> 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?
> h3. Summary
> We should improve the exception message a bit, we can throw the given type 
> (String) is not allowed in {{toAppendStream}}.
>  
>  
>  



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

Reply via email to