Impala Reserved Words
The following are the reserved words for the current release of Impala. A reserved word is one that cannot be used directly as an identifier; you must quote it with backticks. For example, a statement CREATE TABLE select (x INT) fails, while CREATE TABLE `select` (x INT) succeeds. Impala does not reserve the names of aggregate or scalar built-in functions. (Formerly, Impala did reserve the names of some aggregate functions.)
Because different database systems have different sets of reserved words, and the reserved words change from release to release, carefully consider database, table, and column names to ensure maximum compatibility between products and versions.
Because you might switch between Impala and Hive when doing analytics and ETL, also consider whether your object names are the same as any Hive keywords, and rename or quote any that conflict. Consult the list of Hive keywords.
List of Current Reserved Words
add aggregate all alter analytic and anti api_version as asc avro between bigint binary blocksize boolean by cached cascade case cast change char class close_fn column columns comment compression compute create cross current data database databases date datetime decimal default delete delimited desc describe distinct div double drop else encoding end escaped exists explain extended external false fields fileformat finalize_fn first float following for format formatted from full function functions grant group hash having if ilike in incremental init_fn inner inpath insert int integer intermediate interval into invalidate iregexp is join last left like limit lines load location merge_fn metadata not null nulls offset on or order outer over overwrite parquet parquetfile partition partitioned partitions preceding prepare_fn produced purge range rcfile real refresh regexp rename replace restrict returns revoke right rlike role roles row rows schema schemas select semi sequencefile serdeproperties serialize_fn set show smallint stats stored straight_join string symbol table tables tblproperties terminated textfile then timestamp tinyint to true truncate unbounded uncached union update update_fn upsert use using values varchar view when where with
Planning for Future Reserved Words
The previous list of reserved words includes all the keywords used in the current level of Impala SQL syntax. To future-proof your code, you should avoid additional words in case they become reserved words if Impala adds features in later releases. This kind of planning can also help to avoid name conflicts in case you port SQL from other systems that have different sets of reserved words.
The following list contains additional words that Cloudera recommends avoiding for table, column, or other object names, even though they are not currently reserved by Impala.
any authorization backup begin break browse bulk cascade check checkpoint close clustered coalesce collate commit constraint contains continue convert current current_date current_time current_timestamp current_user cursor dbcc deallocate declare default deny disk distributed dump errlvl escape except exec execute exit fetch file fillfactor for foreign freetext goto holdlock identity index intersect key kill lineno merge national nocheck nonclustered nullif of off offsets open option percent pivot plan precision primary print proc procedure public raiserror read readtext reconfigure references replication restore restrict return revert rollback rowcount rule save securityaudit session_user setuser shutdown some statistics system_user tablesample textsize then top tran transaction trigger try_convert unique unpivot updatetext user varying waitfor while within writetext