pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From the...@apache.org
Subject svn commit: r1376800 [3/6] - in /pig/trunk: ./ .eclipse.templates/ conf/ contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/ contrib/zebra/src/java/org/apache/hadoop/zebra/pig/ contrib/zebra/src/java/org/apache/hadoop/zebra/pig/compa...
Date Fri, 24 Aug 2012 00:18:09 GMT
Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POBinCond.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POBinCond.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POBinCond.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POBinCond.java Fri Aug 24 00:18:05 2012
@@ -21,6 +21,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.POStatus;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result;
@@ -126,6 +128,11 @@ public class POBinCond extends Expressio
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+        return genericGetNext(dt, DataType.DATETIME);
+    }
+
+    @Override
     public Result getNext(Map m) throws ExecException {
         return genericGetNext(m, DataType.MAP);
     }

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java Fri Aug 24 00:18:05 2012
@@ -24,6 +24,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pig.FuncSpec;
@@ -39,6 +42,7 @@ import org.apache.pig.backend.hadoop.exe
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhyPlanVisitor;
+import org.apache.pig.builtin.ToDate;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.DataType;
@@ -139,6 +143,12 @@ public class POCast extends ExpressionOp
             res.returnStatus = POStatus.STATUS_ERR;
             return res;
         }
+
+        case DataType.DATETIME: {
+            Result res = new Result();
+            res.returnStatus = POStatus.STATUS_ERR;
+            return res;
+        }
         
         case DataType.BYTEARRAY: {
             DataByteArray dba = null;
@@ -338,6 +348,15 @@ public class POCast extends ExpressionOp
             return res;
         }
 
+        case DataType.DATETIME: {
+            DateTime dt = null;
+            Result res = in.getNext(dt);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = Integer.valueOf(Long.valueOf(((DateTime) res.result).getMillis()).intValue());
+            }
+            return res;
+        }
+
         case DataType.CHARARRAY: {
             String str = null;
             Result res = in.getNext(str);
@@ -460,6 +479,15 @@ public class POCast extends ExpressionOp
             return res;
         }
 
+        case DataType.DATETIME: {
+            DateTime dt = null;
+            Result res = in.getNext(dt);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = Long.valueOf(((DateTime) res.result).getMillis());
+            }
+            return res;
+        }
+
         case DataType.CHARARRAY: {
             String str = null;
             Result res = in.getNext(str);
@@ -581,6 +609,15 @@ public class POCast extends ExpressionOp
             return res;
         }
 
+        case DataType.DATETIME: {
+            DateTime dt = null;
+            Result res = in.getNext(dt);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new Double(Long.valueOf(((DateTime) res.result).getMillis()).doubleValue());
+            }
+            return res;
+        }
+
         case DataType.CHARARRAY: {
             String str = null;
             Result res = in.getNext(str);
@@ -704,6 +741,15 @@ public class POCast extends ExpressionOp
             return res;
         }
 
