Package org.apache.hadoop.hive.serde2.io

Examples of org.apache.hadoop.hive.serde2.io.DateWritable


    ObjectInspector valueOI2 = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
    ObjectInspector[] arguments = {valueOI1, valueOI2};


    udf.initialize(arguments);
    DeferredObject valueObj1 = new DeferredJavaObject(new DateWritable(new Date(109, 06, 20)));
    DeferredObject valueObj2 = new DeferredJavaObject(new Integer("4"));
    DeferredObject[] args = {valueObj1, valueObj2};
    Text output = (Text) udf.evaluate(args);

    assertEquals("date_add() test for DATEWRITABLE failed ", "2009-07-24", output.toString());
View Full Code Here


            continue;
          }

          // Dates are stored as long, so convert and compare
          if (a instanceof DateWritable) {
            DateWritable adt = (DateWritable) a;
            Assert.assertEquals(adt.get().getTime(), DateWritable.daysToMillis((int) ((LongWritable) b).get()));
            continue;
          }

          // Decimals are stored as BigInteger, so convert and compare
          if (a instanceof HiveDecimalWritable) {
View Full Code Here

        PredicateLeaf.Type.STRING, "x", "15", null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createIntStats(10, 100), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(15), null);
    assertEquals(TruthValue.NO,
        RecordReaderImpl.evaluatePredicate(createIntStats(10, 100), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DECIMAL, "x", HiveDecimal.create(15), null);
View Full Code Here

        PredicateLeaf.Type.STRING, "x", "15", null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createDoubleStats(10.0, 100.0), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(15), null);
    assertEquals(TruthValue.NO,
        RecordReaderImpl.evaluatePredicate(createDoubleStats(10.0, 100.0), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DECIMAL, "x", HiveDecimal.create(15), null);
View Full Code Here

        PredicateLeaf.Type.STRING, "x", "100", null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createStringStats("10", "1000"), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(100), null);
    assertEquals(TruthValue.NO,
        RecordReaderImpl.evaluatePredicate(createStringStats("10", "1000"), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DECIMAL, "x", HiveDecimal.create(100), null);
View Full Code Here

        PredicateLeaf.Type.STRING, "x", "1970-01-16", null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createDateStats(10, 100), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(15), null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createDateStats(10, 100), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(150), null);
    assertEquals(TruthValue.NO,
        RecordReaderImpl.evaluatePredicate(createDateStats(10, 100), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DECIMAL, "x", HiveDecimal.create(15), null);
View Full Code Here

        PredicateLeaf.Type.STRING, "x", "15", null);
    assertEquals(TruthValue.YES_NO,
        RecordReaderImpl.evaluatePredicate(createDecimalStats("10.0", "100.0"), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DATE, "x", new DateWritable(15), null);
    assertEquals(TruthValue.NO,
        RecordReaderImpl.evaluatePredicate(createDecimalStats("10.0", "100.0"), pred));

    pred = TestSearchArgumentImpl.createPredicateLeaf(PredicateLeaf.Operator.NULL_SAFE_EQUALS,
        PredicateLeaf.Type.DECIMAL, "x", HiveDecimal.create(15), null);
View Full Code Here

        BytesWritable bw2 = ((BinaryObjectInspector) poi2).getPrimitiveWritableObject(o2);
        return bw1.compareTo(bw2);
      }

      case DATE: {
        DateWritable d1 = ((DateObjectInspector) poi1)
            .getPrimitiveWritableObject(o1);
        DateWritable d2 = ((DateObjectInspector) poi2)
            .getPrimitiveWritableObject(o2);
        return d1.compareTo(d2);
      }
      case TIMESTAMP: {
        TimestampWritable t1 = ((TimestampObjectInspector) poi1)
View Full Code Here

        byteStream.write(bw.getBytes(),0,length);
        return;
      }

      case DATE: {
        DateWritable d = ((DateObjectInspector) poi).getPrimitiveWritableObject(obj);
        d.writeToByteStream(byteStream);
        return;
      }
      case TIMESTAMP: {
        TimestampObjectInspector toi = (TimestampObjectInspector) poi;
        TimestampWritable t = toi.getPrimitiveWritableObject(obj);
View Full Code Here

        }
        return bw;
      }

      case DATE: {
        DateWritable d = reuse == null ? new DateWritable()
            : (DateWritable) reuse;
        d.set(deserializeInt(buffer, invert));
        return d;
      }

      case TIMESTAMP:
        TimestampWritable t = (reuse == null ? new TimestampWritable() :
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.serde2.io.DateWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.