hive - 为什么 Hive Map 键 (i16) 在按键搜索时不能向上转换?
问题描述
有一个由 thrift 定义的 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
totinyint
而不是int
?
我认为这可能会导致一些信息丢失或数字溢出。
解决方案
推荐阅读
- google-apps-script - 有没有更好的方法来制作仅包含内容的电子表格副本?
- php - BadMethodCallException 方法 [getReport] 不存在
- python - 结合几个热图
- sql - 在列值上连接两个表并根据其他列进行排序
- python - 使用本地 JSON 文件填充 Django DB
- django - 如何使 django url 动态化
- newrelic - 尽管从 New Relic 仪表板中可以看到服务器,但 REST API 未返回任何服务器
- ios - 使用通用可编码 API 客户端处理非 JSON 响应
- javascript - 如果索引大于使用 v-for 循环在 VUEJS 中的值,我如何显示(+10 多个)
- pycharm - PyCharm 的 Markdown 渲染很漂亮。有没有办法将它按原样保存到 pdf 或 html 文件中?