+        case DataType.DATETIME: {
+            DateTime dt = null;
+            Result res = in.getNext(dt);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new Float(Long.valueOf(((DateTime) res.result).getMillis()).floatValue());
+            }
+            return res;
+        }
+
         case DataType.CHARARRAY: {
             String str = null;
             Result res = in.getNext(str);
@@ -721,6 +767,130 @@ public class POCast extends ExpressionOp
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+        PhysicalOperator in = inputs.get(0);
+        Byte resultType = in.getResultType();
+        switch (resultType) {
+        case DataType.BAG: {
+            Result res = new Result();
+            res.returnStatus = POStatus.STATUS_ERR;
+            return res;
+        }
+
+        case DataType.TUPLE: {
+            Result res = new Result();
+            res.returnStatus = POStatus.STATUS_ERR;
+            return res;
+        }
+
+        case DataType.MAP: {
+            Result res = new Result();
+            res.returnStatus = POStatus.STATUS_ERR;
+            return res;
+        }
+
+        case DataType.BYTEARRAY: {
+            DataByteArray dba = null;
+            Result res = in.getNext(dba);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                try {
+                    dba = (DataByteArray) res.result;
+                } catch (ClassCastException e) {
+                    // res.result is not of type ByteArray. But it can be one of the types from which cast is still possible.
+                    if (realType == null) {
+                        // Find the type in first call and cache it.
+                        realType = DataType.findType(res.result);
+                    }
+                    try {
+                        res.result = DataType.toDateTime(res.result, realType);
+                    } catch (ClassCastException cce) {
+                        // Type has changed. Need to find type again and try casting it again.
+                        realType = DataType.findType(res.result);
+                        res.result = DataType.toDateTime(res.result, realType);
+                    }
+                    return res;
+                }
+                try {
+                    if (null != caster) {
+                        res.result = caster.bytesToDateTime(dba.get());
+                    } else {
+                        int errCode = 1075;
+                        String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to datetime.";
+                        throw new ExecException(msg, errCode, PigException.INPUT);
+                    }
+                } catch (ExecException ee) {
+                    throw ee;
+                } catch (IOException e) {
+                    log.error("Error while casting from ByteArray to DateTime");
+                }
+            }
+            return res;
+        }
+
+        case DataType.INTEGER: {
+            Integer dummyI = null;
+            Result res = in.getNext(dummyI);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new DateTime(((Integer) res.result).longValue());
+            }
+            return res;
+        }
+
+        case DataType.DOUBLE: {
+            Double d = null;
+            Result res = in.getNext(d);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new DateTime(((Double) res.result).longValue());
+            }
+            return res;
+        }
+
+        case DataType.LONG: {
+            Long l = null;
+            Result res = in.getNext(l);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new DateTime(((Long) res.result).longValue());
+            }
+            return res;
+        }
+
+        case DataType.FLOAT: {
+            Float f = null;
+            Result res = in.getNext(f);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = new DateTime(((Float) res.result).longValue());
+            }
+            return res;
+        }
+
+        case DataType.DATETIME: {
+            Result res = in.getNext(dt);
+            
+            return res;
+        }
+
+        case DataType.CHARARRAY: {
+            String str = null;
+            Result res = in.getNext(str);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                DateTimeZone dtz = ToDate.extractDateTimeZone((String) res.result);
+                if (dtz == null) {
+                    res.result = new DateTime((String) res.result);
+                } else {
+                    res.result = new DateTime((String) res.result, dtz);
+                }
+            }
+            return res;
+        }
+
+        }
+
+        Result res = new Result();
+        res.returnStatus = POStatus.STATUS_ERR;
+        return res;
+    }
+
+    @Override
     public Result getNext(String str) throws ExecException {
         PhysicalOperator in = inputs.get(0);
         Byte resultType = in.getResultType();
@@ -832,6 +1002,15 @@ public class POCast extends ExpressionOp
             return res;
         }
 
