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

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


                          "select keyval, val1+val1, val2+1 FROM tab3 ";
        showValues();

        HPreparedStatement stmt = connection.prepareStatement(q1);

        ExecutionResults executionResults = stmt.execute();

        System.out.println(executionResults);

        showValues();
View Full Code Here


                          "select keyval, val1+val1, val2+1 FROM tab3 ";
        showValues();

        HPreparedStatement stmt = connection.prepareStatement(q1);

        ExecutionResults executionResults = stmt.execute();

        System.out.println(executionResults);

        showValues();
View Full Code Here

    }

    @Test
    public void testPredicate() throws HBqlException {

        ExecutionResults results;

        results = connection.execute("DROP TABLE nosuchtable IF tableexists('nosuchtable')");
        assertTrue(!results.getPredicate());

        results = connection.execute("CREATE TABLE nosuchtable (f1()) IF tableexists('nosuchtable')");
        assertTrue(!results.getPredicate());

        results = connection.execute("CREATE TEMP MAPPING nosuchmapping IF tableexists('nosuchtable')");
        assertTrue(!results.getPredicate());

        results = connection.execute("ALTER TABLE nosuchtable DROP FAMILY foo IF tableexists('nosuchtable')");
        assertTrue(!results.getPredicate());

        results = connection.execute("DISABLE TABLE testtable IF tableexists('testtable')");
        results = connection.execute("DROP TABLE testtable IF tableexists('testtable')");

        results = connection.execute("CREATE TABLE testtable (f1()) IF NOT tableexists('testtable')");

        results = connection.execute("ALTER TABLE testtable ADD FAMILY f1() IF not familyexistsfortable('f1', 'testtable')");
        assertTrue(!results.getPredicate());

        results = connection.execute("DISABLE TABLE testtable");

        results = connection.execute("ALTER TABLE testtable ADD FAMILY f2() IF not familyexistsfortable('f2', 'testtable')");
        assertTrue(results.getPredicate());

        results = connection.execute("ALTER TABLE testtable ALTER FAMILY f1 TO f3() IF not familyexistsfortable('f3', 'testtable')");
        assertTrue(results.getPredicate());

        results = connection.execute("DISABLE TABLE nosuchtable IF tableexists('nosuchtable') AND tableenabled('nosuchtable')");
        assertFalse(results.getPredicate());

        results = connection.execute("ENABLE TABLE testtable");
    }
View Full Code Here

        }

        if (option.equals("-version")) {
            processCommandLine = false;
            final VersionStatement version = new VersionStatement();
            final ExecutionResults results = version.execute();
            System.out.print(results);
            return true;
        }

        if (option.startsWith("-" + HConnectionImpl.MASTER)) {
            final String[] vals = option.split("=");
            if (vals.length != 2) {
                processCommandLine = false;
                System.out.println("Incorrect syntax: " + option);
                usage();
                return false;
            }
            else {
                config = HConnectionImpl.getConfiguration(vals[1]);
                return true;
            }
        }

        if (option.startsWith("-")) {
            processCommandLine = false;
            System.out.println("Unknown option: " + option);
            usage();
            return false;
        }
        else {
            // Assume that an arg without "-" prefix is a filename
            processCommandLine = false;
            final ImportStatement importStmt = new ImportStatement(option);
            final ExecutionResults results = importStmt.evaluatePredicateAndExecute(getConnection());
            System.out.print(results);
            return results.hadSuccess();
        }
    }
View Full Code Here

        }
        else {
            QueryExecutorPoolManager.dropQueryExecutorPool(this.getPoolName());
            msg = "Query Executor pool " + this.getPoolName() + " dropped.";
        }
        return new ExecutionResults(msg);
    }
View Full Code Here

    static ExecutionResults executeDescribe(final HConnectionImpl conn,
                                            final String indexName,
                                            final String tableName) throws HBqlException {

        final ExecutionResults retval = new ExecutionResults();

        if (!conn.tableExists(tableName)) {
            retval.out.println("Table not found: " + tableName);
        }
        else {
View Full Code Here

    }

    protected ExecutionResults execute(final HConnectionImpl conn) throws HBqlException {
        conn.dropIndexForMapping(this.getIndexName(), this.getMappingContext().getMappingName());
        final TableMapping mapping = conn.getMapping(this.getMappingContext().getMappingName());
        return new ExecutionResults("Index " + this.getIndexName() + " dropped for table " + mapping.getTableName());
    }
View Full Code Here

        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();
        }
        else if (Utils.isConnectionStatemet(statement)) {
            final ConnectionStatement stmt = ((ConnectionStatement)statement);
            stmt.evaluatePredicateAndExecute(this.getHConnectionImpl());
            return 0;
View Full Code Here

        for (final FamilyDefinition familyDefintion : this.familyList)
            tableDesc.addFamily(familyDefintion.getColumnDescription());

        conn.createTable(tableDesc);

        return new ExecutionResults("Table " + tableDesc.getNameAsString() + " created.");
    }
View Full Code Here

        super(null);
    }

    protected ExecutionResults execute(final HConnectionImpl conn) throws HBqlException {

        final ExecutionResults retval = new ExecutionResults();
        retval.out.println("Async Executors: ");
        for (final String name : AsyncExecutorManager.getAsyncExecutorNames()) {
            final AsyncExecutor asyncExecutor = AsyncExecutorManager.getAsyncExecutor(name);
            retval.out.println("\t" + asyncExecutor.getName() + "("
                               + "MIN_THREAD_COUNT: " + asyncExecutor.getMinThreadCount()
View Full Code Here

TOP

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

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.