how to print for result1 in this code

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to print for result1 in this code

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

The code is:

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


Thanks for your help.
Reply | Threaded
Open this post in threaded view
|

Re: how to print for result1 in this code

r_khachatryan
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 大森林 <[hidden email]> wrote:
I'm learning official document
But the example is not complete.

The code is:

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


Thanks for your help.