Examples of DateWritable


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

        DateOption object = (DateOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        Date value = object.get();
        return new DateWritable(value.getElapsedDays() - EPOCH_OFFSET);
    }
View Full Code Here

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

            target.setNull();
        } else if (primitive) {
            java.sql.Date entity = inspector.getPrimitiveJavaObject(value);
            setDate(target, entity);
        } else {
            DateWritable writable = inspector.getPrimitiveWritableObject(value);
            setDate(target, writable.get());
        }
    }
View Full Code Here

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

    @Override
    void write(Object obj) throws IOException {
      super.write(obj);
      if (obj != null) {
        // Using the Writable here as it's used directly for writing as well as for stats.
        DateWritable val = ((DateObjectInspector) inspector).getPrimitiveWritableObject(obj);
        indexStatistics.updateDate(val);
        writer.write(val.getDays());
      }
    }
View Full Code Here

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

    }

    // use nested class to efficiently get a hold of the underlying Date object (w/o doing reparsing, etc...)
    private static abstract class DateWritableWriter {
        static String toES(Object dateWritable) {
            DateWritable dw = (DateWritable) dateWritable;
            Calendar cal = Calendar.getInstance();
            cal.setTimeInMillis(dw.get().getTime());
            return DatatypeConverter.printDate(cal);
        }
View Full Code Here

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

    case DataType.DECIMAL:
      HiveDecimalWritable hdw = new HiveDecimalWritable();
      hdw.readFields(in);
      return hdw.getHiveDecimal();
    case DataType.DATE:
      DateWritable dw = new DateWritable();
      dw.readFields(in);
      return dw.get();
    case DataType.TIMESTAMP:
      TimestampWritable tw = new TimestampWritable();
      tw.readFields(in);
      return tw.getTimestamp();
    default:
View Full Code Here

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

      return;
    case DataType.DECIMAL:
      new HiveDecimalWritable((HiveDecimal)val).write(out);
      return;
    case DataType.DATE:
      new DateWritable((Date)val).write(out);
      return;
    case DataType.TIMESTAMP:
      new TimestampWritable((java.sql.Timestamp)val).write(out);
      return;
    default:
View Full Code Here

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

public class LazyDate extends LazyPrimitive<LazyDateObjectInspector, DateWritable> {
  private static final Log LOG = LogFactory.getLog(LazyDate.class);

  public LazyDate(LazyDateObjectInspector oi) {
    super(oi);
    data = new DateWritable();
  }
View Full Code Here

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

    data = new DateWritable();
  }

  public LazyDate(LazyDate copy) {
    super(copy);
    data = new DateWritable(copy.data);
  }
View Full Code Here

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

  public Date getPrimitiveJavaObject(Object o) {
    return o == null ? null : ((DateWritable) o).get();
  }

  public Object copyObject(Object o) {
    return o == null ? null : new DateWritable((DateWritable) o);
  }
View Full Code Here

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

    ((DateWritable) o).set(d);
    return o;
  }

  public Object create(Date d) {
    return new DateWritable(d);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.