Does anyone know the syntax for aliasing a column without underscores in Hive? In SQL and MYSQL you can use single quotes or brackets. This does not seem to work in Hive. Here a simple query that wouldn't work:
select inbound_handled as 'IB Handled'
from shdev.cust_data
The syntax is:
select inbound_handled as `IB Handled`
from shdev.cust_data
In Hive release 0.12.0 and earlier, column names can only contain alphanumeric and underscore characters.
In Hive release 0.13.0 and later, by default column names can be specified within backticks (`) and contain any Unicode character (HIVE-6013). Within a string delimited by backticks, all characters are treated literally except that double backticks (``) represent one backtick character. The pre-0.13.0 behavior can be used by setting hive.support.quoted.identifiers
to none
, in which case backticked names are interpreted as regular expressions. See Supporting Quoted Identifiers in Column Names for details.
See docs here: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-AlterColumn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With