Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchengchenghh committed Aug 23, 2024
1 parent 8b8aa29 commit cd1f114
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -718,17 +718,6 @@ public Decimal getDecimal(int rowId, int precision, int scale) {
return accessor.getDecimal(rowId, precision, scale);
}

@Override
public void putDecimal(int rowId, Decimal value, int precision) {
if (precision <= Decimal.MAX_INT_DIGITS()) {
putInt(rowId, (int) value.toUnscaledLong());
} else if (precision <= Decimal.MAX_LONG_DIGITS()) {
putLong(rowId, value.toUnscaledLong());
} else {
writer.setBytes(rowId, value.toJavaBigDecimal());
}
}

@Override
public UTF8String getUTF8String(int rowId) {
if (isNullAt(rowId)) {
Expand Down Expand Up @@ -1755,6 +1744,14 @@ final void setLong(int rowId, long value) {
final void setBytes(int rowId, BigDecimal value) {
writer.setSafe(rowId, value);
}

final void setBytes(int rowId, int count, byte[] src, int srcIndex) {
if (count == src.length && srcIndex == 0) {
writer.setBigEndianSafe(rowId, src);
} else {
throw new UnsupportedOperationException();
}
}
}

private static class StringWriter extends ArrowVectorWriter {
Expand Down

0 comments on commit cd1f114

Please sign in to comment.