cyanzheng2926 commented on code in PR #6563:
URL: https://github.com/apache/hive/pull/6563#discussion_r3504690133
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/create/show/ShowCreateTableOperation.java:
##########
@@ -74,4 +74,39 @@ public int execute() throws HiveException {
throw new HiveException(e);
}
}
+
+ private static String escapeSqlTabs(String sql) {
+ if (sql == null || sql.indexOf('\t') < 0) {
+ return sql;
+ }
+ StringBuilder result = new StringBuilder(sql.length());
+ char quote = 0;
+ for (int i = 0; i < sql.length(); i++) {
+ char c = sql.charAt(i);
+ if (quote == 0) { // outside string literal
+ if (c == '\'' || c == '"') {
Review Comment:
Hi @ayushtkn thanks for pointing this out. I've added tests for column
identifiers with \` and tabs, and validated that \` needs to be treated
differently from the string literals, since identifiers still need the literal
tabs (instead of converting to \t) for pattern matching. Direct replacement
with \t or space will fail at pattern matching or lose the original literal tab
pattern. Thus removed the changes to sql before writing to DataOutputStream,
and added an overload to the existing createFetchTask under
BaseSemanticAnalyzer to make sure the sql is not splitted by tabs when reading.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]