org.apache.hadoop.hive.metastore.api.Date类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.apache.hadoop.hive.metastore.api.Date类的一些代码示例,展示了Date类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Date类的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Date
类名称:Date

Date介绍

暂无

代码示例

代码示例来源:origin: apache/hive

public Date deepCopy() {
 return new Date(this);
}

代码示例来源:origin: apache/hive

private long diff(Date d1, Date d2) {
 return d1.getDaysSinceEpoch() - d2.getDaysSinceEpoch();
}

代码示例来源:origin: apache/hive

@Override
public boolean equals(Object that) {
 if (that == null)
  return false;
 if (that instanceof Date)
  return this.equals((Date)that);
 return false;
}

代码示例来源:origin: apache/hive

private Date getHighVal() {
  long max = Long.MIN_VALUE;
  for (Date d : highVals) max = Math.max(max, d.getDaysSinceEpoch());
  return new Date(max);
 }
}

代码示例来源:origin: apache/hive

public void read(org.apache.thrift.protocol.TProtocol iprot, Date struct) throws org.apache.thrift.TException {
 org.apache.thrift.protocol.TField schemeField;
 iprot.readStructBegin();
 while (true)
 {
  schemeField = iprot.readFieldBegin();
  if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
   break;
  }
  switch (schemeField.id) {
   case 1: // DAYS_SINCE_EPOCH
    if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
     struct.daysSinceEpoch = iprot.readI64();
     struct.setDaysSinceEpochIsSet(true);
    } else { 
     org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
    }
    break;
   default:
    org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  }
  iprot.readFieldEnd();
 }
 iprot.readStructEnd();
 struct.validate();
}

代码示例来源:origin: apache/hive

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, DateColumnStatsData struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.numNulls = iprot.readI64();
  struct.setNumNullsIsSet(true);
  struct.numDVs = iprot.readI64();
  struct.setNumDVsIsSet(true);
  BitSet incoming = iprot.readBitSet(3);
  if (incoming.get(0)) {
   struct.lowValue = new Date();
   struct.lowValue.read(iprot);
   struct.setLowValueIsSet(true);
  }
  if (incoming.get(1)) {
   struct.highValue = new Date();
   struct.highValue.read(iprot);
   struct.setHighValueIsSet(true);
  }
  if (incoming.get(2)) {
   struct.bitVectors = iprot.readBinary();
   struct.setBitVectorsIsSet(true);
  }
 }
}

代码示例来源:origin: apache/hive

private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
 try {
  write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
 } catch (org.apache.thrift.TException te) {
  throw new java.io.IOException(te);
 }
}

代码示例来源:origin: apache/hive

public void write(org.apache.thrift.protocol.TProtocol oprot, Date struct) throws org.apache.thrift.TException {
 struct.validate();
 oprot.writeStructBegin(STRUCT_DESC);
 oprot.writeFieldBegin(DAYS_SINCE_EPOCH_FIELD_DESC);
 oprot.writeI64(struct.daysSinceEpoch);
 oprot.writeFieldEnd();
 oprot.writeFieldStop();
 oprot.writeStructEnd();
}

代码示例来源:origin: apache/hive

private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
 try {
  // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
  __isset_bitfield = 0;
  read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
 } catch (org.apache.thrift.TException te) {
  throw new java.io.IOException(te);
 }
}

代码示例来源:origin: apache/hive

