我有一个序列文件,它有文本键和双可写值。当我将文件作为外部表加载时
Create external table t (id String, data Double) STORED AS SEQUENCEFILE LOCATION '/output';
创建成功。但是当我试图用 select *
我得到例外
“失败,出现异常java.io.ioexception:org.apache.hadoop.hive.serde2.serdeexception:class org.apache.hadoop.hive.serde2.lazy.lazysimpleserde:需要byteswritable或text对象!”
我完全理解塞德是不正确的。我试着为它实现serde,但没能使它工作。我应该如何为它实现简单的serde?
1条答案
按热度按时间iih3973s1#
解决方案稍微摆弄了一下输入格式,找到了解决方案。1) 出现异常是因为配置单元在默认情况下忽略了序列文件的键,因此在尝试匹配模式时会出现异常。
我实现了custominputformat
主reader类将文本和doublewritable扩展为byteswritable。
自定义输入格式类
可以使用命令创建表