+        case DataType.DATETIME: {
+            DateTime dt = null;
+            Result res = in.getNext(dt);
+            if (res.returnStatus == POStatus.STATUS_OK && res.result != null) {
+                res.result = ((DateTime) res.result).toString();
+            }
+            return res;
+        }
+
         case DataType.CHARARRAY: {
             Result res = in.getNext(str);
 
@@ -931,7 +1110,9 @@ public class POCast extends ExpressionOp
 
         case DataType.CHARARRAY:
 
-        case DataType.BOOLEAN: {
+        case DataType.BOOLEAN:
+
+        case DataType.DATETIME: {
             Result res = new Result();
             res.returnStatus = POStatus.STATUS_ERR;
             return res;
@@ -1109,6 +1290,9 @@ public class POCast extends ExpressionOp
             case DataType.FLOAT:
                 result = Integer.valueOf(((Float)obj).intValue());
                 break;
+            case DataType.DATETIME:
+                result = Integer.valueOf(Long.valueOf(((DateTime)obj).getMillis()).intValue());
+                break;
             case DataType.CHARARRAY:
                 result = CastUtils.stringToInteger((String)obj);
                 break;
@@ -1145,6 +1329,9 @@ public class POCast extends ExpressionOp
             case DataType.FLOAT:
                 result = new Double(((Float)obj).doubleValue());
                 break;
+            case DataType.DATETIME:
+                result = new Double(Long.valueOf(((DateTime)obj).getMillis()).doubleValue());
+                break;
             case DataType.CHARARRAY:
                 result = CastUtils.stringToDouble((String)obj);
                 break;
@@ -1181,6 +1368,9 @@ public class POCast extends ExpressionOp
             case DataType.FLOAT:
                 result = Long.valueOf(((Float)obj).longValue());
                 break;
+            case DataType.DATETIME:
+                result = Long.valueOf(((DateTime)obj).getMillis());
+                break;
             case DataType.CHARARRAY:
                 result = CastUtils.stringToLong((String)obj);
                 break;
@@ -1217,6 +1407,9 @@ public class POCast extends ExpressionOp
             case DataType.FLOAT:
                 result = obj;
                 break;
+            case DataType.DATETIME:
+                result = new Float(Long.valueOf(((DateTime)obj).getMillis()).floatValue());
+                break;
             case DataType.CHARARRAY:
                 result = CastUtils.stringToFloat((String)obj);
                 break;
@@ -1224,6 +1417,44 @@ public class POCast extends ExpressionOp
                 throw new ExecException("Cannot convert "+ obj + " to " + fs, 1120, PigException.INPUT);
             }
             break;
+        case DataType.DATETIME:
+            switch (DataType.findType(obj)) {
+            case DataType.BYTEARRAY:
+                if (null != caster) {
+                    result = caster.bytesToDateTime(((DataByteArray)obj).get());
+                } else {
+                    int errCode = 1075;
+                    String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to datetime.";
+                    throw new ExecException(msg, errCode, PigException.INPUT);
+                }
+                break;
+            case DataType.INTEGER:
+                result = new DateTime(((Integer)obj).longValue());
+                break;
+            case DataType.DOUBLE:
+                result = new DateTime(((Double)obj).longValue());
+                break;
+            case DataType.LONG:
+                result = new DateTime(((Long)obj).longValue());
+                break;
+            case DataType.FLOAT:
+                result = new DateTime(((Float)obj).longValue());
+                break;
+            case DataType.DATETIME:
+                result = (DateTime)obj;
+                break;
+            case DataType.CHARARRAY:
+                DateTimeZone dtz = ToDate.extractDateTimeZone((String) obj);
+                if (dtz == null) {
+                    result = new DateTime((String) obj);
+                } else {
+                    result = new DateTime((String) obj, dtz);
+                }
+                break;
+            default:
+                throw new ExecException("Cannot convert "+ obj + " to " + fs, 1120, PigException.INPUT);
+            }
+            break;
         case DataType.CHARARRAY:
             switch (DataType.findType(obj)) {
             case DataType.BYTEARRAY:
@@ -1255,6 +1486,9 @@ public class POCast extends ExpressionOp
             case DataType.FLOAT:
                 result = ((Float) obj).toString();
                 break;
+            case DataType.DATETIME:
+                result = ((DateTime)obj).toString();
+                break;
             case DataType.CHARARRAY:
                 result = obj;
                 break;
@@ -1352,6 +1586,8 @@ public class POCast extends ExpressionOp
 
         case DataType.FLOAT:
 
+        case DataType.DATETIME:
+
         case DataType.CHARARRAY:
 
         case DataType.BOOLEAN: {
@@ -1457,6 +1693,8 @@ public class POCast extends ExpressionOp
 
         case DataType.LONG:
 
+        case DataType.DATETIME:
+
         case DataType.FLOAT:
 
         case DataType.CHARARRAY:

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POIsNull.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POIsNull.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POIsNull.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POIsNull.java Fri Aug 24 00:18:05 2012
@@ -69,6 +69,7 @@ public class POIsNull extends UnaryCompa
         case DataType.BOOLEAN:
         case DataType.LONG:
         case DataType.FLOAT:
+        case DataType.DATETIME:
         case DataType.MAP:
         case DataType.TUPLE:
         case DataType.BAG:

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POMapLookUp.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POMapLookUp.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POMapLookUp.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POMapLookUp.java Fri Aug 24 00:18:05 2012
@@ -20,6 +20,8 @@ package org.apache.pig.backend.hadoop.ex
 import java.util.List;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.POStatus;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result;
@@ -138,6 +140,11 @@ public class POMapLookUp extends Express
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+        return getNext();
+    }
+
+    @Override
     public Result getNext(Map m) throws ExecException {
         return getNext();
     }

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POProject.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POProject.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POProject.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POProject.java Fri Aug 24 00:18:05 2012
@@ -22,6 +22,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+
 import org.apache.pig.PigException;
 import org.apache.pig.PigWarning;
 import org.apache.pig.backend.executionengine.ExecException;
@@ -368,6 +370,11 @@ public class POProject extends Expressio
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+        return getNext();
+    }
+
+    @Override
     public Result getNext(Map m) throws ExecException {
         return getNext();
     }

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserComparisonFunc.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserComparisonFunc.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserComparisonFunc.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserComparisonFunc.java Fri Aug 24 00:18:05 2012
@@ -22,6 +22,8 @@ import java.io.ObjectInputStream;
 import java.util.List;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pig.ComparisonFunc;
@@ -129,6 +131,11 @@ public class POUserComparisonFunc extend
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+        return getNext();
+    }
+
+    @Override
     public Result getNext(Map m) throws ExecException {
         return getNext();
     }

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java Fri Aug 24 00:18:05 2012
@@ -27,6 +27,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.joda.time.DateTime;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -415,6 +417,12 @@ public class POUserFunc extends Expressi
     }
 
     @Override
