Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix to it

  • Loading branch information...
commit f0d03c56eb9581052a7b9abb2dbeb4bb8bb6ab96 1 parent c13ef14
@jcoveney authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/org/apache/pig/builtin/InvokerGenerator.java
View
16 src/org/apache/pig/builtin/InvokerGenerator.java
@@ -36,6 +36,8 @@
//TODO statically cache the generated code based on the input Strings
//TODO benchmark against native, and against Dmitriy's
//TODO add tests. leverage the tests used for other invoker
+//TODO support byte[] arguments, and consider supporting Tuples and Bags?
+//TODO Both could be converted to Lists or Arrays as necessary
public class InvokerGenerator extends EvalFunc<Object> {
private String className_;
private String methodName_;
@@ -116,12 +118,8 @@ public Object exec(Tuple input) throws IOException {
@Override
public Schema outputSchema(Schema input) {
- for (String s : argumentTypes_)
- if (!returnTypeMap.containsKey(nameToClassObjectMap.get(s)))
- throw new RuntimeException("Given input schema " + input + " does not match the list of inputs " + argumentTypes_);
-
if (!isInitialized)
- initialize();
+ initialize(input);
return outputSchema;
}
@@ -131,6 +129,14 @@ private static int getUniqueId() {
}
//TODO should be private, is public for testing
+ private void initialize(Schema inputSchema) {
+ for (String s : argumentTypes_)
+ if (!returnTypeMap.containsKey(nameToClassObjectMap.get(s)))
+ throw new RuntimeException("Given input schema " + inputSchema + " does not match the list of inputs " + argumentTypes_);
+
+ initialize();
+ }
+
public void initialize() {
Class<?> clazz;
try {
Please sign in to comment.
Something went wrong with that request. Please try again.