Author: olga Date: Thu Aug 7 15:08:34 2008 New Revision: 683735 URL: http://svn.apache.org/viewvc?rev=683735&view=rev Log: PIG-367: schema naming function for UDFs
Modified: incubator/pig/branches/types/CHANGES.txt incubator/pig/branches/types/src/org/apache/pig/EvalFunc.java Modified: incubator/pig/branches/types/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/CHANGES.txt?rev=683735&r1=683734&r2=683735&view=diff ============================================================================== --- incubator/pig/branches/types/CHANGES.txt (original) +++ incubator/pig/branches/types/CHANGES.txt Thu Aug 7 15:08:34 2008 @@ -145,3 +145,5 @@ PIG-270: proper line number for parse errors PIG-363: fix for describe to produce schema name + + PIG-367: convinience function for UDFs to name schema Modified: incubator/pig/branches/types/src/org/apache/pig/EvalFunc.java URL: http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/EvalFunc.java?rev=683735&r1=683734&r2=683735&view=diff ============================================================================== --- incubator/pig/branches/types/src/org/apache/pig/EvalFunc.java (original) +++ incubator/pig/branches/types/src/org/apache/pig/EvalFunc.java Thu Aug 7 15:08:34 2008 @@ -49,6 +49,17 @@ // UDFs must use this to report progress // if the exec is taking more that 300 ms protected PigProgressable reporter; + + private static int nextSchemaId; // for assigning unique ids to UDF columns + protected String getSchemaName(String name, Schema input) { + String alias = name + "_"; + if (input.getAliases().size() > 0){ + alias += input.getAliases().iterator().next() + "_"; + } + + alias += ++nextSchemaId; + return alias; + } protected Type returnType;