+    public Result getNext(DateTime dt) throws ExecException {
+
+        return getNext();
+    }
+ 
+    @Override
     public Result getNext(Map m) throws ExecException {
 
         return getNext();

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java Fri Aug 24 00:18:05 2012
@@ -349,6 +349,7 @@ public class POForEach extends PhysicalO
                 case DataType.DOUBLE :
                 case DataType.LONG :
                 case DataType.FLOAT :
+                case DataType.DATETIME :
                 case DataType.CHARARRAY :
                     inputData = planLeafOps[i].getNext(getDummy(resultTypes[i]), resultTypes[i]);
                     break;

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLocalRearrange.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLocalRearrange.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLocalRearrange.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POLocalRearrange.java Fri Aug 24 00:18:05 2012
@@ -296,6 +296,7 @@ public class POLocalRearrange extends Ph
                 case DataType.FLOAT:
                 case DataType.INTEGER:
                 case DataType.LONG:
+                case DataType.DATETIME:
                 case DataType.MAP:
                 case DataType.TUPLE:
                     res = op.getNext(getDummy(op.getResultType()), op.getResultType());
@@ -326,6 +327,7 @@ public class POLocalRearrange extends Ph
                     case DataType.FLOAT:
                     case DataType.INTEGER:
                     case DataType.LONG:
+                    case DataType.DATETIME:
                     case DataType.MAP:
                     case DataType.TUPLE:
                         res = op.getNext(getDummy(op.getResultType()), op.getResultType());

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPartialAgg.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPartialAgg.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPartialAgg.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPartialAgg.java Fri Aug 24 00:18:05 2012
@@ -469,6 +469,7 @@ public class POPartialAgg extends Physic
         case DataType.FLOAT:
         case DataType.INTEGER:
         case DataType.LONG:
+        case DataType.DATETIME:
         case DataType.MAP:
         case DataType.TUPLE:
             res = op.getNext(getDummy(op.getResultType()), op.getResultType());

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPreCombinerLocalRearrange.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPreCombinerLocalRearrange.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPreCombinerLocalRearrange.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POPreCombinerLocalRearrange.java Fri Aug 24 00:18:05 2012
@@ -146,6 +146,7 @@ public class POPreCombinerLocalRearrange
                 case DataType.FLOAT:
                 case DataType.INTEGER:
                 case DataType.LONG:
+                case DataType.DATETIME:
                 case DataType.MAP:
                 case DataType.TUPLE:
                     res = op.getNext(getDummy(op.getResultType()), op.getResultType());

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSort.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSort.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSort.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POSort.java Fri Aug 24 00:18:05 2012
@@ -192,6 +192,7 @@ public class POSort extends PhysicalOper
             case DataType.BOOLEAN:
             case DataType.INTEGER:
             case DataType.LONG:
+            case DataType.DATETIME:
             case DataType.TUPLE:
                 res = Op.getNext(getDummy(resultType), resultType);
                 break;

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java Fri Aug 24 00:18:05 2012
@@ -20,6 +20,8 @@ package org.apache.pig.backend.hadoop.hb
 import java.io.IOException;
 import java.util.Map;
 
+import org.joda.time.DateTime;
+
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.pig.LoadStoreCaster;
 import org.apache.pig.ResourceSchema.ResourceFieldSchema;
@@ -80,6 +82,14 @@ public class HBaseBinaryConverter implem
         }
     }
 
