You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by 大森林 <ap...@foxmail.com> on 2020/10/18 03:33:39 UTC

how to print for result1 in this code

I'm learning official document
But the example is not complete.


The code is:
https://paste.ubuntu.com/p/Mx96MWjQ83/


Could you tell me
how to print result1
in above code?
(The above code is wrong)




Thanks for your help.

Re: how to print for result1 in this code

Posted by Khachatryan Roman <kh...@gmail.com>.
To print the result you can create a POJO class matching your projected
fields and use it on line 38 instead of String.class.

For example:
Table result1 = tableA.select("content, content.hashCode() as h1,
hashCode(content) as h2");
tableEnv.toDataSet(result1, HashCodeSelect.class).print();

public static class HashCodeSelect {
  public String content;
  public int h1;
  public int h2;
  // toString
}

Regards,
Roman


On Sun, Oct 18, 2020 at 5:36 AM 大森林 <ap...@foxmail.com> wrote:

> I'm learning official document
> But the example is not complete.
>
> The code is:
> https://paste.ubuntu.com/p/Mx96MWjQ83/
>
> Could you tell me
> how to print result1
> in above code?
> (The above code is wrong)
>
>
> Thanks for your help.
>