问题
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