case 1: // LOW_VALUE
 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  struct.lowValue = new Date();
  struct.lowValue.read(iprot);
  struct.setLowValueIsSet(true);
 } else { 
case 2: // HIGH_VALUE
 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  struct.highValue = new Date();
  struct.highValue.read(iprot);
  struct.setHighValueIsSet(true);
 } else {

代码示例来源:origin: apache/hive

private Date getLowVal() {
 long min = Long.MAX_VALUE;
 for (Date d : lowVals) min = Math.min(min, d.getDaysSinceEpoch());
 return new Date(min);
}

代码示例来源:origin: apache/hive

if (struct.isSetLowValue()) {
 oprot.writeFieldBegin(LOW_VALUE_FIELD_DESC);
 struct.lowValue.write(oprot);
 oprot.writeFieldEnd();
if (struct.isSetHighValue()) {
 oprot.writeFieldBegin(HIGH_VALUE_FIELD_DESC);
 struct.highValue.write(oprot);
 oprot.writeFieldEnd();

代码示例来源:origin: com.facebook.presto.hive/hive-apache

public void read(org.apache.thrift.protocol.TProtocol iprot, Date struct) throws org.apache.thrift.TException {
 org.apache.thrift.protocol.TField schemeField;
 iprot.readStructBegin();
 while (true)
 {
  schemeField = iprot.readFieldBegin();
  if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
   break;
  }
  switch (schemeField.id) {
   case 1: // DAYS_SINCE_EPOCH
    if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
     struct.daysSinceEpoch = iprot.readI64();
     struct.setDaysSinceEpochIsSet(true);
    } else { 
     org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
    }
    break;
   default:
    org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
  }
  iprot.readFieldEnd();
 }
 iprot.readStructEnd();
 struct.validate();
}

代码示例来源:origin: apache/hive

public void validate() throws org.apache.thrift.TException {
 // check for required fields
 if (!isSetNumNulls()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'numNulls' is unset! Struct:" + toString());
 }
 if (!isSetNumDVs()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'numDVs' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
 if (lowValue != null) {
  lowValue.validate();
 }
 if (highValue != null) {
  highValue.validate();
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
 try {
  // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
  __isset_bitfield = 0;
  read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
 } catch (org.apache.thrift.TException te) {
  throw new java.io.IOException(te);
 }
}

代码示例来源:origin: prestodb/presto

public static Date toMetastoreDate(LocalDate date)
{
  return new Date(date.toEpochDay());
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, DateColumnStatsData struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.numNulls = iprot.readI64();
  struct.setNumNullsIsSet(true);
  struct.numDVs = iprot.readI64();
  struct.setNumDVsIsSet(true);
  BitSet incoming = iprot.readBitSet(2);
  if (incoming.get(0)) {
   struct.lowValue = new Date();
   struct.lowValue.read(iprot);
   struct.setLowValueIsSet(true);
  }
  if (incoming.get(1)) {
   struct.highValue = new Date();
   struct.highValue.read(iprot);
   struct.setHighValueIsSet(true);
  }
 }
}

代码示例来源:origin: apache/hive

public Object getFieldValue(_Fields field) {
 switch (field) {
 case DAYS_SINCE_EPOCH:
  return getDaysSinceEpoch();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: apache/hive

double maxInd = adjustedIndexMap.get(list.get(list.size() - 1).getKey());
long lowValue = 0;
long min = list.get(0).getValue().getLowValue().getDaysSinceEpoch();
long max = list.get(list.size() - 1).getValue().getLowValue().getDaysSinceEpoch();
if (minInd == maxInd) {
 lowValue = min;
maxInd = adjustedIndexMap.get(list.get(list.size() - 1).getKey());
long highValue = 0;
min = list.get(0).getValue().getHighValue().getDaysSinceEpoch();
max = list.get(list.size() - 1).getValue().getHighValue().getDaysSinceEpoch();
if (minInd == maxInd) {
 highValue = min;
extrapolateDateData.setLowValue(new Date(lowValue));
extrapolateDateData.setHighValue(new Date(highValue));
extrapolateDateData.setNumNulls(numNulls);
extrapolateDateData.setNumDVs(ndv);

代码示例来源:origin: apache/hive

@Override
public void write(org.apache.thrift.protocol.TProtocol prot, DateColumnStatsData struct) throws org.apache.thrift.TException {
 TTupleProtocol oprot = (TTupleProtocol) prot;
 oprot.writeI64(struct.numNulls);
 oprot.writeI64(struct.numDVs);
 BitSet optionals = new BitSet();
 if (struct.isSetLowValue()) {
  optionals.set(0);
 }
 if (struct.isSetHighValue()) {
  optionals.set(1);
 }
 if (struct.isSetBitVectors()) {
  optionals.set(2);
 }
 oprot.writeBitSet(optionals, 3);
 if (struct.isSetLowValue()) {
  struct.lowValue.write(oprot);
 }
 if (struct.isSetHighValue()) {
  struct.highValue.write(oprot);
 }
 if (struct.isSetBitVectors()) {
  oprot.writeBinary(struct.bitVectors);
 }
}

相关文章