入力をタプルとして受け取り、タプルを返すフィルタUDFを作成しようとしていますが、Grunttシェルで関数を定義すると、エラーmsgが解析に失敗しました。私は間違ってここでそれをやっているところ豚のエラー:クエリの解析に失敗しました
REGISTER /home/filterUDF.jar;
DEFINE filDist 'FilterDistrictUdf/FilterDistrict'
package FilterDistrictUdf;
import java.io.IOException;
import org.apache.pig.FilterFunc;
import org.apache.pig.data.Tuple;
public class FilterDistrict extends FilterFunc{
@Override
public Boolean exec(Tuple input) throws IOException {
String line = input.toString();
String[] columns = line.split(",");
Double bplObjective = Double.parseDouble(columns[2]);
Double bplPerformance = Double.parseDouble(columns[10]);
//Double bplObjective = (Double)input.get(2);
//Double bplPerformance = (Double)input.get(10);
//BigInteger mul = new BigInteger("80");
//BigInteger div = new BigInteger("100");
if(bplPerformance >= ((bplObjective* 80)/100))
return true;
else
return false;
}
}
エラー:
ERROR 1200: <line 40, column 15> Syntax error, unexpected symbol at or
near ''FilterDistrictUdf/FilterDistrict''
Failed to parse: <line 40, column 15> Syntax error, unexpected symbol at
or near ''FilterDistrictUdf/FilterDistrict''
at
org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:244)
at
org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:182)
at org.apache.pig.PigServer$Graph.validateQuery(PigServer.java:1707)
at org.apache.pig.PigServer$Graph.registerQuery(PigServer.java:1680)
at org.apache.pig.PigServer.registerQuery(PigServer.java:623)
at
org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:1063)
at
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:501)(GruntParser.java:230) at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205) at org.apache。 org.apache.pig.Main.run(Main.java:558) at org.apache.pig.Main.main(Main.java:
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethで
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) でsun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド) における170) odAccessorImpl.ja VA:43)java.lang.reflect.Method.invoke(Method.java:497で )org.apache.hadoop.util.RunJar.main(RunJar.java:212で )