+    /**
+     * NOT IMPLEMENTED
+     */
+    @Override
+    public DateTime bytesToDateTime(byte[] b) throws IOException {
+        throw new ExecException("Can't generate a DateTime from byte[]");
+    }
+
     @Override
     public Map<String, Object> bytesToMap(byte[] b) throws IOException {
         return bytesToMap(b, null);
@@ -150,6 +160,14 @@ public class HBaseBinaryConverter implem
      * NOT IMPLEMENTED
      */
     @Override
+    public byte[] toBytes(DateTime dt) throws IOException {
+        throw new IOException("Can't generate bytes from DateTime");
+    }
+
+    /**
+     * NOT IMPLEMENTED
+     */
+    @Override
     public byte[] toBytes(Map<String, Object> m) throws IOException {
         throw new IOException("Can't generate bytes from Map");
     }

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseStorage.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseStorage.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseStorage.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/hbase/HBaseStorage.java Fri Aug 24 00:18:05 2012
@@ -30,6 +30,8 @@ import java.util.NavigableMap;
 import java.util.HashMap;
 import java.util.Properties;
 
+import org.joda.time.DateTime;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
@@ -731,7 +733,8 @@ public class HBaseStorage extends LoadFu
         case DataType.INTEGER: return caster.toBytes((Integer) o);
         case DataType.LONG: return caster.toBytes((Long) o);
         case DataType.BOOLEAN: return caster.toBytes((Boolean) o);
-        
+        case DataType.DATETIME: return caster.toBytes((DateTime) o);
+
         // The type conversion here is unchecked. 
         // Relying on DataType.findType to do the right thing.
         case DataType.MAP: return caster.toBytes((Map<String, Object>) o);

Added: pig/trunk/src/org/apache/pig/builtin/AddDuration.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/AddDuration.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/AddDuration.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/AddDuration.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,77 @@
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+
+/**
+ * <p>AddDuration returns the result of a DateTime object plus a Duration object</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Duration Format: http://en.wikipedia.org/wiki/ISO_8601#Durations</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime, dr:chararray);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dr: chararray}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,PT1S)
+ * (2008-02-06T02:06:02.000Z,PT1M)
+ * (2007-03-05T03:05:03.000Z,P1D)
+ * ...
+ *
+ * dtadd = FOREACH ISOin GENERATE AddDuration(dt, dr) AS dt1;
+ *
+ * DESCRIBE dtadd;
+ * dtadd: {dt1: datetime}
+ *
+ * DUMP dtadd;
+ *
+ * (2009-01-07T01:07:02.000Z)
+ * (2008-02-06T02:07:02.000Z)
+ * (2007-03-06T03:05:03.000Z)
+ *
+ * </pre>
+ */
+public class AddDuration extends EvalFunc<DateTime> {
+
+    @Override
+    public DateTime exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+        
+        return ((DateTime) input.get(0)).plus(new Period((String) input.get(1)));
+    }
+    
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.DATETIME));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.CHARARRAY));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}

Modified: pig/trunk/src/org/apache/pig/builtin/BinStorage.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/BinStorage.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/BinStorage.java (original)
+++ pig/trunk/src/org/apache/pig/builtin/BinStorage.java Fri Aug 24 00:18:05 2012
@@ -28,6 +28,8 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 
+import org.joda.time.DateTime;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -115,6 +117,11 @@ implements StoreFuncInterface, LoadMetad
         }
 
         @Override
+        public DateTime bytesToDateTime(byte[] b) throws IOException {
+            throw new ExecException(unImplementedErrorMessage, 1118);
+        }
+
+        @Override
         public Map<String, Object> bytesToMap(byte[] b) throws IOException {
             return bytesToMap(b, null);
         }
@@ -262,6 +269,19 @@ implements StoreFuncInterface, LoadMetad
         return baos.toByteArray();
     }
 
+    public byte[] toBytes(DateTime dt) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        DataOutputStream dos = new DataOutputStream(baos);
+        try {
+            DataReaderWriter.writeDatum(dos, dt);
+        } catch (Exception ee) {
+            int errCode = 2105;
+            String msg = "Error while converting datetime to bytes.";
+            throw new ExecException(msg, errCode, PigException.BUG, ee);
+        }
+        return baos.toByteArray();
+    }
+
     public byte[] toBytes(Map<String, Object> m) throws IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream(baos);

Added: pig/trunk/src/org/apache/pig/builtin/CurrentTime.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/CurrentTime.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/CurrentTime.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/CurrentTime.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.joda.time.DateTime;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+
+/**
+ * 
+ *  <p>CURRENT_TIME generates the DateTime object of the current time.</p>
+ *
+ */
+public class CurrentTime extends EvalFunc<DateTime> {
+
+    public DateTime exec(Tuple input) throws IOException {
+        return new DateTime();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.DATETIME));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        return new ArrayList<FuncSpec>();
+    }
+    
+}

