I'm fine with `type` for consistency reasons for now. I hope we will fix
that when we rework the properties design.
@Bowen: could you update the wiki page? I think we could start a vote,
On 11.10.19 04:31, Jark Wu wrote:
I agree that we are going to rework properties soon.
But we may come up with a better name or a better way than "kind" when the
proposal is started and more people involved.
On the other hand, reworking properties should be a compatible way.
So I think it's fine to use "type" for now (keep consistent with others)
and change them all together when refactoring in the near future.
On Thu, 10 Oct 2019 at 21:12, Timo Walther <twal...@apache.org> wrote:
restricting one module instance per kind sounds good to me. Modules can
implement hashCode/equals and we can perform the check you metioned. The
equals() method can determine what "same kind" means.
Correct me if I'm wrong, but we wanted to perform a big properties
rework soonish anyway, no? Then we can also change `connector.type` to
In Calcite they distinguish between `type` and `kind`:
In Flink 1.9, we also started with
org.apache.flink.table.functions.FunctionDefinition#getKind because type
is just heavily overloaded with different meanings. Logical type, data
type, connector type, etc.
On 10.10.19 14:40, Jark Wu wrote:
Thanks for the explanation, it makes sense to me.
So at least, we can have a validation to restrict one module instance per
type in the first version.
Regarding to "type" vs "kind", could we use "datatype" keyword to refer
data types exclusively in the future?
This can avoid the conflict/confusion when we use "type" here.
The concern of using "kind" is that it is inconsistent with other
We have heavily used "type" in properties, including `connector.type`,
`format.type`, `catalog.type`, etc...
Are we planning to change them all ?
On Thu, 10 Oct 2019 at 19:56, Timo Walther <twal...@apache.org> wrote:
we had a long offline discussion yesterday where we considered all
options again. The reasons why we decided for the updated design that
- Both Dawid and Xuefu argued that in the old design "kind" has binary
meanings. I agree here.
- Compared to other SQL concepts such as tables/functions/catalogs, a
"name" is never part of the object itself but always specified when
registering the object. We should have the same behavior for modules
because of consistency reasons. It also makes the "name" explicit when
it comes to unloading the module compared to the previous design.
- Regarding, "How to solve the class conflict problem?" this is an
orthogonal issue that will be fixed in future versions once we use
Flink's new plugin architecture. If a module is parameterizable, it is
the responsibility of the module to prevent class conflicts. If the Hive
classes are hidden in a module classloader, it should be possible to
load both hive121 and hive234. But in general this problem is unsolved
for now, also Kafka tables could clash if you read from two Kafka
clusters with different versions.
On 10.10.19 08:01, Jark Wu wrote:
If there is only one instance per type, then what's the "name" used
Could we remove it and only keep "type" or "kind" to identify modules?
On Thu, 10 Oct 2019 at 11:21, Xuefu Z <usxu...@gmail.com> wrote:
Jark has a good point. However, I think validation logic can put in
to restrict one instance per type. Maybe the doc needs to be specific
On Wed, Oct 9, 2019 at 7:41 PM Jark Wu <imj...@gmail.com> wrote:
Thanks Bowen for the updating.
I have some different opinions on the change.
IIUC, in the previous design, the "name" is also the "id" or "type"
identify which module to load. Which means we can only load one
In the new design, the "name" is just an alias to the module
"kind" is used to identify modules. Which means we can load different
instances of a module.
However, what's the "name" or alias used for? Do we need to support
different instances of a module? From my point of view, it brings
complexity and confusion.
For example, if we load a "hive121" which uses HiveModule with
1.2.1 and load a "hive234" which uses HiveModule with version 2.3.4,
how to solve the class conflict problem?
IMO, a module can only be load once in a session, so "name" maybe
So my proposal is similar to the previous one, but only change "name"
LOAD MODULE "kind" [WITH (properties)];
UNLOAD MODULE "kind";
tEnv.loadModule("kind" [, properties]);
What do you think?
On Wed, 9 Oct 2019 at 20:38, Bowen Li <bowenl...@gmail.com> wrote:
Thanks everyone for your review.
After discussing with Timo and Dawid offline, as well as
feedback from Xuefu and Jark on mailing list, I decided to make a
critical changes to the proposal.
- renamed the keyword "type" to "kind". The community has plan to
"type" keyword in yaml/descriptor refer to data types exclusively in
near future. We should cater to that change in our design
- allowed specifying names for modules to simplify and unify module
loading/unloading syntax between programming and SQL. Here're the
LOAD MODULE "name" WITH ("kind"="xxx" [, (properties)])
UNLOAD MODULE "name";
tEnv.loadModule("name", new Xxx(properties));
I have completely updated the google doc . Please take another
let me know if you have any other questions. Thanks!
On Tue, Oct 8, 2019 at 6:26 AM Jark Wu <imj...@gmail.com> wrote:
Thanks for the proposal. I have two thoughts:
1) Regarding to "loadModule", how about
tableEnv.loadModule("xxx" [, propertiesMap]);
This makes the API similar to SQL. IMO, instance of Module is not
and verbose as parameter.
And this makes it easier to load a simple module without any
properties, e.g. tEnv.loadModule("GEO"), tEnv.unloadModule("GEO")
2) In current design, the module interface only defines function
but no implementations.
I'm wondering how to call/map the implementations in runtime? Am I
Besides, I left some minor comments in the doc.
On Sat, 5 Oct 2019 at 08:42, Xuefu Z <usxu...@gmail.com> wrote:
I agree with Timo that the new table APIs need to be consistent.
further that an name (or id) is needed for module definition in
In the current design, name is skipped and type has binary
On Fri, Oct 4, 2019 at 5:24 AM Timo Walther <twal...@apache.org>
first, I was also questioning my proposal. But Bowen's proposal
`tEnv.offloadToYaml(<file_path>)` would not work with the current
because we don't know how to serialize a catalog or module into
properties. Currently, there is no converter from instance to
properties. It is a one way conversion. We can add a
method to both Catalog and Module class in the future to solve
Solving the table environment serializability can be future work.
However, I find the current proposal for the TableEnvironment
The loading is specified programmatically whereas the unloading
a string that is not specified in the module itself. But is
the factory according to the current design.
SQL does it more consistently. There, the name `xxx` is used when
loading and unloading the module:
LOAD MODULE 'xxx' [WITH ('prop'='myProp', ...)]
UNLOAD MODULE 'xxx’
tableEnv.loadModule("xxx", new Yyy());
This would be similar to the catalog interfaces. The name is not
the instance itself.
What do you think?
On 01.10.19 21:17, Bowen Li wrote:
If something like the yaml file is the way to go and achieve
motivation, we would cover that with current design.
On Tue, Oct 1, 2019 at 12:05 Bowen Li <bowenl...@gmail.com>
Hi Timo, Dawid,
I've added the suggested SQL and related changes to
and other classes to the google doc. Also removed "USE MODULE"
APIs. Will update FLIP wiki once we have a consensus.
W.r.t. descriptor approach, my gut feeling is similar to
I feel yaml file would be a better solution to persist
of an environment as the file itself is in serializable format
Though yaml file only serves SQL CLI at this moment, we may be
extend its reach to Table API and allow users to load/offload
TableEnvironment from/to yaml files, as something like
tEnv = TableEnvironment.loadFromYaml(<file_path>)" and
"tEnv.offloadToYaml(<file_path>)" to restore and persist
make yaml file more expressive.
On Tue, Oct 1, 2019 at 6:47 AM Dawid Wysakowicz <
Hi Timo, Bowen,
Unfortunately I did not have enough time to go through all
suggestions in details so I can not comment on the whole
I just wanted to give my opinion on the "descriptor approach
loadModule" part. I am not sure if we need it here. We might
overthinking this a bit. It definitely makes sense for
TableSource/TableSink etc. as they are logical definitions
always have to be persisted in a Catalog. I'm not sure if we
the same for a whole session. If we need a resume session
way to go would probably be to keep the session in memory on
side. I fear we will never be able to serialize the whole
entirely (temporary objects, objects derived from DataStream
I think it is ok to use instances for objects like Catalogs
and have an overlay on top of that that can create instances
On 01/10/2019 11:28, Timo Walther wrote:
thanks for your response.
Re 2) I also don't have a better approach for this issue. It
similar to changing the general TableConfig between two
would be good to add your explanation to the design
Re 3) It would be interesting to know about which "core"
are actually talking about. Also for the overriding built-in
that we discussed in the other FLIP. But I'm fine with
the user for now. How about we just introduce loadModule(),
unloadModule() methods instead of useModules()? This would
users don't forget to add the core module when adding an
module and they need to explicitly call
Re 4) Every table environment feature should also be
statements in mind to verify the concept. SQL is also more
that Java/Scala API or YAML file. I would like to add it to
marking the feature as complete.
SHOW MODULES -> sounds good to me, we should add a
List<String> method to table environment
LOAD MODULE 'hive' [WITH ('prop'='myProp', ...)] --> we
loadModule() method to table environment
UNLOAD MODULE 'hive' --> we should add a unloadModule()
I would not introduce `USE MODULES 'x' 'y' 'z'` for
concise API. Users need to load the module anyway with
They can also load them "in order" immediately. CREATE TABLE
not create multiple tables but only one at a time in that
One thing that came to my mind, shall we use a descriptor
loadModule()? The past has shown that passing instances
problems when persisting objects. That's why we also want to
of registerTableSource. I could image that users might want
a table environment's state for later use in the future.
this is future work, we should already keep such use cases
when adding new API methods. What do you think?
On 30.09.19 23:17, Bowen Li wrote:
Re 1) I agree. I renamed the title to "Extend Core Table
Pluggable Modules" and all internal references
Re 2) First, I'll rename the API to useModules(). The
users to call useModules() multi times. Objects in modules
demand instead of eagerly, so there won't be inconsistency.
be fully aware of the consequences of resetting modules as
that some objects can not be referenced anymore or
Re 3) Yes, we'd leave that to users.
Another approach can be to have a non-optional "Core"
objects that cannot be overrode like "CAST" and "AS"
optional "ExtendedCore" module for other replaceable
"Core" should be positioned at the 1st in module list all
I'm fine with either solution.
Re 4) It may sound like a nice-to-have advanced feature for
can surely fully discuss it for the sake of feature
Unlike other configs, the order of modules would matter in
implies the LOAD/UNLOAD commands would not be equal in
IIUYC, LOAD MODULE 'x' would be interpreted as appending x
module list, and UNLOAD MODULE 'x' would be interpreted as
any position in the list?
I'm thinking of the following list of commands:
SHOW MODULES - list modules in order
LOAD MODULE 'hive' [WITH ('prop'='myProp', ...)] - load and
module to end of the module list
UNLOAD MODULE 'hive' - remove the module from module list,
modules remain the same relative positions
USE MODULES 'x' 'y' 'z' (wondering can parser take "'x' 'y'
MODULES 'x,y,z' - to reorder module list completely
"In Honey We Trust!"
"In Honey We Trust!"