-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[FLINK-29922] Support create external table for hive catalog #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-29922] Support create external table for hive catalog #357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks wxplovecc for the contribution.
Can you add a test case for create external table
?
@@ -49,6 +49,12 @@ private CatalogOptions() {} | |||
.noDefaultValue() | |||
.withDescription("Uri of metastore server."); | |||
|
|||
public static final ConfigOption<Boolean> HMS_EXTERNAL = | |||
ConfigOptions.key("hms.external") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wxplovecc,could this introduce the TableType
enum and table.type
config option which default value is MANAGED_TABLE
? In the CatalogOptions
, the hms.external
is specific for core module.
cc @JingsongLi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SteNicholas Thanks for review, updated
ConfigOptions.key("table.type") | ||
.enumType(TableType.class) | ||
.defaultValue(TableType.MANAGED_TABLE) | ||
.withDescription("Table type of hms table, MANAGED_TABLE/EXTERNAL_TABLE."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.withDescription("Table type of hms table, MANAGED_TABLE/EXTERNAL_TABLE."); | |
.withDescription("Type of table."); |
|
||
package org.apache.flink.table.store.table; | ||
|
||
/** TableType enum of catalog table. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** TableType enum of catalog table. */ | |
/** Enum of catalog table type. */ |
|
||
/** Enum of catalog table type. */ | ||
public enum TableType { | ||
MANAGED_TABLE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MANAGED
and EXTERNAL
is OK.
Can you let it implements DescribedEnum
just like ChangelogProducer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -226,6 +227,13 @@ public void createTable(ObjectPath tablePath, UpdateSchema updateSchema, boolean | |||
e); | |||
} | |||
Table table = newHmsTable(tablePath); | |||
|
|||
if (hiveConf.getEnum(TABLE_TYPE.key(), TableType.MANAGED_TABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to move this logic to newHmsTable
which initialzes the Table
and sets the parameters of the Table
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
/** Enum of catalog table type. */ | ||
public enum TableType implements DescribedEnum { | ||
MANAGED("MANAGED_TABLE", "Hive manage the lifecycle of the table."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MANAGED("MANAGED_TABLE", "Hive manage the lifecycle of the table."), | |
MANAGED("MANAGED_TABLE", "Table Store owned table where the entire lifecycle of the table data is managed."), |
/** Enum of catalog table type. */ | ||
public enum TableType implements DescribedEnum { | ||
MANAGED("MANAGED_TABLE", "Hive manage the lifecycle of the table."), | ||
EXTERNAL("EXTERNAL_TABLE", "Files are already present or in remote locations."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXTERNAL("EXTERNAL_TABLE", "Files are already present or in remote locations."); | |
EXTERNAL("EXTERNAL_TABLE", "The table where Table Store has loose coupling with the data stored in external locations."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated @SteNicholas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
support hive catalog to create external table