Search in sources :

Example 1 with DelegateExpression

use of org.apache.phoenix.expression.DelegateExpression in project phoenix by apache.

the class EncodedColumnsUtil method createColumnExpressionArray.

public static Expression[] createColumnExpressionArray(int maxEncodedColumnQualifier) {
    // reserve the first position and offset maxEncodedColumnQualifier by ENCODED_CQ_COUNTER_INITIAL_VALUE (which is the minimum encoded column qualifier)
    int numElements = maxEncodedColumnQualifier - QueryConstants.ENCODED_CQ_COUNTER_INITIAL_VALUE + 2;
    Expression[] colValues = new Expression[numElements];
    Arrays.fill(colValues, new DelegateExpression(LiteralExpression.newConstant(null)) {

        @Override
        public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
            return false;
        }
    });
    // 0 is a reserved position, set it to a non-null value so that we can represent absence of a value using a negative offset
    colValues[0] = LiteralExpression.newConstant(QueryConstants.EMPTY_COLUMN_VALUE_BYTES);
    return colValues;
}
Also used : ImmutableBytesWritable(org.apache.hadoop.hbase.io.ImmutableBytesWritable) LiteralExpression(org.apache.phoenix.expression.LiteralExpression) Expression(org.apache.phoenix.expression.Expression) DelegateExpression(org.apache.phoenix.expression.DelegateExpression) DelegateExpression(org.apache.phoenix.expression.DelegateExpression) Tuple(org.apache.phoenix.schema.tuple.Tuple)

Aggregations

ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)1 DelegateExpression (org.apache.phoenix.expression.DelegateExpression)1 Expression (org.apache.phoenix.expression.Expression)1 LiteralExpression (org.apache.phoenix.expression.LiteralExpression)1 Tuple (org.apache.phoenix.schema.tuple.Tuple)1