Examples of coerceBytes()


Examples of com.salesforce.phoenix.schema.PDataType.coerceBytes()

                        coercedKeyExpressions.add(LiteralExpression.newConstant(null, firstChildType, true));
                    }
                } else {
                    // Don't specify the firstChild column modifier here, as we specify it in the LiteralExpression creation below
                    try {
                        firstChildType.coerceBytes(ptr, rhs.getDataType(), rhs.getColumnModifier(), null);
                        keys.add(LiteralExpression.newConstant(ByteUtil.copyKeyBytesIfNecessary(ptr), PDataType.VARBINARY, firstChild.getColumnModifier(), true));
                        if(rhs.getDataType() == firstChildType) {
                            coercedKeyExpressions.add(rhs);
                        } else {
                            coercedKeyExpressions.add(CoerceExpression.create(rhs, firstChildType));   
View Full Code Here

Examples of com.salesforce.phoenix.schema.PDataType.coerceBytes()

        if (containsNull) {
            buf.append("null,");
        }
        for (ImmutableBytesPtr value : values) {
            if (firstChild.getColumnModifier() != null) {
                type.coerceBytes(value, type, firstChild.getColumnModifier(), null);
            }
            buf.append(type.toStringLiteral(value, null));
            buf.append(',');
            if (buf.length() >= maxToStringLen) {
                buf.append("... ");
View Full Code Here

Examples of com.salesforce.phoenix.schema.PDataType.coerceBytes()

                boolean isBytesComparable = dataColumnType.isBytesComparableWith(indexColumnType) ;
                if (isBytesComparable && isDataColumnInverted == descIndexColumnBitSet.get(i)) {
                    output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
                } else {
                    if (!isBytesComparable)  {
                        indexColumnType.coerceBytes(ptr, dataColumnType, dataColumnModifier, null);
                    }
                    if (descIndexColumnBitSet.get(i) != isDataColumnInverted) {
                        writeInverted(ptr.get(), ptr.getOffset(), ptr.getLength(), output);
                    } else {
                        output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
View Full Code Here

Examples of com.salesforce.phoenix.schema.PDataType.coerceBytes()

        ColumnModifier dataModifier = dataColumn.getColumnModifier();
        PDataType indexType = indexColumn.getDataType();
        ColumnModifier indexModifier = indexColumn.getColumnModifier();
        // We know ordinal position will match pk position, because you cannot
        // alter an index table.
        indexType.coerceBytes(ptr, dataType, dataModifier, indexModifier);
    }
   
    public static List<Mutation> generateIndexData(PTable index, PTable table,
            List<Mutation> dataMutations, ImmutableBytesWritable ptr, KeyValueBuilder builder)
            throws SQLException {
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

                boolean isBytesComparable = dataColumnType.isBytesComparableWith(indexColumnType) ;
                if (isBytesComparable && isDataColumnInverted == descIndexColumnBitSet.get(i)) {
                    output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
                } else {
                    if (!isBytesComparable)  {
                        indexColumnType.coerceBytes(ptr, dataColumnType, dataSortOrder, SortOrder.getDefault());
                    }
                    if (descIndexColumnBitSet.get(i) != isDataColumnInverted) {
                        writeInverted(ptr.get(), ptr.getOffset(), ptr.getLength(), output);
                    } else {
                        output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

        Expression firstChild = children.get(0);
        PDataType type = firstChild.getDataType();
        StringBuilder buf = new StringBuilder(firstChild + " IN (");
        for (ImmutableBytesPtr value : values) {
            if (firstChild.getSortOrder() != null) {
                type.coerceBytes(value, type, firstChild.getSortOrder(), SortOrder.getDefault());
            }
            buf.append(type.toStringLiteral(value, null));
            buf.append(',');
            if (buf.length() >= maxToStringLen) {
                buf.append("... ");
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

        SortOrder dataModifier = dataColumn.getSortOrder();
        PDataType indexType = indexColumn.getDataType();
        SortOrder indexModifier = indexColumn.getSortOrder();
        // We know ordinal position will match pk position, because you cannot
        // alter an index table.
        indexType.coerceBytes(ptr, dataType, dataModifier, indexModifier);
    }
   
    public static List<Mutation> generateIndexData(PTable index, PTable table,
            List<Mutation> dataMutations, ImmutableBytesWritable ptr, KeyValueBuilder builder)
            throws SQLException {
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

    public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
        Expression child = children.get(0);
        if (child.evaluate(tuple, ptr)) {
            PDataType childType = child.getDataType();
            tempPtr.set(ptr.get(), ptr.getOffset(), ptr.getLength());
            childType.coerceBytes(tempPtr, childType, child.getColumnModifier(), null);
            Timestamp value = (Timestamp) childType.toObject(tempPtr);
            if (value.getNanos() > 0) {
                value = new Timestamp(value.getTime()+getRoundUpAmount());
                byte[] b = childType.toBytes(value, child.getColumnModifier());
                ptr.set(b);
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

    @Override
    public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
        Expression child =  getChild();
        if (child.evaluate(tuple, ptr)) {
            PDataType childType = child.getDataType();
            childType.coerceBytes(ptr, childType, child.getColumnModifier(), null);
            BigDecimal value = (BigDecimal) childType.toObject(ptr);
            value = value.round(getMathContext());
            byte[] b = childType.toBytes(value, child.getColumnModifier());
            ptr.set(b);
            return true;
View Full Code Here

Examples of org.apache.phoenix.schema.PDataType.coerceBytes()

                        coercedKeyExpressions.add(LiteralExpression.newConstant(null, firstChildType));
                    }
                } else {
                    // Don't specify the firstChild column modifier here, as we specify it in the LiteralExpression creation below
                    try {
                        firstChildType.coerceBytes(ptr, rhs.getDataType(), rhs.getColumnModifier(), null);
                        keys.add(LiteralExpression.newConstant(ByteUtil.copyKeyBytesIfNecessary(ptr), PDataType.VARBINARY, firstChild.getColumnModifier()));
                        if(rhs.getDataType() == firstChildType) {
                            coercedKeyExpressions.add(rhs);
                        } else {
                            coercedKeyExpressions.add(CoerceExpression.create(rhs, firstChildType));   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.