Added: pig/trunk/src/org/apache/pig/builtin/DaysBetween.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/DaysBetween.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/DaysBetween.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/DaysBetween.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+import org.joda.time.Days;
+
+/**
+ * <p>DaysBetween returns the number of days between two DateTime objects</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (datetime, dt2:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dt2: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,2008-02-01T00:00:00.000Z)
+ * (2008-02-06T02:06:02.000Z,2008-02-01T00:00:00.000Z)
+ * (2007-03-05T03:05:03.000Z,2008-02-01T00:00:00.000Z)
+ * ...
+ *
+ * diffs = FOREACH ISOin GENERATE YearsBetween(dt, dt2) AS years,
+ * MonthsBetween(dt, dt2) AS months,
+ * WeeksBetween(dt, dt2) AS weeks,
+ * DaysBetween(dt, dt2) AS days,
+ * HoursBetween(dt, dt2) AS hours,
+ * MinutesBetween(dt, dt2) AS mins,
+ * SecondsBetween(dt, dt2) AS secs;
+ * MilliSecondsBetween(dt, dt2) AS millis;
+ *
+ * DESCRIBE diffs;
+ * diffs: {years: long,months: long,weeks: long,days: long,hours: long,mins: long,secs: long,millis: long}
+ *
+ * DUMP diffs;
+ *
+ * (0L,11L,48L,341L,8185L,491107L,29466421L,29466421000L)
+ * (0L,0L,0L,5L,122L,7326L,439562L,439562000L)
+ * (0L,-10L,-47L,-332L,-7988L,-479334L,-28760097L,-28760097000L)
+ *
+ * </pre>
+ */
+public class DaysBetween extends EvalFunc<Long> {
+
+    @Override
+    public Long exec(Tuple input) throws IOException
+    {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+
+        DateTime startDate = (DateTime) input.get(0);
+        DateTime endDate = (DateTime) input.get(1);
+
+        // Larger date first
+        // Subtraction may overflow
+        return (startDate.getMillis() - endDate.getMillis()) / 86400000L;
+
+    }
+
+	@Override
+	public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.LONG));
+	}
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetDay.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetDay.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetDay.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetDay.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetDay extracts the day of a month from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetDay extends EvalFunc<Integer> {
+    
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+        
+        return ((DateTime) input.get(0)).getDayOfMonth();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetHour.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetHour.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetHour.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetHour.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetHour extracts the hour of a day from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetHour extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }        
+
+        return ((DateTime) input.get(0)).getHourOfDay();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetMilliSecond.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetMilliSecond.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetMilliSecond.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetMilliSecond.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetSecond extracts the millisecond of a second from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetMilliSecond extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getMillisOfSecond();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetMinute.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetMinute.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetMinute.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetMinute.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetMinute extracts the minute of an hour from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetMinute extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getMinuteOfHour();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetMonth.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetMonth.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetMonth.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetMonth.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetMonth extracts the month of a year from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetMonth extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getMonthOfYear();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetSecond.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetSecond.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetSecond.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetSecond.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetSecond extracts the second of a minute from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetSecond extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getSecondOfMinute();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetWeek.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetWeek.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetWeek.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetWeek.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetMonth extracts the week of a week year from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetWeek extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getWeekOfWeekyear();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetWeekYear.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetWeekYear.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetWeekYear.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetWeekYear.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetMonth extracts the week year from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetWeekYear extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getWeekyear();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/GetYear.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/GetYear.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/GetYear.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/GetYear.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * GetYear extracts the year from a DateTime object.
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ * 
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.071Z)
+ * (2008-02-06T02:06:02.062Z)
+ * (2007-03-05T03:05:03.053Z)
+ * ...
+ * 
+ * truncated = FOREACH ISO in GENERATE GetYear(dt) AS year,
+ *     GetMonth(dt) as month,
+ *     GetWeek(dt) as week,
+ *     GetWeekYear(dt) as weekyear,
+ *     GetDay(dt) AS day,
+ *     GetHour(dt) AS hour,
+ *     GetMinute(dt) AS min,
+ *     GetSecond(dt) AS sec;
+ *     GetMillSecond(dt) AS milli;
+ *
+ * DESCRIBE truncated;
+ * truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int}
+ *
+ * DUMP truncated;
+ * (2009,1,2,2009,7,1,7,1,71)
+ * (2008,2,6,2008,6,2,6,2,62)
+ * (2007,3,10,2007,5,3,5,3,53)
+ * </pre>
+ */
+public class GetYear extends EvalFunc<Integer> {
+
+    @Override
+    public Integer exec(Tuple input) throws IOException {
+        if (input == null || input.size() < 1) {
+            return null;
+        }
+
+        return ((DateTime) input.get(0)).getYear();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.INTEGER));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));
+
+        return funcList;
+    }
+
+}
+

