private static byte[] evaluateExpression(Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); return key; }
public PRowImpl(KeyValueBuilder kvBuilder, ImmutableBytesWritable key, long ts, Integer bucketNum) { this.kvBuilder = kvBuilder; this.ts = ts; if (bucketNum != null) { this.key = SaltingUtil.getSaltedKey(key, bucketNum); this.keyPtr = new ImmutableBytesPtr(this.key); } else { this.keyPtr = new ImmutableBytesPtr(key); this.key = ByteUtil.copyKeyBytesIfNecessary(key); } newMutations(); }
@Override public Expression visitLeave(ComparisonParseNode node, List<Expression> children) throws SQLException { Expression literal = children.get(1); ImmutableBytesWritable ptr = context.getTempPtr(); literal.evaluate(null, ptr); PColumn column = columnRef.getColumn(); column.getDataType().coerceBytes(ptr, literal.getDataType(), literal.getColumnModifier(), column.getColumnModifier()); viewColumns.put(columnRef, ByteUtil.copyKeyBytesIfNecessary(ptr)); return super.visitLeave(node, children); } }
keys.add(LiteralExpression.newConstant(ByteUtil.copyKeyBytesIfNecessary(ptr), PDataType.VARBINARY, firstChild.getColumnModifier(), true)); if(rhs.getDataType() == firstChildType) { coercedKeyExpressions.add(rhs);
ByteUtil.copyKeyBytesIfNecessary(node.getMinKey()), true, ByteUtil.copyKeyBytesIfNecessary(node.getMaxKey()), true)), null);
return null; byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); return ByteUtil.getKeyRange(key, op, PDataType.VARBINARY);
attribValue = ByteUtil.copyKeyBytesIfNecessary(tempPtr); uuidValue = ServerCacheClient.generateId();
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); byte[] key = ByteUtil.copyKeyBytesIfNecessary(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().getByteSize(); if (length != null) { key = ByteUtil.fillKey(key, length); } } return ByteUtil.getKeyRange(key, op, type); }
constantExpression.evaluate(null, ptr); Object value = null; byte[] byteValue = ByteUtil.copyKeyBytesIfNecessary(ptr); if (constantExpression.getDataType() != null) {
@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.getColumnModifier(), node.getChild().getColumnModifier()); 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.getColumnModifier(), node.getChild().getColumnModifier()); upper = ByteUtil.copyKeyBytesIfNecessary(ptr); } return KeyRange.getKeyRange(lower, range.isLowerInclusive(), upper, range.isUpperInclusive()); }
@Override public KeyRange getKeyRange(CompareOp op, Expression rhs) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr); PDataType type = getColumn().getDataType(); KeyRange range; switch (op) { case EQUAL: range = type.getKeyRange(key, true, ByteUtil.nextKey(ByteUtil.concat(key, new byte[] {StringUtil.SPACE_UTF8})), false); break; case LESS_OR_EQUAL: range = type.getKeyRange(KeyRange.UNBOUND, false, ByteUtil.nextKey(ByteUtil.concat(key, new byte[] {StringUtil.SPACE_UTF8})), false); break; default: range = childPart.getKeyRange(op, rhs); break; } Integer length = getColumn().getByteSize(); return length == null ? range : range.fill(length); }
ImmutableBytesWritable ptr = new ImmutableBytesWritable(); rhs.evaluate(null, ptr); byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr);
Expression expression = node.accept(expressionCompiler); if (expression.evaluate(null, ptr)) {; splits[i] = ByteUtil.copyKeyBytesIfNecessary(ptr); continue;