Hi dear Flink developers,

I'm quite confused by the "create view" statement in SQL client.

>From traditional database we expect that a view behaves just like a table
except that it will be computed when used. We also expect that a view
should be created under a database just like a table.

But when I create a view in SQL client and switch to another database by
the "use" statement, the view is still there. It seems that this view is
created in all databases under the same catalog.

I look into the source code and discover that the view I created is
actually a temporary view. In
https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/common.html it
is stated that

> On the other hand, temporary tables are always stored in memory and only
> exist for the duration of the Flink session they are created within. These
> tables are not visible to other sessions. They are not bound to any catalog
> or database but can be created in the namespace of one. Temporary tables
> are not dropped if their corresponding database is removed.

So this seems to be the desired behavior.

What seems really strange is that in SQL client, by using the "create
table" statement I'll get a permanent table, while by using the "create
view" statement I'll get a temporary view, which is sort of inconsistent.

So I would like to discuss that

   1. Shall we make it clear and support create table / create temporary
   table / create view / create temporary view statements?
   2. If yes, shall we need to support them just in SQL client or in SQL
   parser, or in some other places?
   3. Shall catalog manager support creating both permanent and temporary
   views?

Thanks.

Reply via email to