简体   繁体   English

Pig UDF中的Java依赖项

[英]Java dependencies in Pig UDF

I wrote a UDF which uses Joda Time . 我写了一个使用Joda Time的UDF。 I included it as a dependency in pom.xml. 我将其作为依赖项包含在pom.xml中。 When I run my pig script I get the error 当我运行我的猪脚本时,出现错误

ERROR 2998: Unhandled internal error. org.joda.time.LocalDate.parse(Ljava/lang/String;)Lorg/joda/time/LocalDate;

I am pretty new to java, maven and hadoop. 我对java,maven和hadoop还是很陌生。 How can I bundle joda into my jar (Like statical linked in c/c++) which I run on the cluster? 如何将joda捆绑到我在群集上运行的jar(如c / c ++中的静态链接)中?

This is NOT a duplicate of how to include external jar file using PIG since I cant use -D option and registering Joda Time in the pig script has no effect. 不是 如何使用PIG包含外部jar文件的副本,因为我不能使用-D选项,并且在Pig脚本中注册Joda Time无效。

The problem is that pig comes with Joda 1.6 where LocalDate does not have a parse() method. 问题是Pig带有Joda 1.6,其中LocalDate没有parse()方法。 The easiest and most safe fix would be to use 1.6 in maven and rewrite your code with 1.6 Joda Time. 最简单,最安全的修复方法是在Maven中使用1.6,然后使用1.6 Joda Time重写代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM