@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); // If the column is fixed width, fill is up to it's byte size PDataType type = getColumn().getDataType(); if (type.isFixedWidth()) { Integer length = getColumn().getMaxLength(); if (length != null) { // Go through type to pad as the fill character depends on the type. type.pad(ptr, length, SortOrder.ASC); } } byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); KeyRange range = ByteUtil.getKeyRange(key, rhs.getSortOrder().transform(op)/*op*/, type); // Constants will have been inverted, so we invert them back here so that // RVC comparisons work correctly (see PHOENIX-3383). if (rhs.getSortOrder() == SortOrder.DESC) { range = range.invert(); } return range; }
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); // If the column is fixed width, fill is up to it's byte size PDataType type = getColumn().getDataType(); if (type.isFixedWidth()) { Integer length = getColumn().getMaxLength(); if (length != null) { // Go through type to pad as the fill character depends on the type. type.pad(ptr, length, getColumn().getSortOrder()); } } byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); return ByteUtil.getKeyRange(key, op, type); }
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); // If the column is fixed width, fill is up to it's byte size PDataType type = getColumn().getDataType(); if (type.isFixedWidth()) { Integer length = getColumn().getMaxLength(); if (length != null) { // Go through type to pad as the fill character depends on the type. type.pad(ptr, length, SortOrder.ASC); } } byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); KeyRange range = ByteUtil.getKeyRange(key, rhs.getSortOrder().transform(op)/*op*/, type); // Constants will have been inverted, so we invert them back here so that // RVC comparisons work correctly (see PHOENIX-3383). if (rhs.getSortOrder() == SortOrder.DESC) { range = range.invert(); } return range; }