lirui-apache commented on a change in pull request #12378:
URL: https://github.com/apache/flink/pull/12378#discussion_r436493218
##########
File path:
flink-table/flink-sql-parser-hive/src/main/java/org/apache/flink/sql/parser/hive/ddl/HiveDDLUtils.java
##########
@@ -317,4 +321,54 @@ public static SqlTableColumn
deepCopyTableColumn(SqlTableColumn column) {
column.getParserPosition()
);
}
+
+ // the input of sql-client will escape '\', unescape it so that users
can write hive dialect
+ public static void unescapeProperties(SqlNodeList properties) {
+ if (properties != null) {
+ for (int i = 0; i < properties.size(); i++) {
+ SqlNode node = properties.get(i);
+ // for properties
+ if (node instanceof SqlTableOption) {
+ node =
unescapeTableOption((SqlTableOption) node);
+ properties.set(i, node);
+ }
+ }
+ }
+ }
+
+ 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());
Review comment:
Both key and value can have special characters in Hive.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]