问题描述
选择12345"作为EmpId";
select '12345' as `EmpId';
-- 输出为 empid,值为 12345
-- output is empid with value 12345
是否有任何线索使列名与 EmpId 保持相同?
Any leads to keep the same columnname as EmpId?
推荐答案
不可能.这是 HIVE Metastore 的限制.它以全小写形式存储表的模式.
Not possible. This is a limitation of the HIVE metastore. It stores the schema of a table in all lowercase.
Hive 使用这种方法来规范化列名,参见 Table.java
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();
}
所有代码中有很多相同的 toLowerCase
.例如 SessionHiveMetaStoreClient.java 等等,而且由于所需代码中的许多更改,似乎不容易改变这种行为.
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.
这篇关于如何在蜂巢中以驼峰式命名保留列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!