Package org.apache.hadoop.hbase.hbql.client

Examples of org.apache.hadoop.hbase.hbql.client.HBqlException


                                                                final Class<?> clazz) throws HBqlException {

        final Mapping mappingAnnotation = clazz.getAnnotation(Mapping.class);

        if (mappingAnnotation == null)
            throw new HBqlException("Class " + clazz.getName() + " is missing @Mapping annotation");

        if (mappingAnnotation.name() == null || mappingAnnotation.name().length() == 0)
            throw new HBqlException("@Mapping annotation for class " + clazz.getName() + " is missing a name");

        final TableMapping tableMapping = conn.getMapping(mappingAnnotation.name());
        return new AnnotationResultAccessor(tableMapping, clazz);
    }
View Full Code Here


        final Column columnAnno = field.getAnnotation(Column.class);
        final String attribName = columnAnno.name().length() == 0 ? field.getName() : columnAnno.name();
        final HRecordAttrib columnAttrib = (HRecordAttrib)this.getMapping().getAttribByVariableName(attribName);

        if (columnAttrib == null)
            throw new HBqlException("Unknown attribute " + this.getMapping() + "." + attribName
                                    + " in " + this.getClazz().getName());

        if (this.getColumnMap().containsKey(columnAttrib.getFamilyQualifiedName()))
            throw new HBqlException("Cannot map multiple instance variables in " + this.getClazz().getName()
                                    + " to " + columnAttrib.getFamilyQualifiedName());

        final CurrentValueAnnotationAttrib attrib = new CurrentValueAnnotationAttrib(field, columnAttrib);
        this.getColumnMap().put(columnAttrib.getFamilyQualifiedName(), attrib);
    }
View Full Code Here

            this.assignSelectValues(conn, newobj, selectElementList, maxVersions, result);
            return newobj;
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new HBqlException("Error in newObject() " + e.getMessage());
        }
    }
View Full Code Here

        try {
            newobj = this.newInstance();
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new HBqlException("Cannot create new instance of " + this.getClazz().getName());
        }

        return newobj;
    }
View Full Code Here

        try {
            return StoreFile.BloomType.valueOf(this.type.toUpperCase());
        }
        catch (Exception e) {
            throw new HBqlException("Invalid bloom filter type: " + this.type);
        }
    }
View Full Code Here

    protected void applyParameters(final ExpressionTree expressionTree) throws HBqlException {
        for (final String key : this.getParameterMap().keySet()) {
            int cnt = expressionTree.setParameter(key, this.getParameterMap().get(key));
            if (cnt == 0)
                throw new HBqlException("Parameter name " + key + " does not exist in " + this.getQuery());
        }
    }
View Full Code Here

                return val0 + val1;
            case MINUS:
                return val0 - val1;
        }

        throw new HBqlException("Invalid operator:" + this.getOperator());
    }
View Full Code Here

                    break;
                case NEGATIVE:
                    result = val0 * -1;
                    break;
                default:
                    throw new HBqlException("Invalid operator: " + this.getOperator());
            }

            return this.getValueWithCast(result);
        }
        else {

            final double val0 = ((Number)obj0).doubleValue();
            final double val1 = ((Number)obj1).doubleValue();

            final double result;

            switch (this.getOperator()) {
                case PLUS:
                    result = val0 + val1;
                    break;
                case MINUS:
                    result = val0 - val1;
                    break;
                case MULT:
                    result = val0 * val1;
                    break;
                case DIV:
                    result = val0 / val1;
                    break;
                case MOD:
                    result = val0 % val1;
                    break;
                case NEGATIVE:
                    result = val0 * -1;
                    break;
                default:
                    throw new HBqlException("Invalid operator: " + this.getOperator());
            }

            return this.getValueWithCast(result);
        }
    }
View Full Code Here

        switch (this.getOperator()) {
            case PLUS:
                return val0 + val1;
            default:
                throw new HBqlException("Invalid operator: " + this.getOperator());
        }
    }
View Full Code Here

    }

    public int executeUpdate(final HBqlStatement statement) throws SQLException {

        if (Utils.isSelectStatement(statement)) {
            throw new HBqlException("executeUpdate() requires a non-SELECT statement");
        }
        else if (Utils.isDMLStatement(statement)) {
            final ConnectionStatement stmt = ((ConnectionStatement)statement);
            final ExecutionResults results = stmt.evaluatePredicateAndExecute(this.getHConnectionImpl());
            return results.getCount();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.hbql.client.HBqlException

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.