pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject svn commit: r668816 [1/2] - in /incubator/pig/trunk: ./ contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/
Date Tue, 17 Jun 2008 20:22:18 GMT
Author: olga
Date: Tue Jun 17 13:22:17 2008
New Revision: 668816

URL: http://svn.apache.org/viewvc?rev=668816&view=rev
Log:
PIG-245: math udfs

Added:
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ABS.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ACOS.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ASIN.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN2.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CBRT.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CEIL.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COS.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COSH.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXP.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXPM1.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/FLOOR.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/HYPOT.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IEEEremainder.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG10.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG1P.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MAX.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MIN.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/NEXTUP.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/POW.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RANDOM.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RINT.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ROUND.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SCALB.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIGNUM.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIN.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SINH.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SQRT.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TAN.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TANH.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ULP.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/copySign.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/getExponent.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/nextAfter.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toDegrees.java
    incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/toRadians.java
    incubator/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/TestMathUDF.java
Modified:
    incubator/pig/trunk/CHANGES.txt

Modified: incubator/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=668816&r1=668815&r2=668816&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Tue Jun 17 13:22:17 2008
@@ -317,4 +317,6 @@
 
     PIG-256: Added variable argument support for UDFs (pi_song)
 
-    PIG-266: fix warnings caused by HOD
+    PIG-266: fix warnings caused by HOD (olgan)
+
+    PIG-245: added math functions to the piggybank (ajaygarg via olgan)

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ABS.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ABS.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ABS.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ABS.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,77 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+  * math.ABS implements a binding to the Java function
+ * {@link java.lang.Math#abs(double) Math.abs(double)} for computing the
+ * absolute value of the argument. The returned value will be a double which is 
+ * absolute value of the input.
+ * 
+ * <dl>
+ * <dt><b>Parameters:</b></dt>
+ * <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+ * 
+ * <dt><b>Return Value:</b></dt>
+ * <dd><code>DataAtom [double]</code> absolute value of input</dd>
+ * 
+ * <dt><b>Return Schema:</b></dt>
+ * <dd>abs_inputSchema</dd>
+ * 
+ * <dt><b>Example:</b></dt>
+ * <dd><code>
+ * register math.jar;<br/>
+ * A = load 'mydata' using PigStorage() as ( float1 );<br/>
+ * B = foreach A generate float1, math.ABS(float1);
+ * </code></dd>
+ * </dl>
+ * 
+ * @see Math#abs(double)
+ * @see
+ * @author ajay garg
+ *
+ */
+public class ABS extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, absolute value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(abs(input));
+	}
+	
+
+	protected double abs(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=Math.abs(((DataAtom)temp).numval());
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return retVal;
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("abs_"+input.toString()); 
+	}
+	
+	
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ACOS.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ACOS.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ACOS.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ACOS.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+
+/**
+ * math.ACOS implements a binding to the Java function
+* {@link java.lang.Math#acos(double) Math.acos(double)} for computing the
+* arc cosine of value of the argument. The returned value will be a double which is 
+* the arc cosine of the value of  input.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> arc cosine of the value of input</dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>acos_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ACOS(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#acos(double)
+* @see
+* @author ajay garg
+*
+*/
+public class ACOS extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, arc cosine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(acos(input));
+	}
+	
+	protected double acos(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.acos(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("acos_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ASIN.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ASIN.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ASIN.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ASIN.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.ASIN implements a binding to the Java function
+* {@link java.lang.Math#asin(double) Math.asin(double)} for computing the
+* arc sine of value of the argument. The returned value will be a double which is 
+* the arc sine of the value of  input.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> arc sine of the value of input</dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>asin_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ASIN(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#asin(double)
+* @see
+* @author ajay garg
+*
+*/
+public class ASIN extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, arc sine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(asin(input));
+	}
+	
+	protected double asin(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.asin(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("asin_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.ATAN implements a binding to the Java function
+* {@link java.lang.Math#atan(double) Math.atan(double)} for computing the
+* arc tangent of value of the argument. The returned value will be a double which is 
+* the arc tangent of the value of  input.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> arc tangent of the value of input</dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>atan_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ATAN(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#atan(double)
+* @see
+* @author ajay garg
+*
+*/
+public class ATAN extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, arc tangent value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(atan(input));
+	}
+	
+	protected double atan(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.atan(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("atan_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN2.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN2.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN2.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ATAN2.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,67 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.ATAN2 implements a binding to the Java function
+* {@link java.lang.Math#atan2(double,double) Math.atan2(double,double)}. Given a tuple with
+* two data atom x and y it will returns the angle theta from the conversion of 
+* rectangular coordinates (x, y) to polar coordinates (r, theta).
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>atan2_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ATAN2(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#atan2(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class ATAN2 extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(atan2(input));
+	}
+	
+	protected double atan2(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.atan2(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input " + e.getMessage());
+		}
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("atan2_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CBRT.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CBRT.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CBRT.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CBRT.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.CBRT implements a binding to the Java function
+* {@link java.lang.Math#cbrt(double) Math.cbrt(double)} for computing the
+ * cube root of the argument. The returned value will be a double which is 
+ * cube root value of the input.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>cbrt_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.cbrt(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#cbrt(double)
+* @see
+* @author ajay garg
+*
+*/
+public class CBRT extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, cube root of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(cbrt(input));
+	}
+	
+	protected double cbrt(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.cbrt(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("cbrt_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CEIL.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CEIL.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CEIL.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/CEIL.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.CEIL implements a binding to the Java function
+* {@link java.lang.Math#ceil(double) Math.ceil(double)}. Given a single 
+* data atom it  Returns the smallest (closest to negative infinity) 
+* double value that is greater than or equal  to the argument and is equal 
+* to a mathematical integer.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>ceil_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ceil(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#ceil(double)
+* @see
+* @author ajay garg
+*
+*/
+public class CEIL extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, ceil value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(ceil(input));
+	}
+	
+	protected double ceil(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.ceil(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("ceil_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COS.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COS.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COS.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COS.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.COS implements a binding to the Java function
+* {@link java.lang.Math#cos(double) Math.cos(double)}. Given a single 
+* data atom it  Returns the cosine value of the input
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>cos_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.cos(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#cos(double)
+* @see
+* @author ajay garg
+*
+*/
+public class COS extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, cosine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(cos(input));
+	}
+	
+	protected double cos(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.cos(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("cos_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COSH.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COSH.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COSH.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/COSH.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,73 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.COSH implements a binding to the Java function
+* {@link java.lang.Math#cosh(double) Math.cosh(double)}. Given a single 
+* data atom it  Returns the hyperbolic cosine value of the input
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>cosh_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.cosh(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#cosh(double)
+* @see
+* @author ajay garg
+*
+*/
+public class COSH extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, hyperbolic cosine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(cosh(input));
+	}
+	
+	protected double cosh(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.cosh(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("cosh_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXP.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXP.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXP.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXP.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,72 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.EXP implements a binding to the Java function
+* {@link java.lang.Math#exp(double) Math.exp(double)}. Given a single 
+* data atom it  Returns the Euler's number e raised to the power of input
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>exp_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.exp(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#exp(double)
+* @see
+* @author ajay garg
+*
+*/
+public class EXP extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, exponential value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(exp(input));
+	}
+	
+	protected double exp(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.exp(retVal);
+		
+	}
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("exp_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXPM1.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXPM1.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXPM1.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/EXPM1.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,73 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.EXPM1 implements a binding to the Java function
+* {@link java.lang.Math#expm1(double) Math.expm1(double)}. Given a single 
+* data atom it returns exp(input)+1
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>expm1_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.expm1(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#expm1(double)
+* @see
+* @author ajay garg
+*
+*/
+public class EXPM1 extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(expm1(input));
+	}
+	
+	protected double expm1(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.expm1(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("expm1_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/FLOOR.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/FLOOR.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/FLOOR.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/FLOOR.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.FLOOR implements a binding to the Java function
+* {@link java.lang.Math#floor(double) Math.floor(double)}. Given a single 
+* data atom it returns the largest (closest to positive infinity) double 
+* value that is less than or equal to the argument and is equal to a 
+* mathematical integer.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>floor_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.floor(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#floor(double)
+* @see
+* @author ajay garg
+*
+*/
+public class FLOOR extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, floor value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(floor(input));
+	}
+	
+	protected double floor(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.floor(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("floor_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/HYPOT.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/HYPOT.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/HYPOT.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/HYPOT.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,67 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.HYPOT implements a binding to the Java function
+* {@link java.lang.Math#hypot(double,double) Math.hypot(double,double)}.
+*  Given a tuple with two data atom Returns sum of squares of two arguments.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>HYPOT_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.HYPOT(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#hypot(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class HYPOT extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * sum of squares of the two arguments
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(hypot(input));
+	}
+	
+	protected double hypot(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.hypot(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input "+ e.getMessage());
+		}
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("HYPOT_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IEEEremainder.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IEEEremainder.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IEEEremainder.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IEEEremainder.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,68 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.IEEEremainder implements a binding to the Java function
+* {@link java.lang.Math#IEEEremainder(double,double) Math.IEEEremainder(double,double)}. 
+* Given a tuple with two data atom it Returns the remainder operation on two 
+* arguments as prescribed by the IEEE 754 standard.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>IEEEremainder_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.IEEEremainder(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#IEEEremainder(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class IEEEremainder extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * the remainder operation on two arguments as prescribed by the 
+	 * IEEE 754 standard.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(remainder(input));
+	}
+	
+	protected double remainder(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.IEEEremainder(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input "+e.getMessage());
+		}
+		
+	}
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("IEEEremainder_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.LOG implements a binding to the Java function
+* {@link java.lang.Math#log(double) Math.log(double)}. 
+* Given a single data atom it returns the natural 
+* logarithm (base e)  of a double
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>LOG_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.LOG(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#log(double)
+* @see
+* @author ajay garg
+*
+*/
+public class LOG extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, natural logarithm
+	 * of the input
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(log(input));
+	}
+	
+	protected double log(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.log(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("LOG_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG10.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG10.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG10.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG10.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.LOG10 implements a binding to the Java function
+* {@link java.lang.Math#log10(double) Math.log10(double)}. 
+* Given a single data atom it returns the base 10 logarithm of a double
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>LOG10_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.LOG10(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#log10(double)
+* @see
+* @author ajay garg
+*
+*/
+public class LOG10 extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, base 10 logarithm
+	 * of the input
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(log10(input));
+	}
+	
+	protected double log10(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		
+		return Math.log10(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("LOG10_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG1P.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG1P.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG1P.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/LOG1P.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,76 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.LOG1P implements a binding to the Java function
+* {@link java.lang.Math#log1p(double) Math.log1p(double)}. 
+* Given a single data atom it Returns the natural logarithm 
+* of the sum of the argument and 1.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>LOG1P_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.LOG1P(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#log1p(double)
+* @see
+* @author ajay garg
+*
+*/
+public class LOG1P extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, natural logarithm
+	 * of sum of the input and 1
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(log1p(input));
+	}
+	
+	protected double log1p(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		
+		return Math.log1p(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("LOG10_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MAX.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MAX.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MAX.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MAX.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,69 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.MAX implements a binding to the Java function
+* {@link java.lang.Math#max(double,double) Math.max(double,double)}. 
+* Given a tuple with two data atom it Returns the data 
+* atom with greater value.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>MAX_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.MAX(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#MAX(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class MAX extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * the data atom with the greater value among the two.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(max(input));
+	}
+	
+	protected double max(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.max(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input " + e.getMessage());
+		}
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("MAX_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MIN.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MIN.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MIN.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/MIN.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,69 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.MIN implements a binding to the Java function
+* {@link java.lang.Math#min(double,double) Math.min(double,double)}. 
+* Given a tuple with two data atom it Returns the data 
+* atom with smaller value.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>MIN_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.MIN(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#MIN(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class MIN extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * the data atom with the smaller value among the two.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(min(input));
+	}
+	
+	protected double min(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.min(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input " + e.getMessage());
+		}
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("MIN_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/NEXTUP.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/NEXTUP.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/NEXTUP.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/NEXTUP.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,78 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.NEXTUP implements a binding to the Java function
+* {@link java.lang.Math#nextUp(double) Math.nextUp(double)}. 
+* Given a single data atom it return the floating-point value 
+* adjacent to input in the direction of positive infinity
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>NEXTUP_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.NEXTUP(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#nextUp(double)
+* @see
+* @author ajay garg
+*
+*/
+public class NEXTUP extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, floating-point value adjacent 
+	 * to input in the direction of positive infinity.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(nextUp(input));
+	}
+	
+	protected double nextUp(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		if(retVal==0){
+			return Double.MIN_VALUE;
+		}
+		return Math.nextUp(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("NEXTUP_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/POW.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/POW.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/POW.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/POW.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,70 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.POW implements a binding to the Java function
+* {@link java.lang.Math#pow(double,double) Math.pow(double,double)}. 
+* Given a tuple with two data atom it Returns the 
+* the value of the first argument raised to the power of 
+* the second argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>POW_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.POW(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#pow(double,double)
+* @see
+* @author ajay garg
+*
+*/
+public class POW extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * value of the first argument raised to the power of the second argument.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(pow(input));
+	}
+	
+	protected double pow(Tuple input) throws IOException{
+		try{
+			double first = input.getAtomField(0).numval();
+			double second = input.getAtomField(1).numval();
+			return Math.pow(first, second);
+		}
+		catch(RuntimeException e){
+			throw new IOException("invalid input "+e.getMessage());
+		}
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("POW_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RANDOM.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RANDOM.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RANDOM.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RANDOM.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,22 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+
+public class RANDOM extends EvalFunc<DataAtom>{
+
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(random(input));
+	}
+	
+	protected double random(Tuple input) throws IOException{
+		
+		return Math.random();
+		
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RINT.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RINT.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RINT.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/RINT.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,78 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.RINT implements a binding to the Java function
+* {@link java.lang.Math#rint(double) Math.rint(double)}. 
+* Given a single data atom it Returns the double value 
+* that is closest in value to the argument and is equal 
+* to a mathematical integer.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>RINT_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.RINT(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#rint(double)
+* @see
+* @author ajay garg
+*
+*/
+public class RINT extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, double 
+	 * value that is closest in value to the argument and is equal 
+	 * to a mathematical integer.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(rint(input));
+	}
+	
+	protected double rint(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.rint(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("RINT_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ROUND.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ROUND.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ROUND.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ROUND.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.ROUND implements a binding to the Java function
+* {@link java.lang.Math#round(double) Math.round(double)}. 
+* Given a single data atom it Returns the closest long to the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>ROUND_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ROUND(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#round(double)
+* @see
+* @author ajay garg
+*
+*/
+public class ROUND extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * the closest long to the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(round(input));
+	}
+	
+	protected double round(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.round(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("ROUND_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SCALB.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SCALB.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SCALB.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SCALB.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,85 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+
+/**
+ * math.SCALB implements a binding to the Java function
+* {@link java.lang.Math#scalb(double,int) Math.scalb(double,int)}. 
+* Given a tuple with two data atom x and y ,it Return x × pow(2,y) 
+* rounded as if performed by a single correctly rounded 
+* floating-point multiply to a member of the double value set.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>Tuple containing two DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>SCALB_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.SCALB(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#scalb(double,int)
+* @see
+* @author ajay garg
+*
+*/
+public class SCALB extends EvalFunc<DataAtom>{
+	
+	/**
+	 * java level API
+	 * @param input expects a tuple containing two numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, which is 
+	 * fistArgument × pow(2,secondArgument) rounded as if performed by a 
+	 * single correctly rounded floating-point multiply to a member of 
+	 * the double value set.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(scalb(input));
+	}
+	
+	protected double scalb(Tuple input) throws IOException{
+		double first;
+		double second;
+		try{
+			first = input.getAtomField(0).numval();
+			second = input.getAtomField(1).numval();
+		}
+		catch(Exception e){
+			throw new IOException("invalid input ");
+		}
+		try{
+			
+			int sec= Double.valueOf(second).intValue();
+			return Math.scalb(first, sec);
+			
+		}
+		catch(NumberFormatException e){
+			throw new IOException("Integer value is required");
+		}
+		
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("SCALB_"+input.toString()); 
+	}
+
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIGNUM.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIGNUM.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIGNUM.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIGNUM.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.SIGNUM implements a binding to the Java function
+* {@link java.lang.Math#signum(double) Math.signum(double)}. 
+* Given a single data atom it Returns the signum function of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>SIGNUM_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.SIGNUM(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#signum(double)
+* @see
+* @author ajay garg
+*
+*/
+public class SIGNUM extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * signum function of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(signum(input));
+	}
+	
+	protected double signum(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.signum(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("SIGNUM_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIN.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIN.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIN.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SIN.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.SIN implements a binding to the Java function
+* {@link java.lang.Math#sin(double) Math.sin(double)}. 
+* Given a single data atom it Returns the sine of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>SIN_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.SIN(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#sin(double)
+* @see
+* @author ajay garg
+*
+*/
+public class SIN extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * sine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(sin(input));
+	}
+	
+	protected double sin(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.sin(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("SIN_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SINH.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SINH.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SINH.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SINH.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.SINH implements a binding to the Java function
+* {@link java.lang.Math#sinh(double) Math.sinh(double)}. 
+* Given a single data atom it Returns the hyperbolic sine of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>SINH_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.SINH(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#sinh(double)
+* @see
+* @author ajay garg
+*
+*/
+public class SINH extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * hyperbolic sine value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(sinh(input));
+	}
+	
+	protected double sinh(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.sinh(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("SINH_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SQRT.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SQRT.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SQRT.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/SQRT.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.SQRT implements a binding to the Java function
+* {@link java.lang.Math#sqrt(double) Math.sqrt(double)}. 
+* Given a single data atom it Returns the square root of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>SQRT_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.SQRT(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#sqrt(double)
+* @see
+* @author ajay garg
+*
+*/
+public class SQRT extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * square root value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(sqrt(input));
+	}
+	
+	protected double sqrt(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.sqrt(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("SQRT_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TAN.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TAN.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TAN.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TAN.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,74 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.TAN implements a binding to the Java function
+* {@link java.lang.Math#tan(double) Math.tan(double)}. 
+* Given a single data atom it Returns the tangent of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>TAN_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.TAN(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#tan(double)
+* @see
+* @author ajay garg
+*
+*/
+public class TAN extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * tangent value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(tan(input));
+	}
+	
+	protected double tan(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.tan(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("TAN_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TANH.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TANH.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TANH.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/TANH.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.TANH implements a binding to the Java function
+* {@link java.lang.Math#tanh(double) Math.tanh(double)}. 
+* Given a single data atom it Returns the hyperbolic tangent 
+* of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>TANH_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.TANH(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#tanh(double)
+* @see
+* @author ajay garg
+*
+*/
+public class TANH extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * hyperbolic tangent value of the argument
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(tanh(input));
+	}
+	
+	protected double tanh(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.tanh(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("TANH_"+input.toString()); 
+	}
+
+}

Added: incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ULP.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ULP.java?rev=668816&view=auto
==============================================================================
--- incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ULP.java (added)
+++ incubator/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/ULP.java Tue Jun 17 13:22:17 2008
@@ -0,0 +1,75 @@
+package org.apache.pig.piggybank.evaluation.math;
+
+import java.io.IOException;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.data.DataAtom;
+import org.apache.pig.data.Datum;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.schema.AtomSchema;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+/**
+ * math.ULP implements a binding to the Java function
+* {@link java.lang.Math#ulp(double) Math.ulp(double)}. 
+* Given a single data atom it Returns the size of an ulp 
+* of the argument.
+* 
+* <dl>
+* <dt><b>Parameters:</b></dt>
+* <dd><code>value</code> - <code>DataAtom [double]</code>.</dd>
+* 
+* <dt><b>Return Value:</b></dt>
+* <dd><code>DataAtom [double]</code> </dd>
+* 
+* <dt><b>Return Schema:</b></dt>
+* <dd>ULP_inputSchema</dd>
+* 
+* <dt><b>Example:</b></dt>
+* <dd><code>
+* register math.jar;<br/>
+* A = load 'mydata' using PigStorage() as ( float1 );<br/>
+* B = foreach A generate float1, math.ULP(float1);
+* </code></dd>
+* </dl>
+* 
+* @see Math#ulp(double)
+* @see
+* @author ajay garg
+*
+*/
+public class ULP extends EvalFunc<DataAtom>{
+	/**
+	 * java level API
+	 * @param input expects a single numeric DataAtom value
+	 * @param output returns a single numeric DataAtom value, 
+	 * the size of an ulp of the argument.
+	 */
+	@Override
+	public void exec(Tuple input, DataAtom output) throws IOException {
+		output.setValue(ulp(input));
+	}
+	
+	protected double ulp(Tuple input) throws IOException{
+		Datum temp = input.getField(0);
+		double retVal;
+		if(!(temp instanceof DataAtom)){
+			throw new IOException("invalid input format. ");
+		} 
+		else{
+			try{
+				retVal=((DataAtom)temp).numval();
+			}
+			catch(RuntimeException e){
+				throw new IOException((DataAtom)temp+" is not a valid number");
+			}
+		}
+		return Math.ulp(retVal);
+		
+	}
+	
+	@Override
+	public Schema outputSchema(Schema input) {
+		return new AtomSchema("ULP_"+input.toString()); 
+	}
+
+}



Mime
View raw message