Package org.apache.hadoop.hbase.hbql.impl

Examples of org.apache.hadoop.hbase.hbql.impl.InvalidTypeException


        else if (TypeSupport.isParentClass(DateValue.class, type0, type1, type2))
            this.setTypedExpr(new DateBetweenStmt(this.getExprArg(0), this.isNot(), this.getExprArg(1), this.getExprArg(2)));
        else if (TypeSupport.isParentClass(ByteValue.class, type0, type1, type2))
            this.setTypedExpr(new ByteBetweenStmt(this.getExprArg(0), this.isNot(), this.getExprArg(1), this.getExprArg(2)));
        else
            throw new InvalidTypeException(this.getInvalidTypeMsg(type0, type1, type2));

        return this.getTypedExpr().validateTypes(parentExpr, false);
    }
View Full Code Here


        else if (TypeSupport.isParentClass(DateValue.class, type))
            this.setTypedExpr(new DateInStmt(this.getExprArg(0), this.isNot(), this.getInList()));
        else if (TypeSupport.isParentClass(BooleanValue.class, type))
            this.setTypedExpr(new BooleanInStmt(this.getExprArg(0), this.isNot(), this.getInList()));
        else
            throw new InvalidTypeException(this.getInvalidTypeMsg(type));

        return this.getTypedExpr().validateTypes(parentExpr, false);
    }
View Full Code Here

        else if (TypeSupport.isParentClass(NumberValue.class, type0, type1))
            this.setTypedExpr(new NumericCalculation(this.getExprArg(0), this.getOperator(), this.getExprArg(1)));
        else if (TypeSupport.isParentClass(DateValue.class, type0, type1))
            this.setTypedExpr(new DateCalculation(this.getExprArg(0), this.getOperator(), this.getExprArg(1)));
        else
            throw new InvalidTypeException(this.getInvalidTypeMsg(type0, type1));

        return this.getTypedExpr().validateTypes(parentExpr, false);
    }
View Full Code Here

    }

    protected Class<? extends GenericValue> validateNumericTypes() throws HBqlException {

        if (this.getGenericValueList().size() != this.getTypeSignature().getArgCount())
            throw new InvalidTypeException("Incorrect number of arguments in " + this.asString());

        // Return the type of the highest ranking numeric arg
        int highestRank = -1;
        for (int i = 0; i < this.getTypeSignature().getArgCount(); i++) {
View Full Code Here

    public Class<? extends GenericValue> validateTypes(final GenericValue parentExpr,
                                                       final boolean allowCollections) throws HBqlException {

        if (this.getGenericValueList().size() != this.getTypeSignature().getArgCount())
            throw new InvalidTypeException("Incorrect number of arguments in " + this.asString());

        final FunctionTypeSignature typeSignature = this.getTypeSignature();

        for (int i = 0; i < typeSignature.getArgCount(); i++)
            this.validateParentClass(typeSignature.getArg(i), this.getExprArg(i).validateTypes(this, false));
View Full Code Here

                first = false;
            }

            sbuf.append(" in expression: " + this.asString());

            throw new InvalidTypeException(sbuf.toString());
        }
    }
View Full Code Here

        for (final Class<? extends GenericValue> type : types)
            if (TypeSupport.isParentClass(type, clazz))
                return type;

        throw new InvalidTypeException(this.getInvalidTypeMsg(clazz));
    }
View Full Code Here

            typedExpr = new ByteNullCompare(this.isNot(), this.getExprArg(0));
        else if (TypeSupport.isParentClass(ObjectValue.class, type))
            typedExpr = new ObjectNullCompare(this.isNot(), this.getExprArg(0));
        else {
            typedExpr = null;
            throw new InvalidTypeException(this.getInvalidTypeMsg(type));
        }

        this.setTypedExpr(typedExpr);

        return this.getTypedExpr().validateTypes(parentExpr, false);
View Full Code Here

    public void validateTypes(final boolean allowColumns, final boolean allowCollections) throws HBqlException {

        if (this.needsTypeValidation()) {

            if (!allowColumns && this.getColumnsUsedInExpr().size() > 0)
                throw new InvalidTypeException("Invalid column reference"
                                               + (this.getColumnsUsedInExpr().size() > 1 ? "s" : "")
                                               + " in " + this.asString());

            // Collect return types of all args
            // This is run even if TypeSignature is null because it calls validateTypes()
            final List<Class<? extends GenericValue>> clazzList = Lists.newArrayList();
            for (final GenericValue val : this.getExpressionList()) {
                final Class<? extends GenericValue> returnType = val.validateTypes(val, allowCollections);
                clazzList.add(returnType);
            }

            // Check against signature if there is one
            if (this.getTypeSignature() != null) {

                if (this.getExpressionList().size() != this.getTypeSignature().getArgCount())
                    throw new InvalidTypeException("Incorrect number of variables in " + this.asString());

                for (int i = 0; i < this.getTypeSignature().getArgCount(); i++) {

                    final Class<? extends GenericValue> parentClazz = this.getTypeSignature().getArg(i);
                    final Class<? extends GenericValue> clazz = clazzList.get(i);

                    // See if they are both NumberValues.  If they are, then check ranks
                    if (TypeSupport.isParentClass(NumberValue.class, parentClazz, clazz)) {
                        final int parentRank = NumericType.getTypeRanking(parentClazz);
                        final int clazzRank = NumericType.getTypeRanking(clazz);
                        if (clazzRank > parentRank)
                            throw new InvalidTypeException("Cannot assign a " + clazz.getSimpleName()
                                                           + " value to a " + parentClazz.getSimpleName()
                                                           + " value in " + this.asString());
                    }
                    else if (parentClazz == ObjectValue.class) {
                        // Do nothing
                    }
                    else {
                        if (!parentClazz.isAssignableFrom(clazz))
                            throw new InvalidTypeException("Expecting type " + parentClazz.getSimpleName()
                                                           + " but found type " + clazz.getSimpleName()
                                                           + " in " + this.asString());
                    }
                }
            }
View Full Code Here

            return;
        else
            this.validated = true;

        if (this.invalidInsertColumn != null)
            throw new InvalidTypeException(this.invalidInsertColumn + " is not a column reference in " + this.asString());

        this.connection = conn;
        this.getMappingContext().validateMappingName(this.getConnection());
        this.record = this.getConnection().getMapping(this.getMappingContext().getMappingName()).newHRecord();

        for (final SelectExpressionContext element : this.getInsertColumnList()) {

            element.validate(this.getMappingContext(), this.getConnection());

            if (!element.isADelegateColumnReference())
                throw new InvalidTypeException(element.asString() + " is not a column reference in " + this.asString());
        }

        if (!this.hasAKeyValue())
            throw new InvalidTypeException("Missing a key value in attribute list in " + this.asString());

        this.getInsertValuesSource().validate();

        this.collectParameters();
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.hbql.impl.InvalidTypeException

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.