Package org.apache.phoenix.schema

Examples of org.apache.phoenix.schema.ColumnModifier


            return false;
        }
       
        try {
            boolean isCharType = getStrExpression().getDataType() == PDataType.CHAR;
            ColumnModifier columnModifier = getStrExpression().getColumnModifier();
            int strlen = isCharType ? ptr.getLength() : StringUtil.calculateUTF8Length(ptr.get(), ptr.getOffset(), ptr.getLength(), columnModifier);
           
            // Account for 1 versus 0-based offset
            offset = offset - (offset <= 0 ? 0 : 1);
            if (offset < 0) { // Offset < 0 means get from end
View Full Code Here


    }

    @Override
    public Aggregator newServerAggregator(Configuration conf) {
        final PDataType type = getAggregatorExpression().getDataType();
        ColumnModifier columnModifier = getAggregatorExpression().getColumnModifier();
        return new MinAggregator(columnModifier) {
            @Override
            public PDataType getDataType() {
                return type;
            }
View Full Code Here

    }
   
    @Override
    public Aggregator newServerAggregator(Configuration conf) {
        final PDataType type = getAggregatorExpression().getDataType();
        ColumnModifier columnModifier = getAggregatorExpression().getColumnModifier();
        switch( type ) {
            case DECIMAL:
                return new DecimalSumAggregator(columnModifier);
            case UNSIGNED_DOUBLE:
            case UNSIGNED_FLOAT:
View Full Code Here

        }
        byte[] string = ptr.get();
        int offset = ptr.getOffset();
        int length = ptr.getLength();
       
        ColumnModifier columnModifier = getStringExpression().getColumnModifier();
        int i = StringUtil.getFirstNonBlankCharIdxFromEnd(string, offset, length, columnModifier);
        if (i == offset - 1) {
            ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
            return true;
            }
View Full Code Here

            if (ptr.getLength() == 0) {
                return true;
            }
            BigDecimal value;
            PDataType type = children.get(i).getDataType();
            ColumnModifier columnModifier = children.get(i).getColumnModifier();
            if(type == PDataType.TIMESTAMP) {
                value = (BigDecimal)(PDataType.DECIMAL.toObject(ptr, PDataType.TIMESTAMP, columnModifier));
            } else if (type.isCoercibleTo(PDataType.DECIMAL)) {
                value = (((BigDecimal)PDataType.DECIMAL.toObject(ptr, columnModifier)).multiply(QueryConstants.BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP);
            } else if (type.isCoercibleTo(PDataType.DOUBLE)) {
View Full Code Here

                return true;
            }
           
            PDataType childType = childExpr.getDataType();
            boolean isDate = childType.isCoercibleTo(PDataType.DATE);
            ColumnModifier childColumnModifier = childExpr.getColumnModifier();
            BigDecimal bd = isDate ?
                    BigDecimal.valueOf(childType.getCodec().decodeLong(ptr, childColumnModifier)) :
                    (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType, childColumnModifier);
           
            if (result == null) {
View Full Code Here

            if (ptr.getLength() == 0) {
                return true;
            }
            long value;
            PDataType type = children.get(i).getDataType();
            ColumnModifier columnModifier = children.get(i).getColumnModifier();
            if (type == PDataType.DECIMAL) {
                BigDecimal bd = (BigDecimal)PDataType.DECIMAL.toObject(ptr, columnModifier);
                value = bd.multiply(BD_MILLIS_IN_DAY).longValue();
            } else if (type.isCoercibleTo(PDataType.LONG)) {
                value = type.getCodec().decodeLong(ptr, columnModifier) * QueryConstants.MILLIS_IN_DAY;
 
View Full Code Here

            }
            Expression rhs = node.getChildren().get(1);
            KeySlots childSlots = childParts.get(0);
            KeySlot childSlot = childSlots.iterator().next();
            KeyPart childPart = childSlot.getKeyPart();
            ColumnModifier modifier = childPart.getColumn().getColumnModifier();
            CompareOp op = node.getFilterOp();
            // For descending columns, the operator needs to be transformed to
            // it's opposite, since the range is backwards.
            if (modifier != null) {
                op = modifier.transform(op);
            }
            KeyRange keyRange = childPart.getKeyRange(op, rhs);
            return newKeyParts(childSlot, node, keyRange);
        }
View Full Code Here

            List<Expression> keyExpressions = node.getKeyExpressions();
            List<KeyRange> ranges = Lists.newArrayListWithExpectedSize(keyExpressions.size());
            KeySlot childSlot = childParts.get(0).iterator().next();
            KeyPart childPart = childSlot.getKeyPart();
            ColumnModifier mod = node.getChildren().get(0).getColumnModifier();
            // We can only optimize a row value constructor that is fully qualified
            if (childSlot.getPKSpan() > 1 && !isFullyQualified(childSlot.getPKSpan())) {
                // Just return a key part that has the min/max of the IN list, but doesn't
                // extract the IN list expression.
                return newKeyParts(childSlot, (Expression)null, Collections.singletonList(
View Full Code Here

            if (ptr.getLength() == 0) {
                return true;
            }
           
            PDataType childType = childExpr.getDataType();
            ColumnModifier childColumnModifier = childExpr.getColumnModifier();
            BigDecimal bd= (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType, childColumnModifier);
           
            if (result == null) {
                result = bd;
            } else {
View Full Code Here

TOP

Related Classes of org.apache.phoenix.schema.ColumnModifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.