Login  Register

Question

Posted by lionel061201 on Jun 20, 2017; 10:36am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/Question-tp15666.html

Hi dev,
Any one knows why the decimal type in compaction flow is processed as below
in CarbonFactDataHandlerColumnar  ?
I can't understand according to the comments.

// convert measure columns
for (int i = 0; i < type.length; i++) {
  Object value = rows[i];

  // in compaction flow the measure with decimal type will come as
spark decimal.
  // need to convert it to byte array.
  if (type[i] == DataType.DECIMAL && compactionFlow) {
    BigDecimal bigDecimal = ((Decimal) rows[i]).toJavaBigDecimal();
    value = DataTypeUtil.bigDecimalToByte(bigDecimal);
  }
  measurePage[i].putData(rowId, value);
}


Thanks!
Lionel