congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DecimalUtility.getBigDecimalFromArrowBuf
Code IndexAdd Tabnine to your IDE (free)

How to use
getBigDecimalFromArrowBuf
method
in
org.apache.arrow.vector.util.DecimalUtility

Best Java code snippets using org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf (Showing top 18 results out of 315)

origin: dremio/dremio-oss

 @Override
 public void eval() {
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  out.value = bd.doubleValue();
 }
}
origin: dremio/dremio-oss

public void add() {
 if (in.isSet == 1) {
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  sum.value += bd.doubleValue();
 }
}
public void output() {
origin: dremio/dremio-oss

 public void eval() {
  out.isSet = 1;
  if (in.isSet == 0) {
   out.value = 0;
  } else {
   in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
   java.math.BigDecimal decimal = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
   out.value = decimal.hashCode();
  }
 }
}
origin: dremio/dremio-oss

 public void eval() {
  out.isSet = 1;
  if (in.isSet == 0) {
   out.value = 0;
  } else {
   in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
   java.math.BigDecimal decimal = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
   out.value = decimal.hashCode();
  }
 }
}
origin: dremio/dremio-oss

 public void eval() {
  out.isSet = 1;
  if (in.isSet == 0) {
   out.value = 0;
  } else {
   in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
   java.math.BigDecimal decimal = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
   out.value = decimal.hashCode() ^ seed.value;
  }
 }
}
origin: dremio/dremio-oss

public void add() {
 if (in.isSet != 0) {
  nonNullCount.value = 1;
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  double val = bd.doubleValue();
  if (val < minVal.value) {
   minVal.value = val;
  }
 }
}
public void output() {
origin: dremio/dremio-oss

public void add() {
 if (in.isSet != 0) {
  nonNullCount.value = 1;
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  double val = bd.doubleValue();
  if (val > maxVal.value) {
   maxVal.value = val;
  }
 }
}
public void output() {
origin: dremio/dremio-oss

 public void eval() {
  out.isSet = 1;
  if (in.isSet == 0) {
   out.value = 0;
  } else {
   in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
   java.math.BigDecimal decimal = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
   out.value = decimal.hashCode() ^ ((int) seed.value) ^ (seed.value >> 16);
  }
 }
}
origin: dremio/dremio-oss

public void add() {
 if (in.isSet != 0) {
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  sum.value += bd.doubleValue();
  nonNullCount.value++;
 }
}
public void output() {
origin: dremio/dremio-oss

@Override
public HiveDecimal getPrimitiveJavaObject(Object o){
 final DecimalHolder h = (DecimalHolder) o;
 return HiveDecimal.create(DecimalUtility.getBigDecimalFromArrowBuf(h.buffer, h.start, h.scale));
}
origin: dremio/dremio-oss

@Override
public HiveDecimal getPrimitiveJavaObject(Object o){
 if (o == null) {
  return null;
 }
 final NullableDecimalHolder h = (NullableDecimalHolder) o;
 return HiveDecimal.create(DecimalUtility.getBigDecimalFromArrowBuf(h.buffer, h.start, h.scale));
}
origin: org.apache.arrow/arrow-vector

/**
 * Same as {@link #get(int)}.
 *
 * @param index   position of element
 * @return element at given index
 */
public BigDecimal getObject(int index) {
 if (isSet(index) == 0) {
  return null;
 } else {
  return DecimalUtility.getBigDecimalFromArrowBuf(valueBuffer, index, scale);
 }
}
origin: dremio/dremio-oss

 @Override
 public void eval() {
  in.start = (in.start / (org.apache.arrow.vector.util.DecimalUtility.DECIMAL_BYTE_LENGTH));
  java.math.BigDecimal bd = org.apache.arrow.vector.util.DecimalUtility.getBigDecimalFromArrowBuf(in.buffer, in.start, in.scale);
  String istr = bd.toString();
  out.start = 0;
  out.end = Math.min((int)len.value, istr.length()); // truncate if target type has length smaller than that of input's string
  buffer = buffer.reallocIfNeeded(out.end);
  out.buffer = buffer;
  out.buffer.setBytes(0, istr.substring(0,out.end).getBytes());
 }
}
origin: dremio/dremio-oss

@Override
public HiveDecimalWritable getPrimitiveWritableObject(Object o) {
 if (o == null) {
  return null;
 }
 final NullableDecimalHolder h = (NullableDecimalHolder) o;
 return new HiveDecimalWritable(
   HiveDecimal.create(DecimalUtility.getBigDecimalFromArrowBuf(h.buffer, h.start, h.scale)));
}
origin: dremio/dremio-oss

@Override
public HiveDecimalWritable getPrimitiveWritableObject(Object o) {
 final DecimalHolder h = (DecimalHolder) o;
 return new HiveDecimalWritable(
   HiveDecimal.create(DecimalUtility.getBigDecimalFromArrowBuf(h.buffer, h.start, h.scale)));
}
origin: org.apache.arrow/arrow-vector

BigDecimal decimalValue = DecimalUtility.getBigDecimalFromArrowBuf(buffer, index, scale);
origin: dremio/dremio-oss

private void validate16ByteValues(int blockWidth, VectorPivotDef def, FixedBlockVector block, BigDecimal[] expected){
 int[] expectNulls = new int[expected.length];
 BigDecimal[] expectValues = new BigDecimal[expected.length];
 for(int i = 0; i < expected.length; i++){
  BigDecimal e = expected[i];
  if(e != null){
   expectNulls[i] = 1;
   expectValues[i] = e;
  }
 }
 int[] actualNulls = new int[expectNulls.length];
 BigDecimal[] actualValues = new BigDecimal[expectNulls.length];
 long nullBitOffsetA = def.getNullBitOffset();
 final ArrowBuf buf = block.getUnderlying();
 try(final ArrowBuf valueBuf = allocator.buffer(16)) {
  for (int i = 0; i < expectNulls.length; i++) {
   actualNulls[i] = (buf.getInt(((i * blockWidth) + def.getNullByteOffset())) >>> nullBitOffsetA) & 1;
   if (actualNulls[i] != 0) {
    buf.getBytes((i * blockWidth) + def.getOffset(), valueBuf, 0, 16);
    actualValues[i] = DecimalUtility.getBigDecimalFromArrowBuf(valueBuf, 0, 0);
   }
  }
 }
 assertArrayEquals(expectNulls, actualNulls);
 assertArrayEquals(expectValues, actualValues);
}
origin: dremio/dremio-oss

int length = 0;
for (int i = startPoint; i < startPoint + dataBuffer.readableBytes() - 1; i+=decimalLength) {
 final BigDecimal arrowDecimal = DecimalUtility.getBigDecimalFromArrowBuf(dataBuffer, i/16, decimalField.getMajorType().getScale());
 final int startIndex = (i == startPoint) ? i : i + length;
 DecimalHelper.getSparseFromBigDecimal(arrowDecimal, drillBuffer, startIndex, decimalField.getMajorType().getScale(), NUMBER_DECIMAL_DIGITS);
org.apache.arrow.vector.utilDecimalUtilitygetBigDecimalFromArrowBuf

Javadoc

Read an ArrowType.Decimal at the given value index in the ArrowBuf and convert to a BigDecimal with the given scale.

Popular methods of DecimalUtility

  • writeBigDecimalToArrowBuf
    Write the given BigDecimal to the ArrowBuf at the given value index. Will throw an UnsupportedOperat
  • checkPrecisionAndScale
    Check that the BigDecimal scale equals the vectorScale and that the BigDecimal precision is less tha
  • writeByteArrayToArrowBuf

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now