错误 2998:未处理的内部错误。空 - 阿帕奇猪
Posted
技术标签:
【中文标题】错误 2998:未处理的内部错误。空 - 阿帕奇猪【英文标题】:ERROR 2998: Unhandled internal error. null - Apache Pig 【发布时间】:2016-09-14 13:12:27 【问题描述】:我编写了一个猪代码,我想在其中匹配具有多个字符串的列。例如。
A = FOREACH A1 GENERATE
c1, c2, c3,
--i have substituted junk values--
case
when ( (
column_name matches '.*abc.*'
OR column_name matches '.*sdf.*'
OR column_name matches '.*bcd.*'
OR column_name MATCHES '.*def.*'
OR column_name MATCHES '.*efg.*'
OR column_name MATCHES '.*ggg.*'
OR column_name MATCHES '.*ghi.*'
OR column_name MATCHES '.*hij.*'
OR column_name MATCHES '.*ijk.*'
OR column_name MATCHES '.*jkl.*'
OR column_name MATCHES '.*klm.*'
OR column_name MATCHES '.*lmn.*'
or column_name matches '.*mno.*'
or column_name matches '.*mnb.*'
or column_name matches '.*opq.*'
or column_name matches '.*pqr.*'
or column_name matches '.*qrs.*'
or column_name matches '.*stuv.*'
or column_name matches '.*tuvw.*'
or column_name matches '.*wxy.*'
or column_name matches '.*tuvwx.*'
or column_name matches '.*xyz.*'
.
.
.
.
.
) then 1
else 0 as c4;
观察到当OR column_name MATCHES '---'语句的数量超过672时,pig脚本运行失败,报错:
Pig Stack Trace
---------------
ERROR 2998: Unhandled internal error. null
java.lang.***Error
at java.util.zip.Deflater.ensureOpen(Deflater.java:543)
at java.util.zip.Deflater.deflate(Deflater.java:426)
at java.util.zip.Deflater.deflate(Deflater.java:352)
at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:251)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1876)
at java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java:1840)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1533)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at java.util.ArrayList.writeObject(ArrayList.java:742)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at java.util.ArrayList.writeObject(ArrayList.java:742)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at java.util.ArrayList.writeObject(ArrayList.java:742)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
请提出解决方案或替代方案以满足此要求。
【问题讨论】:
【参考方案1】:您可能会考虑编写一个自定义过滤器函数1,以便更好地控制 RAM 消耗。您很可能不需要 RegEx,而是需要子字符串搜索。
【讨论】:
UPD:你生成,而不是过滤,所以它应该是一个 eval 函数pig.apache.org/docs/r0.16.0/udf.html#eval-functions 所以,基本上我需要编写一个 UDF 并在所需的一组值中搜索列值(子字符串),例如 ('abc | def | ghi | jkl | mno')。这是正确的理解@patrungel 吗? 正确的写一个UDF,但它不是在你的列表中搜索列值;至少我的印象是您在 in 值中搜索模式。 谢谢...我将尝试编写 UDF 并更新状态。我只是想知道这是否是对 CASE WHEN---MATCHES--- 条件的限制,即我不能超过 672 条此类语句? 我还阅读了一种方法,我必须将 OR 条件划分为不同的关系,然后稍后使用 UNION 来总结结果。但这会导致额外的处理,我觉得这不是一个合适的方法。以上是关于错误 2998:未处理的内部错误。空 - 阿帕奇猪的主要内容,如果未能解决你的问题,请参考以下文章
Pig 安装错误:错误 pig.Main:错误 2998:未处理的内部错误
运行 pig 0.7.0 错误:错误 2998:未处理的内部错误
Pig ERROR 2998:未处理的内部错误。静态(错误名称:com/company/Static)
Pig 0.13 错误 2998:未处理的内部错误。 org/apache/hadoop/mapreduce/task/JobContextImpl
猪错误:未处理的内部错误。找到了接口 org.apache.hadoop.mapreduce.TaskAttemptContext,但是需要类