table.show() in Flink

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

table.show() in Flink

Őrhidi Mátyás
Dear Flink Community,

I'm missing Spark's table.show() method in Flink. I'm using the following alternative at the moment:

Table results = tableEnv.sqlQuery("SELECT * FROM my_table");
tableEnv.toAppendStream(results, Row.class).print();
Is it the recommended way to print the content of a table?

Thanks,
Matyas


Reply | Threaded
Open this post in threaded view
|

Re: table.show() in Flink

Jark Wu-3
Hi Matyas,

AFAIK, currently, this is the recommended way to print result of table. 
In FLIP-84 [1] , which is targeted to 1.11, we will introduce some new APIs to do the fluent printing like this.

Table table2 = tEnv.sqlQuery("select yy ...");
TableResult result2 = table2.execute();
result2.print();

cc @Godfrey, please correct if I misunderstand the above API.

Best,
Jark


On Tue, 5 May 2020 at 20:19, Őrhidi Mátyás <[hidden email]> wrote:
Dear Flink Community,

I'm missing Spark's table.show() method in Flink. I'm using the following alternative at the moment:

Table results = tableEnv.sqlQuery("SELECT * FROM my_table");
tableEnv.toAppendStream(results, Row.class).print();
Is it the recommended way to print the content of a table?

Thanks,
Matyas


Reply | Threaded
Open this post in threaded view
|

Re: table.show() in Flink

Kurt Young
A more straightforward way after FLIP-84 would be:
TableResult result = tEnv.executeSql("select xxx ...");
result.print();

And if you are using 1.10 now, you can use TableUtils#collectToList(table) to collect the
result to a list, and then print rows by yourself.

Best,
Kurt


On Tue, May 5, 2020 at 8:44 PM Jark Wu <[hidden email]> wrote:
Hi Matyas,

AFAIK, currently, this is the recommended way to print result of table. 
In FLIP-84 [1] , which is targeted to 1.11, we will introduce some new APIs to do the fluent printing like this.

Table table2 = tEnv.sqlQuery("select yy ...");
TableResult result2 = table2.execute();
result2.print();

cc @Godfrey, please correct if I misunderstand the above API.

Best,
Jark


On Tue, 5 May 2020 at 20:19, Őrhidi Mátyás <[hidden email]> wrote:
Dear Flink Community,

I'm missing Spark's table.show() method in Flink. I'm using the following alternative at the moment:

Table results = tableEnv.sqlQuery("SELECT * FROM my_table");
tableEnv.toAppendStream(results, Row.class).print();
Is it the recommended way to print the content of a table?

Thanks,
Matyas


Reply | Threaded
Open this post in threaded view
|

Re: table.show() in Flink

Őrhidi Mátyás
Thanks guys for the prompt answers!

On Tue, May 5, 2020 at 2:49 PM Kurt Young <[hidden email]> wrote:
A more straightforward way after FLIP-84 would be:
TableResult result = tEnv.executeSql("select xxx ...");
result.print();

And if you are using 1.10 now, you can use TableUtils#collectToList(table) to collect the
result to a list, and then print rows by yourself.

Best,
Kurt


On Tue, May 5, 2020 at 8:44 PM Jark Wu <[hidden email]> wrote:
Hi Matyas,

AFAIK, currently, this is the recommended way to print result of table. 
In FLIP-84 [1] , which is targeted to 1.11, we will introduce some new APIs to do the fluent printing like this.

Table table2 = tEnv.sqlQuery("select yy ...");
TableResult result2 = table2.execute();
result2.print();

cc @Godfrey, please correct if I misunderstand the above API.

Best,
Jark


On Tue, 5 May 2020 at 20:19, Őrhidi Mátyás <[hidden email]> wrote:
Dear Flink Community,

I'm missing Spark's table.show() method in Flink. I'm using the following alternative at the moment:

Table results = tableEnv.sqlQuery("SELECT * FROM my_table");
tableEnv.toAppendStream(results, Row.class).print();
Is it the recommended way to print the content of a table?

Thanks,
Matyas


Reply | Threaded
Open this post in threaded view
|

Re: table.show() in Flink

Fabian Hueske-2
There's also the Table API approach if you want to avoid typing a "full" SQL query:

Table t = tEnv.from("myTable");

Cheers,
Fabian

Am Di., 5. Mai 2020 um 16:34 Uhr schrieb Őrhidi Mátyás <[hidden email]>:
Thanks guys for the prompt answers!

On Tue, May 5, 2020 at 2:49 PM Kurt Young <[hidden email]> wrote:
A more straightforward way after FLIP-84 would be:
TableResult result = tEnv.executeSql("select xxx ...");
result.print();

And if you are using 1.10 now, you can use TableUtils#collectToList(table) to collect the
result to a list, and then print rows by yourself.

Best,
Kurt


On Tue, May 5, 2020 at 8:44 PM Jark Wu <[hidden email]> wrote:
Hi Matyas,

AFAIK, currently, this is the recommended way to print result of table. 
In FLIP-84 [1] , which is targeted to 1.11, we will introduce some new APIs to do the fluent printing like this.

Table table2 = tEnv.sqlQuery("select yy ...");
TableResult result2 = table2.execute();
result2.print();

cc @Godfrey, please correct if I misunderstand the above API.

Best,
Jark


On Tue, 5 May 2020 at 20:19, Őrhidi Mátyás <[hidden email]> wrote:
Dear Flink Community,

I'm missing Spark's table.show() method in Flink. I'm using the following alternative at the moment:

Table results = tableEnv.sqlQuery("SELECT * FROM my_table");
tableEnv.toAppendStream(results, Row.class).print();
Is it the recommended way to print the content of a table?

Thanks,
Matyas