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

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

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

Decimal介绍

暂无

代码示例

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

public static Decimal getDecimal(ByteBuffer unscaled, short scale) {
 return new Decimal((short) scale, unscaled);
}

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

public Object getFieldValue(_Fields field) {
 switch (field) {
 case SCALE:
  return getScale();
 case UNSCALED:
  return getUnscaled();
 }
 throw new IllegalStateException();
}

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

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

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

/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
 if (field == null) {
  throw new IllegalArgumentException();
 }
 switch (field) {
 case SCALE:
  return isSetScale();
 case UNSCALED:
  return isSetUnscaled();
 }
 throw new IllegalStateException();
}

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

public void validate() throws org.apache.thrift.TException {
 // check for required fields
 if (!isSetScale()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'scale' is unset! Struct:" + toString());
 }
 if (!isSetUnscaled()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'unscaled' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
}

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

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, DecimalColumnStatsData 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 Decimal();
   struct.lowValue.read(iprot);
   struct.setLowValueIsSet(true);
  }
  if (incoming.get(1)) {
   struct.highValue = new Decimal();
   struct.highValue.read(iprot);
   struct.setHighValueIsSet(true);
  }
  if (incoming.get(2)) {
   struct.bitVectors = iprot.readBinary();
   struct.setBitVectorsIsSet(true);
  }
 }
}

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

public boolean equals(Decimal that) {
 if (that == null)
  return false;
 boolean this_present_scale = true;
 boolean that_present_scale = true;
 if (this_present_scale || that_present_scale) {
  if (!(this_present_scale && that_present_scale))
   return false;
  if (this.scale != that.scale)
   return false;
 }
 boolean this_present_unscaled = true && this.isSetUnscaled();
 boolean that_present_unscaled = true && that.isSetUnscaled();
 if (this_present_unscaled || that_present_unscaled) {
  if (!(this_present_unscaled && that_present_unscaled))
   return false;
  if (!this.unscaled.equals(that.unscaled))
   return false;
 }
 return true;
}

代码示例来源: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 Decimal();
  struct.lowValue.read(iprot);
  struct.setLowValueIsSet(true);
 } else { 
case 2: // HIGH_VALUE
 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
  struct.highValue = new Decimal();
  struct.highValue.read(iprot);
  struct.setHighValueIsSet(true);
 } else {

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

public void validate() throws org.apache.thrift.TException {
 // check for required fields
 if (!isSetUnscaled()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'unscaled' is unset! Struct:" + toString());
 }
 if (!isSetScale()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'scale' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
}

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

@Override
public int compareTo(Decimal other) {
 if (!getClass().equals(other.getClass())) {
  return getClass().getName().compareTo(other.getClass().getName());
 }
 int lastComparison = 0;
 lastComparison = Boolean.valueOf(isSetScale()).compareTo(other.isSetScale());
 if (lastComparison != 0) {
  return lastComparison;
 }
 if (isSetScale()) {
  lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.scale, other.scale);
  if (lastComparison != 0) {
   return lastComparison;
  }
 }
 lastComparison = Boolean.valueOf(isSetUnscaled()).compareTo(other.isSetUnscaled());
 if (lastComparison != 0) {
  return lastComparison;
 }
 if (isSetUnscaled()) {
  lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unscaled, other.unscaled);
  if (lastComparison != 0) {
   return lastComparison;
  }
 }
 return 0;
}

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

@Override
public int hashCode() {
 List<Object> list = new ArrayList<Object>();
 boolean present_scale = true;
 list.add(present_scale);
 if (present_scale)
  list.add(scale);
 boolean present_unscaled = true && (isSetUnscaled());
 list.add(present_unscaled);
 if (present_unscaled)
  list.add(unscaled);
 return list.hashCode();
}

代码示例来源: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 Optional<BigDecimal> fromMetastoreDecimal(@Nullable Decimal decimal)
{
  if (decimal == null) {
    return Optional.empty();
  }
  return Optional.of(new BigDecimal(new BigInteger(decimal.getUnscaled()), decimal.getScale()));
}

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

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

代码示例来源:origin: org.spark-project.hive/hive-metastore

@Override
 public void read(org.apache.thrift.protocol.TProtocol prot, DecimalColumnStatsData 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 Decimal();
   struct.lowValue.read(iprot);
   struct.setLowValueIsSet(true);
  }
  if (incoming.get(1)) {
   struct.highValue = new Decimal();
   struct.highValue.read(iprot);
   struct.setHighValueIsSet(true);
  }
 }
}

代码示例来源:origin: org.spark-project.hive/hive-metastore

public void validate() throws org.apache.thrift.TException {
 // check for required fields
 if (!isSetUnscaled()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'unscaled' is unset! Struct:" + toString());
 }
 if (!isSetScale()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'scale' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
}

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

/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
 if (field == null) {
  throw new IllegalArgumentException();
 }
 switch (field) {
 case UNSCALED:
  return isSetUnscaled();
 case SCALE:
  return isSetScale();
 }
 throw new IllegalStateException();
}

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

if (!(this_present_lowValue && that_present_lowValue))
 return false;
if (!this.lowValue.equals(that.lowValue))
 return false;
if (!(this_present_highValue && that_present_highValue))
 return false;
if (!this.highValue.equals(that.highValue))
 return false;

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

/**
 * Performs a deep copy on <i>other</i>.
 */
public Decimal(Decimal other) {
 __isset_bitfield = other.__isset_bitfield;
 this.scale = other.scale;
 if (other.isSetUnscaled()) {
  this.unscaled = org.apache.thrift.TBaseHelper.copyBinary(other.unscaled);
 }
}

相关文章