@Override public int compare(Object key1, Object key2) { if (key1 instanceof Byte) { return ((Byte) key1).compareTo((Byte) key2); } return ByteUtil.compare((byte[]) key1, (byte[]) key2); } }
/** * apply range filter on a row */ public boolean applyFilter(RowIntf value, int dimOrdinalMax) throws FilterUnsupportedException, IOException { byte[] col = (byte[]) value.getVal(dimColEvaluatorInfo.getDimension().getOrdinal()); byte[][] filterValues = this.filterRangesValues; if (isDimensionPresentInCurrentBlock) { boolean result; if (greaterThanExp) { result = ByteUtil.compare(filterValues[0], col) < 0; } else { result = ByteUtil.compare(filterValues[0], col) <= 0; } if (result) { if (lessThanExp) { return ByteUtil.compare(filterValues[1], col) > 0; } else { return ByteUtil.compare(filterValues[1], col) >= 0; } } } return false; }
/** * This method will evaluate the result for filter column based on the upper range value * * @param dimensionColumnPage * @param filterValue * @param numberOfRows * @return */ private BitSet evaluateLessThanFilterForUnsortedColumn( DimensionColumnPage dimensionColumnPage, byte[] filterValue, int numberOfRows) { BitSet bitSet = new BitSet(numberOfRows); if (lessThanExp) { for (int i = 0; i < numberOfRows; i++) { if ((ByteUtil.compare(dimensionColumnPage.getChunkData(i), filterValue) < 0)) { bitSet.set(i); } } } else if (lessThanEqualExp) { for (int i = 0; i < numberOfRows; i++) { if ((ByteUtil.compare(dimensionColumnPage.getChunkData(i), filterValue) <= 0)) { bitSet.set(i); } } } return bitSet; }
/** * This method will evaluate the result for filter column based on the lower range value * * @param dimensionColumnPage * @param filterValue * @param numberOfRows * @return */ private BitSet evaluateGreaterThanFilterForUnsortedColumn( DimensionColumnPage dimensionColumnPage, byte[] filterValue, int numberOfRows) { BitSet bitSet = new BitSet(numberOfRows); if (greaterThanExp) { for (int i = 0; i < numberOfRows; i++) { if ((ByteUtil.compare(dimensionColumnPage.getChunkData(i), filterValue) > 0)) { bitSet.set(i); } } } else if (greaterThanEqualExp) { for (int i = 0; i < numberOfRows; i++) { if ((ByteUtil.compare(dimensionColumnPage.getChunkData(i), filterValue) >= 0)) { bitSet.set(i); } } } return bitSet; }
@Override public boolean applyFilter(RowIntf value, int dimOrdinalMax) throws FilterUnsupportedException, IOException { if (isDimensionPresentInCurrentBlock[0]) { byte[] col = (byte[]) value.getVal(dimColEvaluatorInfoList.get(0).getDimension().getOrdinal()); return ByteUtil.compare(filterRangeValues[0], col) <= 0; } if (isMeasurePresentInCurrentBlock[0]) { Object col = value.getVal(msrColEvalutorInfoList.get(0).getMeasure().getOrdinal() + dimOrdinalMax); return comparator.compare(msrFilterRangeValues[0], col) <= 0; } return false; }
byte[] otherTaskId = CarbonTablePath.DataFileUtil.getTaskNo(filePath2) .getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)); int compare = ByteUtil.compare(firstTaskId, otherTaskId); if (compare != 0) { return compare;
@Override public boolean applyFilter(RowIntf value, int dimOrdinalMax) throws FilterUnsupportedException, IOException { if (isDimensionPresentInCurrentBlock[0]) { byte[] col = (byte[]) value.getVal(dimColEvaluatorInfoList.get(0).getDimension().getOrdinal()); return ByteUtil.compare(filterRangeValues[0], col) < 0; } if (isMeasurePresentInCurrentBlock[0]) { Object col = value.getVal(msrColEvalutorInfoList.get(0).getMeasure().getOrdinal() + dimOrdinalMax); return comparator.compare(msrFilterRangeValues[0], col) < 0; } return false; }
@Override public boolean applyFilter(RowIntf value, int dimOrdinalMax) throws FilterUnsupportedException, IOException { if (isDimensionPresentInCurrentBlock[0]) { byte[] col = (byte[]) value.getVal(dimColEvaluatorInfoList.get(0).getDimension().getOrdinal()); return ByteUtil.compare(filterRangeValues[0], col) > 0; } if (isMeasurePresentInCurrentBlock[0]) { Object col = value.getVal(msrColEvalutorInfoList.get(0).getMeasure().getOrdinal() + dimOrdinalMax); return comparator.compare(msrFilterRangeValues[0], col) > 0; } return false; }
@Override public boolean applyFilter(RowIntf value, int dimOrdinalMax) throws FilterUnsupportedException, IOException { if (isDimensionPresentInCurrentBlock[0]) { byte[] col = (byte[]) value.getVal(dimColEvaluatorInfoList.get(0).getDimension().getOrdinal()); return ByteUtil.compare(filterRangeValues[0], col) >= 0; } if (isMeasurePresentInCurrentBlock[0]) { Object col = value.getVal(msrColEvalutorInfoList.get(0).getMeasure().getOrdinal() + dimOrdinalMax); return comparator.compare(msrFilterRangeValues[0], col) >= 0; } return false; }
if (ByteUtil.compare(filterValues[i], dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) > 0) {
int compare = ByteUtil.compare(DataFileUtil.getTaskNo(filePath) .getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)), DataFileUtil.getTaskNo(((TableBlockInfo) other).filePath)
if (ByteUtil.compare(filterValues[i], dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) > 0) {
if (ByteUtil.compare(filterValues[i], dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) < 0) {
if (ByteUtil.compare(filterValues[i], dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) < 0) {