pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From the...@apache.org
Subject svn commit: r1376800 [6/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/test/org/apache/pig/test/TestPigTupleRawComparator.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestPigTupleRawComparator.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestPigTupleRawComparator.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestPigTupleRawComparator.java Fri Aug 24 00:18:05
2012
@@ -29,6 +29,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 
+import org.joda.time.DateTime;
+
 import org.apache.hadoop.io.RawComparator;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigTupleDefaultRawComparator;
@@ -65,7 +67,7 @@ public class TestPigTupleRawComparator {
         oldComparator.setConf(jobConf);
         list = Arrays.<Object> asList(1f, 2, 3.0, 4l, (byte) 5, true,
                 new DataByteArray(new byte[] { 0x10, 0x2a, 0x5e }), "hello world!",
-                tf.newTuple(Arrays.<Object> asList(8.0, 9f, 10l, 11)));
+                tf.newTuple(Arrays.<Object> asList(8.0, 9f, 10l, 11)), new DateTime(12L));
         prototype = new NullableTuple(tf.newTuple(list));
         baos1.reset();
         baos2.reset();
@@ -359,6 +361,15 @@ public class TestPigTupleRawComparator {
     }
 
     @Test
+    public void testCompareDateTime() throws IOException {
+        list.set(9, ((DateTime) list.get(9)).plus(1L));
+        NullableTuple t = new NullableTuple(tf.newTuple(list));
+        int res = compareHelper(prototype, t, comparator);
+        assertEquals(Math.signum(prototype.compareTo(t)), Math.signum(res), 0);
+        assertTrue(res < 0);
+    }
+
+    @Test
     public void testCompareDiffertTypes() throws IOException {
         // DataType.INTEGER < DataType.LONG
         list.set(3, 4);
@@ -442,6 +453,10 @@ public class TestPigTupleRawComparator {
         case 8:
             length = rand.nextInt(6);
             t.set(pos, getRandomTuple(rand));
+            break;
+        case 9:
+            t.set(pos, new DateTime(rand.nextLong()));
+            break;
         default:
         }
         return t;

Modified: pig/trunk/test/org/apache/pig/test/TestResourceSchema.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestResourceSchema.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestResourceSchema.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestResourceSchema.java Fri Aug 24 00:18:05 2012
@@ -280,16 +280,16 @@ public class TestResourceSchema {
     @Test
     public void testToStringAndParse() throws Exception {
         ResourceSchema rs = new ResourceSchema();
-        ResourceFieldSchema[] fields = new ResourceFieldSchema[12];
+        ResourceFieldSchema[] fields = new ResourceFieldSchema[13];
 
         byte[] types = {DataType.INTEGER, DataType.LONG, DataType.FLOAT,
             DataType.DOUBLE, DataType.BYTEARRAY, DataType.CHARARRAY,
             DataType.MAP, DataType.TUPLE, DataType.TUPLE, DataType.BAG,
-            DataType.BAG, DataType.BOOLEAN};
+            DataType.BAG, DataType.BOOLEAN, DataType.DATETIME};
         String[] names = {"i", "l", "f",
             "d", "b", "s",
             "m", "tschema", "tnull", "bschema",
-            "bnull", "bb"};
+            "bnull", "bb", "dt"};
         
         for (int i = 0; i < fields.length; i++) {
             fields[i] = new ResourceFieldSchema();
@@ -334,14 +334,14 @@ public class TestResourceSchema {
 
         assertEquals("i:int,l:long,f:float,d:double,b:bytearray,s:" +
             "chararray,m:[],tschema:(i:int,l:long,f:float)," +
-            "tnull:(),bschema:{t:(d:double,b:bytearray,s:chararray)},bnull:{},bb:boolean",
+            "tnull:(),bschema:{t:(d:double,b:bytearray,s:chararray)},bnull:{},bb:boolean,dt:datetime",
             strSchema);
 
         ResourceSchema after =
             new ResourceSchema(Utils.getSchemaFromString(strSchema));
         ResourceFieldSchema[] afterFields = after.getFields();
 
-        assertEquals(12, afterFields.length);
+        assertEquals(13, afterFields.length);
         assertEquals("i", afterFields[0].getName());
         assertEquals(DataType.INTEGER, afterFields[0].getType());
         assertEquals("l", afterFields[1].getName());
@@ -366,6 +366,9 @@ public class TestResourceSchema {
         assertEquals(DataType.BAG, afterFields[10].getType());
         assertEquals("bb", afterFields[11].getName());
         assertEquals(DataType.BOOLEAN, afterFields[11].getType());
+        assertEquals("dt", afterFields[12].getName());
+        assertEquals(DataType.DATETIME, afterFields[12].getType());
+        
 
         assertNotNull(afterFields[7].getSchema());
         ResourceFieldSchema[] tAfterFields =

Modified: pig/trunk/test/org/apache/pig/test/TestSchema.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestSchema.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestSchema.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestSchema.java Fri Aug 24 00:18:05 2012
@@ -871,10 +871,10 @@ public class TestSchema {
             "float,float,float,float,float,float,float,float,float,float",
             "double,double,double,double,double,double,double,double,double,double",
             "boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean,boolean",
-            "(),(),(),(),(),(),(),(),(),()",
+            "datetime,datetime,datetime,datetime,datetime,datetime,datetime,datetime,datetime,datetime",
             "{},{},{},{},{},{},{},{},{},{}",
             "map[],map[],map[],map[],map[],map[],map[],map[],map[],map[]",
-            "int,int,long,long,float,float,double,double,boolean,boolean,(int,long,float,double,boolean),{(int,long,float,double,boolean)},map[(int,long,float,double,boolean)]"
+            "int,int,long,long,float,float,double,double,boolean,boolean,datetime,datetime(int,long,float,double,boolean,datetime),{(int,long,float,double,boolean,datetime)},map[(int,long,float,double,boolean,datetime)]"
         };
         for (String schemaString : schemaStrings) {
             Schema s1 = Utils.getSchemaFromString(schemaString);

Modified: pig/trunk/test/org/apache/pig/test/TestStore.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestStore.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestStore.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestStore.java Fri Aug 24 00:18:05 2012
@@ -70,6 +70,7 @@ import org.apache.pig.parser.ParserExcep
 import org.apache.pig.parser.QueryParserDriver;
 import org.apache.pig.test.utils.GenRandomData;
 import org.apache.pig.test.utils.TestHelper;
+import org.joda.time.DateTimeZone;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -103,6 +104,8 @@ public class TestStore extends junit.fra
         pc = pig.getPigContext();
         inputFileName = "/tmp/TestStore-" + new Random().nextLong() + ".txt";
         outputFileName = "/tmp/TestStore-output-" + new Random().nextLong() + ".txt";
+        
+        DateTimeZone.setDefault(DateTimeZone.forOffsetMillis(DateTimeZone.UTC.getOffset(null)));
     }
 
     @Override
@@ -116,7 +119,7 @@ public class TestStore extends junit.fra
     private void storeAndCopyLocally(DataBag inpDB) throws Exception {
         setUpInputFileOnCluster(inpDB);
         String script = "a = load '" + inputFileName + "'; " +
-                "store a into '" + outputFileName + "' using PigStorage(':');" +
+                "store a into '" + outputFileName + "' using PigStorage('\t');" +
                 "fs -ls /tmp";
         pig.setBatchOn();
         Util.registerMultiLineQuery(pig, script);
@@ -180,7 +183,7 @@ public class TestStore extends junit.fra
         int size = 0;
         BufferedReader br = new BufferedReader(new FileReader(outputFileName));
         for(String line=br.readLine();line!=null;line=br.readLine()){
-            String[] flds = line.split(":",-1);
+            String[] flds = line.split("\t",-1);
             Tuple t = new DefaultTuple();
             t.append(flds[0].compareTo("")!=0 ? flds[0] : null);
             t.append(flds[1].compareTo("")!=0 ? Integer.parseInt(flds[1]) : null);
@@ -235,11 +238,11 @@ public class TestStore extends junit.fra
     public void testStoreComplexData() throws Exception {
         inpDB = GenRandomData.genRandFullTupTextDataBag(new Random(), 10, 100);
         storeAndCopyLocally(inpDB);
-        PigStorage ps = new PigStorage(":");
+        PigStorage ps = new PigStorage("\t");
         int size = 0;
         BufferedReader br = new BufferedReader(new FileReader(outputFileName));
         for(String line=br.readLine();line!=null;line=br.readLine()){
-            String[] flds = line.split(":",-1);
+            String[] flds = line.split("\t",-1);
             Tuple t = new DefaultTuple();
             
             ResourceFieldSchema bagfs = GenRandomData.getSmallTupDataBagFieldSchema();
@@ -255,6 +258,7 @@ public class TestStore extends junit.fra
             t.append(flds[7].compareTo("")!=0 ? ps.getLoadCaster().bytesToMap(flds[7].getBytes())
: null);
             t.append(flds[8].compareTo("")!=0 ? ps.getLoadCaster().bytesToTuple(flds[8].getBytes(),
tuplefs) : null);
             t.append(flds[9].compareTo("")!=0 ? ps.getLoadCaster().bytesToBoolean(flds[9].getBytes())
: null);
+            t.append(flds[10].compareTo("")!=0 ? ps.getLoadCaster().bytesToDateTime(flds[10].getBytes())
: null);
             assertEquals(true, TestHelper.bagContains(inpDB, t));
             ++size;
         }
@@ -267,13 +271,13 @@ public class TestStore extends junit.fra
         inpDB = DefaultBagFactory.getInstance().newDefaultBag();
         inpDB.add(inputTuple);
         storeAndCopyLocally(inpDB);
-        PigStorage ps = new PigStorage(":");
+        PigStorage ps = new PigStorage("\t");
         int size = 0;
         BufferedReader br = new BufferedReader(new FileReader(outputFileName));
         for(String line=br.readLine();line!=null;line=br.readLine()){
             System.err.println("Complex data: ");
             System.err.println(line);
-            String[] flds = line.split(":",-1);
+            String[] flds = line.split("\t",-1);
             Tuple t = new DefaultTuple();
             
             ResourceFieldSchema stringfs = new ResourceFieldSchema();
@@ -303,7 +307,8 @@ public class TestStore extends junit.fra
             t.append(flds[7].compareTo("")!=0 ? ps.getLoadCaster().bytesToMap(flds[7].getBytes())
: null);
             t.append(flds[8].compareTo("")!=0 ? ps.getLoadCaster().bytesToTuple(flds[8].getBytes(),
tuplefs) : null);
             t.append(flds[9].compareTo("")!=0 ? ps.getLoadCaster().bytesToBoolean(flds[9].getBytes())
: null);
-            t.append(flds[10].compareTo("")!=0 ? ps.getLoadCaster().bytesToCharArray(flds[10].getBytes())
: null);
+            t.append(flds[10].compareTo("")!=0 ? ps.getLoadCaster().bytesToDateTime(flds[10].getBytes())
: null);
+            t.append(flds[11].compareTo("")!=0 ? ps.getLoadCaster().bytesToCharArray(flds[10].getBytes())
: null);
             assertTrue(TestHelper.tupleEquals(inputTuple, t));
             ++size;
         }

Modified: pig/trunk/test/org/apache/pig/test/TestSubtract.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestSubtract.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestSubtract.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestSubtract.java Fri Aug 24 00:18:05 2012
@@ -23,6 +23,8 @@ import java.util.Random;
 
 import junit.framework.TestCase;
 
+import org.joda.time.DateTime;
+
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
@@ -54,7 +56,7 @@ public class TestSubtract extends TestCa
     public void testOperator() throws ExecException{
         //int TRIALS = 10;
         byte[] types = { DataType.BAG, DataType.BOOLEAN, DataType.BYTEARRAY, DataType.CHARARRAY,

-                DataType.DOUBLE, DataType.FLOAT, DataType.INTEGER, DataType.LONG, DataType.MAP,
DataType.TUPLE};
+                DataType.DOUBLE, DataType.FLOAT, DataType.INTEGER, DataType.LONG, DataType.DATETIME,
DataType.MAP, DataType.TUPLE};
         //Map<Byte,String> map = GenRandomData.genTypeToNameMap();
         System.out.println("Testing Subtract operator");
         for(byte type : types) {
@@ -230,6 +232,26 @@ public class TestSubtract extends TestCa
                 assertEquals(null, (Long)resl.result);
                 break;
             }
+            case DataType.DATETIME: {
+                DateTime inpdt1 = new DateTime(r.nextLong());
+                DateTime inpdt2 = new DateTime(r.nextLong());
+                lt.setValue(inpdt1);
+                rt.setValue(inpdt2);
+                Result resdt = op.getNext(inpdt1);
+                assertEquals(resdt.returnStatus, POStatus.STATUS_ERR);
+                
+                // test with null in lhs
+                lt.setValue(null);
+                rt.setValue(inpdt2);
+                resdt = op.getNext(inpdt1);
+                assertEquals(resdt.returnStatus, POStatus.STATUS_ERR);
+                // test with null in rhs
+                lt.setValue(inpdt1);
+                rt.setValue(null);
+                resdt = op.getNext(inpdt1);
+                assertEquals(resdt.returnStatus, POStatus.STATUS_ERR);
+                break;
+            }
             case DataType.MAP: {
                 Map<String,Object> inpm1 = GenRandomData.genRandMap(r, 10);
                 Map<String,Object> inpm2 = GenRandomData.genRandMap(r, 10);

Modified: pig/trunk/test/org/apache/pig/test/TestTextDataParser.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestTextDataParser.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestTextDataParser.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestTextDataParser.java Fri Aug 24 00:18:05 2012
@@ -20,6 +20,9 @@ package org.apache.pig.test;
 import java.io.IOException;
 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.ResourceSchema;
@@ -109,6 +112,13 @@ public class TestTextDataParser extends 
         Double d = ps.getLoadCaster().bytesToDouble(myDouble.getBytes());
         assertTrue(d.equals(0.1));
     }
+
+    @Test
+    public void testDateTime() throws Exception{
+        String myDateTime = "1970-01-01T00:00:00.000Z";
+        DateTime d = ps.getLoadCaster().bytesToDateTime(myDateTime.getBytes());
+        assertTrue(d.equals(new DateTime(myDateTime, DateTimeZone.forID("+00:00"))));
+    }
     
     @Test
     public void testString() throws Exception{

Modified: pig/trunk/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestTypeCheckingValidatorNewLP.java Fri Aug 24 00:18:05
2012
@@ -44,6 +44,8 @@ import java.util.Properties;
 
 import junit.framework.Assert;
 
+import org.joda.time.DateTime;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.pig.EvalFunc;
 import org.apache.pig.ExecType;
@@ -82,6 +84,8 @@ import org.apache.pig.newplan.logical.ex
 import org.apache.pig.newplan.logical.expression.DivideExpression;
 import org.apache.pig.newplan.logical.expression.EqualExpression;
 import org.apache.pig.newplan.logical.expression.GreaterThanExpression;
+import org.apache.pig.newplan.logical.expression.GreaterThanEqualExpression;
+import org.apache.pig.newplan.logical.expression.LessThanExpression;
 import org.apache.pig.newplan.logical.expression.LessThanEqualExpression;
 import org.apache.pig.newplan.logical.expression.LogicalExpression;
 import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
@@ -700,6 +704,78 @@ public class TestTypeCheckingValidatorNe
     }
 
     @Test
+    public void testExpressionTypeChecking11() throws Throwable {
+        // test whether conditional operators can accept two datetime operands
+        LogicalExpressionPlan plan = new LogicalExpressionPlan();
+        ConstantExpression constant0 = new ConstantExpression(plan, new DateTime(0L));
+        ConstantExpression constant1 = new ConstantExpression(plan, new DateTime("1970-01-01T00:00:00.000Z"));
+        ConstantExpression constant2 = new ConstantExpression(plan, new DateTime(1L));
+        ConstantExpression constant3 = new ConstantExpression(plan, new DateTime(2L));
+        ConstantExpression constant4 = new ConstantExpression(plan, new DataByteArray("1970-01-01T00:00:00.003Z"));
+
+        LessThanExpression lt1 = new LessThanExpression(plan, constant1, constant2);
+        LessThanEqualExpression lte1 = new LessThanEqualExpression(plan, constant1, constant2);
+        GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant3, constant4);
+        GreaterThanEqualExpression gte1 = new GreaterThanEqualExpression(plan, constant3,
constant4);
+        EqualExpression eq1 = new EqualExpression(plan, constant0, constant1);
+        NotEqualExpression neq1 = new NotEqualExpression(plan, constant0, constant2);
+
+        CompilationMessageCollector collector = new CompilationMessageCollector();
+        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(
+                plan, collector, null);
+        expTypeChecker.visit();
+
+        plan.explain(System.out, "text", true);
+
+        printMessageCollector(collector);
+        // printTypeGraph(plan) ;
+
+        if (collector.hasError()) {
+            throw new Exception("Error during type checking");
+        }
+
+        // Induction check
+        assertEquals(DataType.BOOLEAN, lt1.getType());
+        assertEquals(DataType.BOOLEAN, lte1.getType());
+        assertEquals(DataType.BOOLEAN, gt1.getType());
+        assertEquals(DataType.BOOLEAN, gte1.getType());
+        assertEquals(DataType.BOOLEAN, eq1.getType());
+        assertEquals(DataType.BOOLEAN, neq1.getType());
+
+        // Cast insertion check
+        assertEquals(DataType.DATETIME, gt1.getRhs().getType());
+        assertEquals(DataType.DATETIME, gte1.getRhs().getType());
+    }
+    
+    @Test
+    public void testExpressionTypeCheckingFail11() throws Throwable {
+        // test whether conditional operators will reject the operation of one
+        // value of datetime and one of other type
+        LogicalExpressionPlan plan = new LogicalExpressionPlan();
+        ConstantExpression constant0 = new ConstantExpression(plan, new DateTime(0L));
+        ConstantExpression constant1 = new ConstantExpression(plan, new DataByteArray("1970-01-01T00:00:00.000Z"));
+        CastExpression cast1 = new CastExpression(plan,  constant1, createFS(DataType.BYTEARRAY))
;
+        EqualExpression eq1 = new EqualExpression(plan, constant0, cast1);
+
+        CompilationMessageCollector collector = new CompilationMessageCollector();
+        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(
+                plan, collector, null);
+
+        try {
+            expTypeChecker.visit();
+            fail("Exception expected");
+        } catch (TypeCheckerException pve) {
+            // good
+        }
+        printMessageCollector(collector);
+        // printTypeGraph(plan) ;
+
+        if (!collector.hasError()) {
+            throw new Exception("Error during type checking");
+        }
+    }
+
+    @Test
     public void testArithmeticOpCastInsert1() throws Throwable {
         LogicalExpressionPlan plan = new LogicalExpressionPlan() ;
         ConstantExpression constant1 = new ConstantExpression(plan, 10) ;

Modified: pig/trunk/test/org/apache/pig/test/utils/GenRandomData.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/utils/GenRandomData.java?rev=1376800&r1=1376799&r2=1376800&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/utils/GenRandomData.java (original)
+++ pig/trunk/test/org/apache/pig/test/utils/GenRandomData.java Fri Aug 24 00:18:05 2012
@@ -22,6 +22,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
 
+import org.joda.time.DateTime;
+
 import org.apache.pig.ResourceSchema;
 import org.apache.pig.ResourceSchema.ResourceFieldSchema;
 import org.apache.pig.data.DataBag;
@@ -188,6 +190,7 @@ public class GenRandomData {
         t.append(genRandMap(r, num));
         t.append(genRandSmallTuple(r, 100));
         t.append(new Boolean(r.nextBoolean()));
+        t.append(new DateTime(r.nextLong()));
         return t;
     }
     
@@ -219,10 +222,13 @@ public class GenRandomData {
 
         ResourceFieldSchema boolfs = new ResourceFieldSchema();
         boolfs.setType(DataType.BOOLEAN);
+
+        ResourceFieldSchema dtfs = new ResourceFieldSchema();
+        dtfs.setType(DataType.DATETIME);
         
         ResourceSchema outSchema = new ResourceSchema();
         outSchema.setFields(new ResourceFieldSchema[]{bagfs, dbafs, stringfs, doublefs, floatfs,
-                intfs, longfs, mapfs, tuplefs, boolfs});
+                intfs, longfs, mapfs, tuplefs, boolfs, dtfs});
         ResourceFieldSchema outfs = new ResourceFieldSchema();
         outfs.setSchema(outSchema);
         outfs.setType(DataType.TUPLE);
@@ -251,6 +257,7 @@ public class GenRandomData {
         t.append(genRandMap(r, num));
         t.append(genRandSmallTuple(r, 100));
         t.append(new Boolean(r.nextBoolean()));
+        t.append(new DateTime(r.nextLong()));
         return t;
     }
     
@@ -313,6 +320,7 @@ public class GenRandomData {
         t.append(genRandMap(r, num));
         t.append(genRandSmallTuple(r, 100));
         t.append(new Boolean(r.nextBoolean()));
+        t.append(new DateTime(r.nextLong()));
         t.append(null);
         return t;
     }
@@ -338,6 +346,7 @@ public class GenRandomData {
         t.append(genRandMap(r, num));
         t.append(genRandSmallTuple(r, 100));
         t.append(new Boolean(r.nextBoolean()));
+        t.append(new DateTime(r.nextLong()));
         t.append(null);
         return t;
     }
@@ -395,6 +404,7 @@ public class GenRandomData {
             t.append("true");
         else
             t.append("false");
+        t.append(new DateTime(r.nextLong()));
         return t;
     }
     
@@ -411,9 +421,11 @@ public class GenRandomData {
         doublefs.setType(DataType.DOUBLE);
         ResourceFieldSchema boolfs = new ResourceFieldSchema();
         boolfs.setType(DataType.BOOLEAN);
+        ResourceFieldSchema dtfs = new ResourceFieldSchema();
+        dtfs.setType(DataType.DATETIME);
         
         ResourceSchema tupleSchema = new ResourceSchema();
-        tupleSchema.setFields(new ResourceFieldSchema[]{stringfs, longfs, intfs, doublefs,
floatfs, stringfs, intfs, doublefs, floatfs, boolfs});
+        tupleSchema.setFields(new ResourceFieldSchema[]{stringfs, longfs, intfs, doublefs,
floatfs, stringfs, intfs, doublefs, floatfs, boolfs, dtfs});
         ResourceFieldSchema tuplefs = new ResourceFieldSchema();
         tuplefs.setSchema(tupleSchema);
         tuplefs.setType(DataType.TUPLE);



Mime
View raw message