HWC and Hive (HDinsight): reserved keyword as a column name

Core Velocity 1 Reputation point
2021-03-15T15:30:26.08+00:00

with an attempt to save the dataframe for a table which has a column name 'timestamp' and SaveMode.Overwrite, the following exception occurs:

org.apache.hadoop.hive.ql.parse.ParseException:line 1:47 cannot recognize input near 'timestamp' 'timestamp' ',' in column name or constraint

Indeed, 'timestamp' is a reserved keyword, however we have the following quote from Hive documentation:

"Reserved keywords are permitted as identifiers if you quote them as described in Supporting Quoted Identifiers in Column Names (version 0.13.0 and later, see HIVE-6013). Most of the keywords are reserved through HIVE-6617 in order to reduce the ambiguity in grammar (version 1.2.0 and later). There are two ways if the user still would like to use those reserved keywords as identifiers: (1) use quoted identifiers, (2) set hive.support.sql11.reserved.keywords=false. (version 2.1.0 and earlier)|"

Any suggestion from community or should it be submitted to support as a bug?

Azure HDInsight
Azure HDInsight
An Azure managed cluster service for open-source analytics.
210 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 89,466 Reputation points Microsoft Employee
    2021-03-19T09:38:11.477+00:00

    Hello @Core Velocity ,

    Hive allows reserved keywords in column name if we use backticks around them or just rename the column name.

    `timestamp`  
    

    Hope this helps. Do let us know if you any further queries.

    ------------

    Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.