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

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


    return reader.loadIndeces(rowIndexEntries, updatedStartIndex);
  }

  @Override
  public Object next(Object previous) throws IOException {
    ByteWritable result = null;
    if (valuePresent) {
      if (previous == null) {
        result = new ByteWritable();
      } else {
        result = (ByteWritable) previous;
      }
      result.set(reader.next());
    }
    return result;
  }
View Full Code Here


    return o == null ? null : new OrcLazyByte((OrcLazyByte) o);
  }

  @Override
  public Object getPrimitiveJavaObject(Object o) {
    ByteWritable writable = getPrimitiveWritableObject(o);
    return writable == null ? null : Byte.valueOf(writable.get());
  }
View Full Code Here

        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

            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

    @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

    }

    // 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

    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

      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

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

    data = new DateWritable();
  }

  public LazyDate(LazyDate copy) {
    super(copy);
    data = new DateWritable(copy.data);
  }
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.