sankarh commented on code in PR #4772:
URL: https://github.com/apache/hive/pull/4772#discussion_r1351439806
##########
ql/src/java/org/apache/hadoop/hive/ql/io/arrow/Serializer.java:
##########
@@ -485,14 +493,23 @@ private void writePrimitive(FieldVector arrowVector,
ColumnVector hiveVector, Ty
break;
case DECIMAL:
{
- final DecimalVector decimalVector = (DecimalVector) arrowVector;
- final int scale = decimalVector.getScale();
- for (int i = 0; i < size; i++) {
- if (hiveVector.isNull[i]) {
- decimalVector.setNull(i);
- } else {
- decimalVector.set(i,
- ((DecimalColumnVector)
hiveVector).vector[i].getHiveDecimal().bigDecimalValue().setScale(scale));
+ try (ArrowBuf arrowBuf =
serDe.rootAllocator.buffer(DecimalHolder.WIDTH)) {
Review Comment:
In the original patch, the try-catch block was limited to smaller code
block. Why is it changed here?
##########
ql/src/java/org/apache/hadoop/hive/ql/io/arrow/Serializer.java:
##########
@@ -485,14 +493,23 @@ private void writePrimitive(FieldVector arrowVector,
ColumnVector hiveVector, Ty
break;
case DECIMAL:
{
- final DecimalVector decimalVector = (DecimalVector) arrowVector;
- final int scale = decimalVector.getScale();
- for (int i = 0; i < size; i++) {
- if (hiveVector.isNull[i]) {
- decimalVector.setNull(i);
- } else {
- decimalVector.set(i,
- ((DecimalColumnVector)
hiveVector).vector[i].getHiveDecimal().bigDecimalValue().setScale(scale));
+ try (ArrowBuf arrowBuf =
serDe.rootAllocator.buffer(DecimalHolder.WIDTH)) {
Review Comment:
In the original patch, the try-catch block was limited to smaller code
block. Why is it changed here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]