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:
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:
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:
The fix is simple: upper-case the symbol before using he Hive lexer.