有一个由节俭定义的Hive表。
struct A {
1: optional map<i16, string> myMap;
}
我尝试了一些查询来搜索该表。
// this one gets an error:
select myMap[10] from A where myMap[10] is not null
第1行:74 MAP键类型与索引表达式类型“ 10”不匹配
下面的两个返回正确的结果。
// this one works well
select myMap[10S] from A where myMap[10S] is not null
// this one works well
select myMap[10Y] from A where myMap[10Y] is not null
我知道10Y
的意思是tinyint
,而10S
的意思是smallint
,而i16
是smallint
。
但是,Hive为什么将smallint
而不是tinyint
投射到int
?
我认为这可能会导致某些信息丢失或号码溢出。