[ https://issues.apache.org/jira/browse/IMPALA-7905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Rogers resolved IMPALA-7905. --------------------------------- Resolution: Fixed > 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 > Priority: Minor > > 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-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org