flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Hueske <fhue...@gmail.com>
Subject Re: Table API and registration of DataSet/DataStream
Date Sat, 09 Sep 2017 19:53:58 GMT
Hi Flavio,

I tried to follow your example. If I got it right, you would like to change
the registered table by assigning a different DataStream to the original
myDs variable.

With registerDataStream("test", myDs, ...) you don't register the variable
myDs as a table but it's current value, i.e., a reference to a DataStream
By changing the value of myDs, you just override the reference in myDs but
do not change the reference that was registered in Calcite's catalog.
This is common behavior in many programming languages including Java.

Right now, there is no way to change or override a registered table. We had
this functionality once, but had to remove it after a Calcite version
Can you use a new TableEnvironment and register the new table there?

Best, Fabian

2017-09-08 17:55 GMT+02:00 Flavio Pompermaier <pompermaier@okkam.it>:

> Hi to all,
> I have a doubt about Table API.
> Let's say my code is something like:
> StreamTableEnvironment te = ...;
> RowTypeInfo rtf = new RowTypeInfo(...);
> DataStream<Row> myDs =
> te.registerDataStream("test",myDs,columnNames);
> Table table = te.sql("SELECT *, (NAME = 'John') as VALID FROM test WHERE
> ...";
> myDs = te.toDataStream(table.where("VALID").select(columnNames), rtf);
> If I do:
> DataStream<Row> res = te.sql("SELECT * FROM test");
> I'd like that res could take the data from the last version of myDs...is
> this program correct..?
> Or should I override the "test" table in the tableEnvironment? Is that
> possible? I don't see any API to allow this..
> Best,
> Flavio

View raw message