Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Does anybody know how to set the name for the table created using
fromDataStream() method ? Flink's documentation doesn't mention anything about this and when I went through the taskManager logs I saw some auto generated name like 'Unregistered_DataStream_5'. Here's my code : /StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env); Table eventsTable = tableEnv.fromDataStream( eventStream, $("id"), $("orgId"));/ Now if I want to run some sql query on this, using tableEnv.sqlQuery() where the SQL is the rule that I want to run on the events, so the SQL is read from the external source, I would need the table name for this table to be fixed so that the query writers can use that. -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi, tbud
You can register the Table API object as a temporary view and then run query on it: tableEnv.createTemporaryView(“MyTable”, eventsTable); tableEnv.executeSql(“SELECT * FROM MyTable“).print(); Best, Leonard > 在 2021年5月7日,03:17,tbud <[hidden email]> 写道: > > Does anybody know how to set the name for the table created using > fromDataStream() method ? Flink's documentation doesn't mention anything > about this and when I went through the taskManager logs I saw some auto > generated name like 'Unregistered_DataStream_5'. > Here's my code : > /StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env); > Table eventsTable = > tableEnv.fromDataStream( > eventStream, > $("id"), > $("orgId"));/ > Now if I want to run some sql query on this, using tableEnv.sqlQuery() where > the SQL is the rule that I want to run on the events, so the SQL is read > from the external source, I would need the table name for this table to be > fixed so that the query writers can use that. > > > > -- > Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Leonard,
Yes that would be one solution. But why is it necessary to create a temporaryView from already created table ? -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
The name “Table” is quite misleading here, the table API object Table actually represents a relational query (e.g. Table table = myTableObject.join(…).where(…).select(…)). Thus we use createTemporaryView(String path, Table view) rather than registerTable(String name, Table table) Given a background that registerTable(String name, Table table) is old interface and has been deprecated because the reason I explained. This is a part of FLIP-64[1] Hope I make this clear. Best, Leonard |
Free forum by Nabble | Edit this page |