How to keep Column Names in camel case in hive

无人久伴 提交于 2020-07-09 05:02:20

问题


select '12345' as `EmpId';

-- output is empid with value 12345

Any leads to keep the same columnname as EmpId?


回答1:


Not possible. This is a limitation of the HIVE metastore. It stores the schema of a table in all lowercase.

Hive uses this method to normalize column names, see Table.java

private static String normalize(String colName) throws HiveException {
    if (!MetaStoreServerUtils.validateColumnName(colName)) {
      throw new HiveException("Invalid column name '" + colName
          + "' in the table definition");
    }
    return colName.toLowerCase();
  }

There are a lot of the same toLowerCase across all the code. For example SessionHiveMetaStoreClient.java, etc, etc, and it seems it's not easy to change this behaviour because of so many changes in the code required.



来源:https://stackoverflow.com/questions/57181316/how-to-keep-column-names-in-camel-case-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!