You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/28 21:15:00 UTC
[jira] [Created] (IMPALA-7905) ToSqlUtils does not correctly quote
lower-case Hive keywords
Paul Rogers created IMPALA-7905:
-----------------------------------
Summary: ToSqlUtils does not correctly quote lower-case Hive keywords
Key: IMPALA-7905
URL: https://issues.apache.org/jira/browse/IMPALA-7905
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 3.0
Reporter: Paul Rogers
Assignee: Paul Rogers
Not sure yet how to reproduce this error via the shell, but here is the code analysis.
The {{ToSqlUtils}} class generates a {{CREATE TABLE}} statement, which uses a method {{getIdentSql()}} to possibly quote a table or column name. This same method is used in multiple places in the {{toSql()}} logic for various statements.
The comment for the method says:
bq. returns an identifier lexable by Impala and Hive, possibly by enclosing the original identifier in "`" quotes.
To check for a Hive-compatible identifier, the code uses the Hive lexer:
{code:java}
HiveLexer hiveLexer = new HiveLexer(new ANTLRStringStream(ident));
{code}
A unit test shows that this logic fails to catch lower case keywords: "select", say, while it does catch upper-case keywords: "SELECT".
Checking the Hive source, it appears we're using the lexer wrong:
{code:java}
HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command));
{code}
The fix is simple: upper-case the symbol before using he Hive lexer.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org