Added: pig/trunk/src/org/apache/pig/builtin/HoursBetween.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/HoursBetween.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/HoursBetween.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/HoursBetween.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>HoursBetween returns the number of hours between two DateTime objects</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (datetime, dt2:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dt2: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,2008-02-01T00:00:00.000Z)
+ * (2008-02-06T02:06:02.000Z,2008-02-01T00:00:00.000Z)
+ * (2007-03-05T03:05:03.000Z,2008-02-01T00:00:00.000Z)
+ * ...
+ *
+ * diffs = FOREACH ISOin GENERATE YearsBetween(dt, dt2) AS years,
+ * MonthsBetween(dt, dt2) AS months,
+ * WeeksBetween(dt, dt2) AS weeks,
+ * DaysBetween(dt, dt2) AS days,
+ * HoursBetween(dt, dt2) AS hours,
+ * MinutesBetween(dt, dt2) AS mins,
+ * SecondsBetween(dt, dt2) AS secs;
+ * MilliSecondsBetween(dt, dt2) AS millis;
+ *
+ * DESCRIBE diffs;
+ * diffs: {years: long,months: long,weeks: long,days: long,hours: long,mins: long,secs: long,millis: long}
+ *
+ * DUMP diffs;
+ *
+ * (0L,11L,48L,341L,8185L,491107L,29466421L,29466421000L)
+ * (0L,0L,0L,5L,122L,7326L,439562L,439562000L)
+ * (0L,-10L,-47L,-332L,-7988L,-479334L,-28760097L,-28760097000L)
+ *
+ * </pre>
+ */
+public class HoursBetween extends EvalFunc<Long> {
+
+    @Override
+    public Long exec(Tuple input) throws IOException
+    {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+
+        DateTime startDate = (DateTime) input.get(0);
+        DateTime endDate = (DateTime) input.get(1);
+
+        // Larger date first
+        return (startDate.getMillis() - endDate.getMillis()) / 3600000L;
+
+    }
+
+	@Override
+	public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.LONG));
+	}
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/MilliSecondsBetween.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/MilliSecondsBetween.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/MilliSecondsBetween.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/MilliSecondsBetween.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+
+/**
+ * <p>MilliSecondsBetween returns the number of milliseconds between two DateTime objects</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (datetime, dt2:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dt2: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,2008-02-01T00:00:00.000Z)
+ * (2008-02-06T02:06:02.000Z,2008-02-01T00:00:00.000Z)
+ * (2007-03-05T03:05:03.000Z,2008-02-01T00:00:00.000Z)
+ * ...
+ *
+ * diffs = FOREACH ISOin GENERATE YearsBetween(dt, dt2) AS years,
+ * MonthsBetween(dt, dt2) AS months,
+ * WeeksBetween(dt, dt2) AS weeks,
+ * DaysBetween(dt, dt2) AS days,
+ * HoursBetween(dt, dt2) AS hours,
+ * MinutesBetween(dt, dt2) AS mins,
+ * SecondsBetween(dt, dt2) AS secs;
+ * MilliSecondsBetween(dt, dt2) AS millis;
+ *
+ * DESCRIBE diffs;
+ * diffs: {years: long,months: long,weeks: long,days: long,hours: long,mins: long,secs: long,millis: long}
+ *
+ * DUMP diffs;
+ *
+ * (0L,11L,48L,341L,8185L,491107L,29466421L,29466421000L)
+ * (0L,0L,0L,5L,122L,7326L,439562L,439562000L)
+ * (0L,-10L,-47L,-332L,-7988L,-479334L,-28760097L,-28760097000L)
+ *
+ * </pre>
+ */
+public class MilliSecondsBetween extends EvalFunc<Long> {
+
+    @Override
+    public Long exec(Tuple input) throws IOException
+    {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+
+        DateTime startDate = (DateTime) input.get(0);
+        DateTime endDate = (DateTime) input.get(1);
+
+        // Larger date first
+        // Subtraction may overflow
+        return startDate.getMillis() - endDate.getMillis();
+    }
+
+    @Override
+    public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.LONG));
+    }
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/MinutesBetween.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/MinutesBetween.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/MinutesBetween.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/MinutesBetween.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+import org.joda.time.Minutes;
+
+/**
+ * <p>MinutesBetween returns the number of minutes between two DateTime objects</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (datetime, dt2:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dt2: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,2008-02-01T00:00:00.000Z)
+ * (2008-02-06T02:06:02.000Z,2008-02-01T00:00:00.000Z)
+ * (2007-03-05T03:05:03.000Z,2008-02-01T00:00:00.000Z)
+ * ...
+ *
+ * diffs = FOREACH ISOin GENERATE YearsBetween(dt, dt2) AS years,
+ * MonthsBetween(dt, dt2) AS months,
+ * WeeksBetween(dt, dt2) AS weeks,
+ * DaysBetween(dt, dt2) AS days,
+ * HoursBetween(dt, dt2) AS hours,
+ * MinutesBetween(dt, dt2) AS mins,
+ * SecondsBetween(dt, dt2) AS secs;
+ * MilliSecondsBetween(dt, dt2) AS millis;
+ *
+ * DESCRIBE diffs;
+ * diffs: {years: long,months: long,weeks: long,days: long,hours: long,mins: long,secs: long,millis: long}
+ *
+ * DUMP diffs;
+ *
+ * (0L,11L,48L,341L,8185L,491107L,29466421L,29466421000L)
+ * (0L,0L,0L,5L,122L,7326L,439562L,439562000L)
+ * (0L,-10L,-47L,-332L,-7988L,-479334L,-28760097L,-28760097000L)
+ *
+ * </pre>
+ */
+public class MinutesBetween extends EvalFunc<Long> {
+
+    @Override
+    public Long exec(Tuple input) throws IOException
+    {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+
+        DateTime startDate = (DateTime) input.get(0);
+        DateTime endDate = (DateTime) input.get(1);
+
+        // Larger date first
+        // Subtraction may overflow
+        return (startDate.getMillis() - endDate.getMillis()) / 60000L;
+    }
+
+	@Override
+	public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.LONG));
+	}
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}

