使用表本身上的联接查询下表会导致以下异常:
java.lang.IllegalArgumentException: Uncompressed length 222258 must be less than 131072
at org.iq80.snappy.SnappyInternalUtils.checkArgument(SnappyInternalUtils.java:116)
at org.iq80.snappy.SnappyDecompressor.uncompress(SnappyDecompressor.java:72)
at org.iq80.snappy.Snappy.uncompress(Snappy.java:43)
at org.apache.hadoop.hive.ql.io.orc.SnappyCodec.decompress(SnappyCodec.java:71)
at org.apache.hadoop.hive.ql.io.orc.InStream$CompressedStream.readHeader(InStream.java:214)
at org.apache.hadoop.hive.ql.io.orc.InStream$CompressedStream.available(InStream.java:251)
有问题的查询如下:
select a.*
from events a
inner join
(
SELECT asset_id, time, max(hive_insert_ts)
FROM events
GROUP BY asset_id, time
) b on a.time = b.time
and a.asset_id = b.asset_id
limit 10;
该表存储为orc,并使用snappy进行压缩:
create table events(
asset_id varchar(15),
time timestamp,
hive_insert_ts timestamp)
PARTITIONED BY (
country varchar(4),
site varchar(4),
year int,
month int)
STORED as ORC
TBLPROPERTIES (
'orc.compress'='SNAPPY',
'orc.create.index'='true',
'orc.bloom.filter.columns'='asset_id, time',
'orc.bloom.filter.fpp'='0.05',
'orc.stripe.size'='268435456',
'orc.row.index.stride'='10000');
我找了很多,但找不到任何线索。你知道问题出在哪里吗?
谢谢!
1条答案
按热度按时间mcvgt66p1#
我找到了解决办法(以防有人遇到同样的问题)。它是由一个错误配置引起的:
“orc.compress.size”tableproperty默认设置为
'orc.compress.size'='262144',即256KB
但是core-site.xml中的“io.file.buffer.size”设置为“131072”,即128KB。
streamreader想要读取131072字节,这些字节在解压缩后不适合文件缓冲区。
解决方案是增加文件缓冲区大小或减小orc表的压缩大小。
我希望有一天这对其他人也有帮助。