Hi all,
in the exec(Tuple input) method of an EvalFunc I get the tuple to be processed
by the Eval Function.
Is there any secure possibility to get the Aliases of the fields in the input
Tuple?
My Eval Function needs to know the names of the Field-Aliases in order to know
how to evaluate the tuple.
My current solution is to save the Schema which I get in the
outputSchema(Schema input) method in a static instance variable of the Eval
Function Class so that I can access the Schema-Information in the exec-method:
private static Schema inputSchema;
public Schema outputSchema(Schema input) {
inputSchema = input;
return input;
}
public Tuple exec(Tuple input) throws IOException {
Set<String> aliases = inputSchema.getAliases();
...
return input;
}
Local tests worked but I'm not sure if it is guaranteed to work?
Example:
Describe A;
A: {varName1: chararray, varName2: chararray}
B = Foreach A Generate MyUDF(*);
In MyUDF I have to know the name of the first and second field (varName1 and
varName2) because the processing is dependant on the varNames.
Any suggestions?
Thx in advance,
Alex