Package com.salesforce.phoenix.schema

Examples of com.salesforce.phoenix.schema.ColumnModifier


            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


            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

    }
   
    @Override
    public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
        if (children.get(0).evaluate(tuple, ptr)) {
            ColumnModifier columnModifier = children.get(0).getColumnModifier();
            PDataType dataType = getDataType();
            int nanos = dataType.getNanos(ptr, columnModifier);
            if(nanos >= HALF_OF_NANOS_IN_MILLI) {
                long timeMillis = dataType.getMillis(ptr, columnModifier);
                Timestamp roundedTs = new Timestamp(timeMillis + 1);
View Full Code Here

        }
        byte[] lhsBytes = ptr.get();
        int lhsOffset = ptr.getOffset();
        int lhsLength = ptr.getLength();
        PDataType lhsDataType = children.get(0).getDataType();
        ColumnModifier lhsColumnModifier = children.get(0).getColumnModifier();
       
        if (!children.get(1).evaluate(tuple, ptr)) {
            return false;
        }
       
        byte[] rhsBytes = ptr.get();
        int rhsOffset = ptr.getOffset();
        int rhsLength = ptr.getLength();
        PDataType rhsDataType = children.get(1).getDataType();
        ColumnModifier rhsColumnModifier = children.get(1).getColumnModifier();  
        if (rhsDataType == PDataType.CHAR) {
            rhsLength = StringUtil.getUnpaddedCharLength(rhsBytes, rhsOffset, rhsLength, rhsColumnModifier);
        }
        if (lhsDataType == PDataType.CHAR) {
            lhsLength = StringUtil.getUnpaddedCharLength(lhsBytes, lhsOffset, lhsLength, lhsColumnModifier);
View Full Code Here

    }

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

        }
        byte[] string = ptr.get();
        int offset = ptr.getOffset();
        int length = ptr.getLength();
       
        ColumnModifier columnModifier = getStringExpression().getColumnModifier();
        // TODO: when we have ColumnModifier.REVERSE, we'll need to trim from the end instead of
        // the beginning (just delegate to RTrimFunction or replace from ExpressionCompiler instead?)
        int i = StringUtil.getFirstNonBlankCharIdxFromStart(string, offset, length, columnModifier);
        if (i == offset + length) {
            ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
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

        byte[] source = ptr.get();
        byte[] target = new byte[targetOffset];
        int sourceOffset = ptr.getOffset();
        int endOffset = sourceOffset + ptr.getLength();
        ColumnModifier modifier = arg.getColumnModifier();
        while (sourceOffset < endOffset) {
            int nBytes = StringUtil.getBytesInChar(source[sourceOffset], modifier);
            targetOffset -= nBytes;
            System.arraycopy(source, sourceOffset, target, targetOffset, nBytes);
            sourceOffset += nBytes;
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 || type == PDataType.UNSIGNED_TIMESTAMP) {
                value = (BigDecimal)(PDataType.DECIMAL.toObject(ptr, type, columnModifier));
            } else if (type.isCoercibleTo(PDataType.DECIMAL)) {
                value = (((BigDecimal)PDataType.DECIMAL.toObject(ptr, columnModifier)).multiply(BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP);
            } else if (type.isCoercibleTo(PDataType.DOUBLE)) {
View Full Code Here

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

TOP

Related Classes of com.salesforce.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.