Package org.apache.phoenix.schema

Examples of org.apache.phoenix.schema.TypeMismatchException


    }

    public void addParam(BindParseNode bind, PDatum datum) throws SQLException {
        PDatum bindDatum = params[bind.getIndex()];
        if (bindDatum != null && bindDatum.getDataType() != null && !datum.getDataType().isCoercibleTo(bindDatum.getDataType())) {
            throw new TypeMismatchException(datum.getDataType(), bindDatum.getDataType());
        }
        params[bind.getIndex()] = datum;
    }
View Full Code Here


            }
            return TYPED_NULL_EXPRESSIONS[type.ordinal()];
        }
        PDataType actualType = PDataType.fromLiteral(value);
        if (!actualType.isCoercibleTo(type, value)) {
            throw new TypeMismatchException(type, actualType, value.toString());
        }
        value = type.toObject(value, actualType);
        try {
            byte[] b = type.toBytes(value, columnModifier);
            if (type == PDataType.VARCHAR || type == PDataType.CHAR) {
View Full Code Here

            return null;
        }
        ExpressionCompiler expressionBuilder = new ExpressionCompiler(context, groupBy);
        Expression expression = having.accept(expressionBuilder);
        if (expression.getDataType() != PDataType.BOOLEAN) {
            throw new TypeMismatchException(PDataType.BOOLEAN, expression.getDataType(), expression.toString());
        }
        if (LiteralExpression.FALSE_EXPRESSION == expression) {
            context.setScanRanges(ScanRanges.NOTHING);
            return null;
        } else if (LiteralExpression.TRUE_EXPRESSION == expression) {
View Full Code Here

        Expression expression = where.accept(whereCompiler);
        if (whereCompiler.isAggregate()) {
            throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_WHERE).build().buildException();
        }
        if (expression.getDataType() != PDataType.BOOLEAN) {
            throw new TypeMismatchException(PDataType.BOOLEAN, expression.getDataType(), expression.toString());
        }
        expression = WhereOptimizer.pushKeyExpressionsToScan(context, statement, expression, extractedNodes);
        setScanFilter(context, statement, expression, whereCompiler.disambiguateWithFamily);

        return expression;
View Full Code Here

            return rhs;
        } else if (rhs == null) {
            return LiteralExpression.newConstant(null, lhs.getDataType());
        } else {
            if (rhs.getDataType() != null && lhs.getDataType() != null && !rhs.getDataType().isCastableTo(lhs.getDataType())) {
                throw new TypeMismatchException(lhs.getDataType(), rhs.getDataType());
            }
            return wrapper.wrap(lhs, rhs);
        }
    }
View Full Code Here

                if (literalExpression.getColumnModifier() != column.getColumnModifier()) {
                    byte[] tempByteValue = Arrays.copyOf(byteValue, byteValue.length);
                    byteValue = ColumnModifier.SORT_DESC.apply(byteValue, 0, tempByteValue, 0, byteValue.length);
                }
                if (!literalExpression.getDataType().isCoercibleTo(column.getDataType(), literalExpression.getValue())) {
                    throw new TypeMismatchException(
                        literalExpression.getDataType(), column.getDataType(), "expression: "
                                + literalExpression.toString() + " in column " + column);
                }
                if (!column.getDataType().isSizeCompatible(literalExpression.getDataType(),
                        literalExpression.getValue(), byteValue, literalExpression.getMaxLength(),
View Full Code Here

        return new RowValueConstructorParseNode(l);
    }
   
    private void checkTypeMatch (PDataType expectedType, PDataType actualType) throws SQLException {
        if (!expectedType.isCoercibleTo(actualType)) {
            throw new TypeMismatchException(expectedType, actualType);
        }
    }
View Full Code Here

        }
    }
   
    private static void checkComparability(ParseNode node, PDataType lhsDataType, PDataType rhsDataType) throws TypeMismatchException {
        if(lhsDataType != null && rhsDataType != null && !lhsDataType.isComparableTo(rhsDataType)) {
            throw new TypeMismatchException(lhsDataType, rhsDataType, node.toString());
        }
    }
View Full Code Here

    public Expression visitLeave(AndParseNode node, List<Expression> children) throws SQLException {
        Iterator<Expression> iterator = children.iterator();
        while (iterator.hasNext()) {
            Expression child = iterator.next();
            if (child.getDataType() != PDataType.BOOLEAN) {
                throw new TypeMismatchException(PDataType.BOOLEAN, child.getDataType(), child.toString());
            }
            if (child == LiteralExpression.FALSE_EXPRESSION) {
                return child;
            }
            if (child == LiteralExpression.TRUE_EXPRESSION) {
View Full Code Here

    private Expression orExpression(List<Expression> children) throws SQLException {
        Iterator<Expression> iterator = children.iterator();
        while (iterator.hasNext()) {
            Expression child = iterator.next();
            if (child.getDataType() != PDataType.BOOLEAN) {
                throw new TypeMismatchException(PDataType.BOOLEAN, child.getDataType(), child.toString());
            }
            if (child == LiteralExpression.FALSE_EXPRESSION) {
                iterator.remove();
            }
            if (child == LiteralExpression.TRUE_EXPRESSION) {
View Full Code Here

TOP

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

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.