2
我有两个输入文件smt.txt和smo.txt。 jar文件读取文本文件并根据java文件中描述的某些规则拆分数据。 pig文件将这些数据放入输出文件中,并进行mapreduce。如何在猪文件中使用.jar
register 'maprfs:///user/username/fl.jar';
DEFINE FixedLoader fl();
mt = load 'maprfs:///user/username/smt.txt' using FixedLoader('-30','30-33',...........) AS (.........);
mo = load 'maprfs:///user/username/smo.txt*' using FixedLoader('-30','30-33',.....) AS (......);
store mt into 'maprfs:///user/username/mt_out' using JsonStorage();
store mo into 'maprfs:///user/username/mo_out' using JsonStorage();
和一部分java代码,如下所示。 (方法的内容都没有neccessary我相信):
package com.mapr.util;
import org.apache.hadoop.mapreduce.lib.input.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.io.*;
import org.apache.pig.*;
import org.apache.pig.data.*;
import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.*;
import java.util.*;
import java.io.*;
public class FixedLoader extends LoadFunc
{
............
}
当我用命令“猪-x MapReduce的sample.pig”一个端子短运行此程序的猪,我给了一个错误信息:
错误org.apache.pig.tools.grunt.Grunt - 错误1070:无法使用导入来解析com.mapr.util.FixedLoader:[,org.apache.pig.builtin。,org.apache.pig.impl .builtin。]
如何将这些项目导入到我的项目中或者是否存在对r的任何建议/解决方案联合国这个计划?
感谢您的建议,但我决定在猪脚本中做所有工作,所以我不再需要jar文件。然而,我试图给出完整的包名称相同的代码,但我认为我的计算机中仍然存在一些第三方依赖关系。 – erbileren