如何在蜂巢中保持驼峰式的列名
How to keep Column Names in camel case in hive
select '12345' 作为 `EmpId';
-- 输出空值 12345
是否有任何线索与 EmpId 保持相同的列名?
不可能。这是 HIVE 元存储的限制。它以全小写形式存储 table 的架构。
Hive 使用此方法规范化列名,请参阅 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,等等,由于需要对代码进行如此多的更改,因此更改此行为似乎并不容易。
select '12345' 作为 `EmpId';
-- 输出空值 12345
是否有任何线索与 EmpId 保持相同的列名?
不可能。这是 HIVE 元存储的限制。它以全小写形式存储 table 的架构。
Hive 使用此方法规范化列名,请参阅 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,等等,由于需要对代码进行如此多的更改,因此更改此行为似乎并不容易。