-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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-21727][hive] Support DDL in HiveParser #15151
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit ec1a240 (Sat Aug 28 11:13:34 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
a511cf1
to
5c3eccb
Compare
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 @lirui-apache for the great work. I left some comment.
...-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
Show resolved
Hide resolved
...-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
Outdated
Show resolved
Hide resolved
DDLOperationConverter ddlConverter = | ||
new DDLOperationConverter(getCatalogManager(), hiveShim); | ||
if (work instanceof HiveParserCreateViewDesc) { | ||
return super.parse(cmd); |
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.
Why this is delegated to super parser?
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.
Because HiveParser
cannot parse queries at the moment.
} | ||
|
||
private Operation convertShowFunctions(ShowFunctionsDesc desc) { | ||
return new ShowFunctionsOperation(); |
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.
Disable like pattern for now?
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.
HiveParserDDLSemanticAnalyzer::analyzeShowFunctions
would throw an exception for "SHOW FUNCTIONS LIKE"
funcDefFactory.createFunctionDefinition( | ||
desc.getFunctionName(), | ||
new CatalogFunctionImpl(desc.getClassName(), FunctionLanguage.JAVA)); | ||
return new CreateTempSystemInlineFunctionOperation( |
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.
Is it necessary to introduce a new operation CreateTempSystemInlineFunctionOperation
? Can we use CreateTempSystemFunctionOperation
and pass in the class name? Or can we unify them?
It's quite confusing what's the differences between CreateTempSystemInlineFunctionOperation
and CreateTempSystemFunctionOperation
.
...tor-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/CreateTableASDesc.java
Outdated
Show resolved
Hide resolved
@@ -308,7 +308,7 @@ public void testAlterTable() throws Exception { | |||
// change location | |||
String newLocation = warehouse + "/tbl1_new_location"; | |||
tableEnv.executeSql( | |||
String.format("alter table `default`.tbl1 set location '%s'", newLocation)); | |||
String.format("alter table default.tbl1 set location '%s'", newLocation)); |
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.
Don't we support escape anymore?
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.
We do. This is to verify users no longer have to escape default
keyword in hive dialect.
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.
Could you also add a test with escaption to make sure it also works?
`default`.tbl1
...hive/src/main/java/org/apache/flink/table/planner/delegation/hive/DDLOperationConverter.java
Outdated
Show resolved
Hide resolved
...s/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
Outdated
Show resolved
Hide resolved
...-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/HiveParser.java
Show resolved
Hide resolved
0df0c79
to
e971a1d
Compare
Thanks @wuchong for your review. I have updated the PR to address your comments. |
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 for the updating. LGTM.
…arserImpl This closes apache#15151
…arserImpl This closes #15151
I want to use Flink to connect Hive external table Elasticsearch.
Executing this code, Flink create a generic hive table rather than external table for Elasticsearch. Do we support StorageHandler in Flink hive dialect? @lirui-apache |
Hey @wangqinghuan , thanks for trying out this feature and reporting the issue. Hive dialect doesn't support hive's storage handler table. That's mainly because hive connector currently doesn't support read/write such tables. So even if you manage to create such tables, you can't really use them in Flink. I think we'd better throw meaningful exceptions for these use cases. |
What is the purpose of the change
Support DDLs in hive parser
Brief change log
HiveParserDDLSemanticAnalyzer
to analyze DDLs.DDLOperationConverter
to convert the parsed DDLs into operations.HiveParser
. DQL and DML are still handled by super class.Verifying this change
Existing and added test cases.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation