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

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


    }

    protected ResultSet executeQuery(final HBqlStatement stmt) throws SQLException {

        if (!Utils.isSelectStatement(stmt))
            throw new HBqlException("executeQuery() requires a SELECT statement");

        final Query<HRecord> query = Query.newQuery(this.getHConnectionImpl(), (SelectStatement)stmt, HRecord.class);
        final HResultSet<HRecord> hResultSet = query.newResultSet(false);
        final ResultSet resultSet = new ResultSetImpl(this, query, hResultSet);
        this.setResultSet(resultSet);
View Full Code Here


                conn.getHBaseAdmin().majorCompact(this.getTableName());
            else
                conn.getHBaseAdmin().compact(this.getTableName());
        }
        catch (IOException e) {
            throw new HBqlException(e);
        }
        catch (InterruptedException e) {
            throw new HBqlException(e);
        }

        return new ExecutionResults("Table " + this.getTableName() + (isMajor ? " major" : "") + " compacted.");
    }
View Full Code Here

    public NamedParameter getParameter(final int i) throws HBqlException {
        try {
            return this.getParameterList().get(i - 1);
        }
        catch (Exception e) {
            throw new HBqlException("Invalid index: " + (i - 1));
        }
    }
View Full Code Here

    private boolean checkIfAggregateQuery() throws HBqlException {
        final SelectElement firstElement = this.getSelectElementList().get(0);
        final boolean firstIsAggregate = firstElement.isAnAggregateElement();
        for (final SelectElement selectElement : this.getSelectElementList()) {
            if (selectElement.isAnAggregateElement() != firstIsAggregate)
                throw new HBqlException("Cannot mix aggregate and non-aggregate select elements");
        }
        return firstIsAggregate;
    }
View Full Code Here

        final Set<String> asNameSet = Sets.newHashSet();
        for (final SelectElement selectElement : this.getSelectElementList()) {
            if (selectElement.hasAsName()) {
                final String asName = selectElement.getAsName();
                if (asNameSet.contains(asName))
                    throw new HBqlException("Duplicate select name " + asName + " in select list");
                asNameSet.add(asName);
            }
        }
    }
View Full Code Here

        try {
            admin.addColumn(tableName, columnDescriptor);
        }
        catch (IOException e) {
            throw new HBqlException(e);
        }
    }
View Full Code Here

            retval.out.flush();
            return retval;
        }
        catch (IOException e) {
            throw new HBqlException(e);
        }
    }
View Full Code Here

    public ExecutionResults execute() throws HBqlException {

        final String var = this.getVariable();

        if (var == null)
            throw new HBqlException("Error in SET command");

        if (var.equalsIgnoreCase("packagepath")) {
            EnvVars.setPackagePath(this.getValue());
            return new ExecutionResults("PackagePath set to " + this.getValue());
        }

        throw new HBqlException("Unknown variable: " + var);
    }
View Full Code Here

            }
            else {
                final TableMapping mapping = this.getMappingContext().getTableMapping();
                final ColumnAttrib attrib = mapping.getAttribByVariableName(deleteItem);
                if (attrib == null)
                    throw new HBqlException("Invalid variable: " + deleteItem);

                this.getDeleteItemList().add(attrib.getFamilyQualifiedName());
            }
        }
    }
View Full Code Here

            try {
                tableWrapper.getHTable().flushCommits();
                tableWrapper.getHTable().close();
            }
            catch (IOException e) {
                throw new HBqlException(e);
            }

            final ExecutionResults results = new ExecutionResults("Delete count: " + cnt);
            results.setCount(cnt);
            return results;
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.