Package com.salesforce.phoenix.schema

Examples of com.salesforce.phoenix.schema.ColumnModifier


            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


        }
        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

            }
            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

    }

    @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

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

        boolean isNullable = PDataType.INTEGER.getCodec().decodeInt(nullableKv.getBuffer(), nullableKv.getValueOffset(), null) != ResultSetMetaData.columnNoNulls;
        KeyValue sqlDataTypeKv = colKeyValues[SQL_DATA_TYPE_INDEX];
        PDataType dataType = PDataType.fromTypeId(PDataType.INTEGER.getCodec().decodeInt(sqlDataTypeKv.getBuffer(), sqlDataTypeKv.getValueOffset(), null));
        if (maxLength == null && dataType == PDataType.BINARY) dataType = PDataType.VARBINARY; // For backward compatibility.
        KeyValue columnModifierKv = colKeyValues[COLUMN_MODIFIER_INDEX];
        ColumnModifier sortOrder = columnModifierKv == null ? null : ColumnModifier.fromSystemValue(PDataType.INTEGER.getCodec().decodeInt(columnModifierKv.getBuffer(), columnModifierKv.getValueOffset(), null));
        PColumn column = new PColumnImpl(colName, famName, dataType, maxLength, scale, isNullable, position-1, sortOrder);
        columns.add(column);
    }
View Full Code Here

            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 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 > 0) {
                long millis = dataType.getMillis(ptr, columnModifier);
                Timestamp roundedTs = new Timestamp(millis + 1);
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(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

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.