@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (getChild().evaluate(tuple, ptr)) { getDataType().coerceBytes(ptr, null, getChild().getDataType(), getChild().getMaxLength(), null, getChild().getSortOrder(), maxLength, null, getSortOrder(), rowKeyOrderOptimizable); return true; } return false; }
assertEquals(descChild, ((CoerceExpression)child2).getChild());
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { KeyRange range = childPart.getKeyRange(op, rhs); byte[] lower = range.getLowerRange(); if (!range.lowerUnbound()) { ptr.set(lower); // Do the reverse translation so we can optimize out the coerce expression // For the actual type of the coerceBytes call, we use the node type instead of the rhs type, because // for IN, the rhs type will be VARBINARY and no coerce will be done in that case (and we need it to // be done). node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), SortOrder.ASC); lower = ByteUtil.copyKeyBytesIfNecessary(ptr); } byte[] upper = range.getUpperRange(); if (!range.upperUnbound()) { ptr.set(upper); // Do the reverse translation so we can optimize out the coerce expression node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), SortOrder.ASC); upper = ByteUtil.copyKeyBytesIfNecessary(ptr); } range = KeyRange.getKeyRange(lower, range.isLowerInclusive(), upper, range.isUpperInclusive()); return range; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (getChild().evaluate(tuple, ptr)) { getDataType().coerceBytes(ptr, null, getChild().getDataType(), getChild().getMaxLength(), null, getChild().getSortOrder(), maxLength, null, getSortOrder(), rowKeyOrderOptimizable); return true; } return false; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (getChild().evaluate(tuple, ptr)) { getDataType().coerceBytes(ptr, null, getChild().getDataType(), getChild().getMaxLength(), null, getChild().getSortOrder(), maxLength, null, getSortOrder(), rowKeyOrderOptimizable); return true; } return false; }
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { KeyRange range = childPart.getKeyRange(op, rhs); byte[] lower = range.getLowerRange(); if (!range.lowerUnbound()) { ptr.set(lower); // Do the reverse translation so we can optimize out the coerce expression // For the actual type of the coerceBytes call, we use the node type instead of the rhs type, because // for IN, the rhs type will be VARBINARY and no coerce will be done in that case (and we need it to // be done). node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), node.getChild().getSortOrder()); lower = ByteUtil.copyKeyBytesIfNecessary(ptr); } byte[] upper = range.getUpperRange(); if (!range.upperUnbound()) { ptr.set(upper); // Do the reverse translation so we can optimize out the coerce expression node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), node.getChild().getSortOrder()); upper = ByteUtil.copyKeyBytesIfNecessary(ptr); } return KeyRange.getKeyRange(lower, range.isLowerInclusive(), upper, range.isUpperInclusive()); }
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { KeyRange range = childPart.getKeyRange(op, rhs); byte[] lower = range.getLowerRange(); if (!range.lowerUnbound()) { ptr.set(lower); // Do the reverse translation so we can optimize out the coerce expression // For the actual type of the coerceBytes call, we use the node type instead of the rhs type, because // for IN, the rhs type will be VARBINARY and no coerce will be done in that case (and we need it to // be done). node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), SortOrder.ASC); lower = ByteUtil.copyKeyBytesIfNecessary(ptr); } byte[] upper = range.getUpperRange(); if (!range.upperUnbound()) { ptr.set(upper); // Do the reverse translation so we can optimize out the coerce expression node.getChild().getDataType().coerceBytes(ptr, node.getDataType(), rhs.getSortOrder(), SortOrder.ASC); upper = ByteUtil.copyKeyBytesIfNecessary(ptr); } range = KeyRange.getKeyRange(lower, range.isLowerInclusive(), upper, range.isUpperInclusive()); return range; }