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-17965][sql-parser-hive] Hive dialect needs to unescape backslash in string literals #12378
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 54651d2 (Thu May 28 11:24:06 UTC 2020) 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:
|
7730fcf
to
aa2b18f
Compare
public static SqlTableOption unescapeTableOption(SqlTableOption option) { | ||
String key = StringEscapeUtils.unescapeJava(option.getKeyString()); | ||
String val = StringEscapeUtils.unescapeJava(option.getValueString()); | ||
SqlNode keyNode = SqlLiteral.createCharString(key, option.getKey().getParserPosition()); |
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.
I think we only need to unescape the option value.
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.
Both key and value can have special characters in Hive.
...e/flink-sql-parser-hive/src/main/java/org/apache/flink/sql/parser/hive/ddl/HiveDDLUtils.java
Show resolved
Hide resolved
|
||
public static void unescapePartitionSpec(SqlNodeList partSpec) { | ||
if (partSpec != null) { | ||
for (int i = 0; i < partSpec.size(); i++) { |
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.
Did you try SqlShuttle
?
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.
I have changed to use SqlShuttle
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.
…sh in string literals This closes #12378
…sh in string literals This closes apache#12378
…sh in string literals This closes apache#12378
What is the purpose of the change
HiveQL supports escaping by backslash. But SQL CLI will escape backslashes in its input. Therefore hive dialect needs to unescape it.
Brief change log
Verifying this change
I have manually verified the test cases (except view tests due to FLINK-17113) in
HiveDialectTest
via SQL CLI. But cannot add new tests for them since we don't have E2E tests for hive connector.Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation