为什么按键搜索时,Hive Map键(i16)不能向上翻转?

时间:2019-03-05 09:11:58

标签: hive hiveql hive-query

有一个由节俭定义的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,而i16smallint

但是,Hive为什么将smallint而不是tinyint投射到int

我认为这可能会导致某些信息丢失或号码溢出。

0 个答案:

没有答案