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

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


        this.validateTypes();

        final WithArgs withArgs = this.getWithArgs();
        final Set<ColumnAttrib> allWhereAttribs = withArgs.getColumnsUsedInAllWhereExprs();

        HTableWrapper tableWrapper = null;

        try {
            tableWrapper = conn.newHTableWrapper(withArgs, this.getMappingContext().getMapping().getTableName());

            final List<RowRequest> rowRequests = withArgs.getRowRequestList(conn,
                                                                            this.getMappingContext().getMapping(),
                                                                            allWhereAttribs);

            int cnt = 0;

            for (final RowRequest rowRequest : rowRequests)
                cnt += this.delete(tableWrapper, withArgs, rowRequest);

            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;
        }
        finally {
            // release to table pool
            if (tableWrapper != null)
                tableWrapper.releaseHTable();
        }
    }
View Full Code Here


    }

    public void apply() throws HBqlException {
        try {
            for (final String tableName : this.getActionMap().keySet()) {
                HTableWrapper tableref = null;
                try {
                    tableref = this.getHConnectionImpl().newHTableWrapper(null, tableName);
                    for (final BatchAction batchAction : this.getActionList(tableName))
                        batchAction.apply(tableref.getHTable());
                    tableref.getHTable().flushCommits();
                    tableref.getHTable().close();
                }
                finally {
                    // Release to table pool
                    if (tableref != null)
                        tableref.releaseHTable();
                }
            }
        }
        catch (IOException e) {
            throw new HBqlException(e);
View Full Code Here

TOP

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

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.