Added: pig/trunk/src/org/apache/pig/builtin/MonthsBetween.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/MonthsBetween.java?rev=1376800&view=auto
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/MonthsBetween.java (added)
+++ pig/trunk/src/org/apache/pig/builtin/MonthsBetween.java Fri Aug 24 00:18:05 2012
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pig.builtin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pig.EvalFunc;
+import org.apache.pig.FuncSpec;
+import org.apache.pig.data.DataType;
+import org.apache.pig.data.Tuple;
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.logicalLayer.schema.Schema;
+import org.joda.time.DateTime;
+import org.joda.time.Months;
+
+/**
+ * <p>MonthsBetween returns the number of months between two DateTime objects</p>
+ *
+ * <ul>
+ * <li>Jodatime: http://joda-time.sourceforge.net/</li>
+ * <li>ISO8601 Date Format: http://en.wikipedia.org/wiki/ISO_8601</li>
+ * </ul>
+ * <br />
+ * <pre>
+ * Example usage:
+ *
+ * ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (datetime, dt2:datetime);
+ *
+ * DESCRIBE ISOin;
+ * ISOin: {dt: datetime,dt2: datetime}
+ *
+ * DUMP ISOin;
+ *
+ * (2009-01-07T01:07:01.000Z,2008-02-01T00:00:00.000Z)
+ * (2008-02-06T02:06:02.000Z,2008-02-01T00:00:00.000Z)
+ * (2007-03-05T03:05:03.000Z,2008-02-01T00:00:00.000Z)
+ * ...
+ *
+ * diffs = FOREACH ISOin GENERATE YearsBetween(dt, dt2) AS years,
+ * MonthsBetween(dt, dt2) AS months,
+ * WeeksBetween(dt, dt2) AS weeks,
+ * DaysBetween(dt, dt2) AS days,
+ * HoursBetween(dt, dt2) AS hours,
+ * MinutesBetween(dt, dt2) AS mins,
+ * SecondsBetween(dt, dt2) AS secs;
+ * MilliSecondsBetween(dt, dt2) AS millis;
+ *
+ * DESCRIBE diffs;
+ * diffs: {years: long,months: long,weeks: long,days: long,hours: long,mins: long,secs: long,millis: long}
+ *
+ * DUMP diffs;
+ *
+ * (0L,11L,48L,341L,8185L,491107L,29466421L,29466421000L)
+ * (0L,0L,0L,5L,122L,7326L,439562L,439562000L)
+ * (0L,-10L,-47L,-332L,-7988L,-479334L,-28760097L,-28760097000L)
+ *
+ * </pre>
+ */
+public class MonthsBetween extends EvalFunc<Long> {
+
+    @Override
+    public Long exec(Tuple input) throws IOException
+    {
+        if (input == null || input.size() < 2) {
+            return null;
+        }
+
+        DateTime startDate = (DateTime) input.get(0);
+        DateTime endDate = (DateTime) input.get(1);
+
+        // Larger value first
+        Months m = Months.monthsBetween(endDate, startDate);
+        // joda limitation, only integer range, at the risk of overflow, need to be improved
+        return (long) m.getMonths();
+
+    }
+
+	@Override
+	public Schema outputSchema(Schema input) {
+        return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input), DataType.LONG));
+	}
+
+    @Override
+    public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
+        List<FuncSpec> funcList = new ArrayList<FuncSpec>();
+        Schema s = new Schema();
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        s.add(new Schema.FieldSchema(null, DataType.DATETIME));
+        funcList.add(new FuncSpec(this.getClass().getName(), s));
+        return funcList;
+    }
+}



Mime
View raw message