Skip to content

Commit

Permalink
Fix for unsupported byte data type
Browse files Browse the repository at this point in the history
  • Loading branch information
kunal642 committed Sep 24, 2018
1 parent ed85644 commit 9b854ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Expand Up @@ -145,6 +145,8 @@ Object getMeasureData(ColumnPage dataChunk, int index, CarbonMeasure carbonMeasu
return dataChunk.getLong(index);
} else if (dataType == DataTypes.FLOAT) {
return dataChunk.getFloat(index);
} else if (dataType == DataTypes.BYTE) {
return dataChunk.getByte(index);
} else if (DataTypes.isDecimal(dataType)) {
BigDecimal bigDecimalMsrValue = dataChunk.getDecimal(index);
if (null != bigDecimalMsrValue && carbonMeasure.getScale() > bigDecimalMsrValue.scale()) {
Expand Down
Expand Up @@ -480,6 +480,20 @@ private static int compareMeasureData(byte[] first, byte[] second, DataType data
compare = -1;
}
return (int) compare;
} else if (dataType == DataTypes.FLOAT) {
firstBuffer = ByteBuffer.allocate(8);
firstBuffer.put(first);
secondBuffer = ByteBuffer.allocate(8);
secondBuffer.put(second);
firstBuffer.flip();
secondBuffer.flip();
double compare = firstBuffer.getFloat() - secondBuffer.getFloat();
if (compare > 0) {
compare = 1;
} else if (compare < 0) {
compare = -1;
}
return (int) compare;
} else if (dataType == DataTypes.LONG || dataType == DataTypes.INT
|| dataType == DataTypes.SHORT) {
firstBuffer = ByteBuffer.allocate(8);
Expand Down

0 comments on commit 9b854ad

Please sign in to comment.