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

Examples of org.apache.hadoop.hbase.hbql.client.HConnection.execute()


        final byte[] author = Bytes.toBytes("author");
        final byte[] title = Bytes.toBytes("title");

        HConnection connection = HConnectionManager.newConnection();

        connection.execute("CREATE TEMP MAPPING testobjects alias testobjects2"
                           + "("
                           + "keyval key, "
                           + "family1 ("
                           + "  author string alias author, "
                           + "  title string  alias title"
View Full Code Here


                     + "    mapval2 object alias f3mapval2 "
                     + "))");

        HConnection conn = ((ConnectionImpl)connection).getHConnection();

        conn.execute("create table table2 (f1(), f2(), f3()) if not tableexists('table2')");
        conn.execute("delete from tab4");
    }


    @Test
View Full Code Here

                     + "))");

        HConnection conn = ((ConnectionImpl)connection).getHConnection();

        conn.execute("create table table2 (f1(), f2(), f3()) if not tableexists('table2')");
        conn.execute("delete from tab4");
    }


    @Test
    public void simpleQuery() throws SQLException {
View Full Code Here

    }

    void doQuery(final String id, final int iteration) throws HBqlException {

        HConnection connection = connectionPool.takeConnection();
        connection.execute("CREATE TEMP MAPPING pool_test "
                           + "("
                           + "keyval key, "
                           + "f1 ("
                           + "  val1 string alias val1, "
                           + "  val2 string alias val2, "
View Full Code Here

        if (connection.tableExists(tableName)) {
            connection.disableTable(tableName);
            connection.dropTable(tableName);
        }
        assertFalse(connection.tableExists(tableName));
        connection.execute("CREATE TABLE " + tableName + " (family1(), family2(), family3())");
        assertTrue(connection.tableExists(tableName));
        HTableDescriptor table = connection.getHTableDescriptor(tableName);
        HColumnDescriptor[] hcd = table.getColumnFamilies();
        assertTrue((hcd.length == 3));
        assertTrue(table.hasFamily("family1".getBytes()));
View Full Code Here

        if (connection.tableExists(tableName)) {
            connection.disableTable(tableName);
            connection.dropTable(tableName);
        }
        assertFalse(connection.tableExists(tableName));
        connection.execute("CREATE TABLE " + tableName
                           + " (family1 ("
                           + "MAX_VERSIONS:  12, "
                           + "BLOOMFILTER_TYPE:  ROW, "
                           + "BLOCK_SIZE: 123, "
                           + "BLOCK_CACHE_ENABLED: TRUE, "
View Full Code Here

        assertTrue(connection.mappingExists("system_mappings"));

        String mappingName = "test1";
        connection.dropMapping(mappingName);
        assertFalse(connection.mappingExists(mappingName));
        connection.execute("CREATE MAPPING " + mappingName + " (keyval key, f1 (val2 object alias val3))");
        assertTrue(connection.mappingExists(mappingName));
        HMapping mapping = connection.getMapping(mappingName);
        assertTrue(mapping.getMappingName().equals(mappingName) && mapping.getTableName().equals(mappingName));
        assertTrue(!mapping.isTempMapping());
        connection.dropMapping(mappingName);
View Full Code Here

        assertFalse(connection.mappingExists(mappingName));

        mappingName = "test2";
        connection.dropMapping(mappingName);
        assertFalse(connection.mappingExists(mappingName));
        connection.execute("CREATE TEMP MAPPING " + mappingName + " (keyval key, f1(val2 object alias val3))");
        assertTrue(connection.mappingExists(mappingName));
        mapping = connection.getMapping(mappingName);
        assertTrue(mapping.getMappingName().equals(mappingName) && mapping.getTableName().equals(mappingName));
        assertTrue(mapping.isTempMapping());
        connection.dropMapping(mappingName);
View Full Code Here

        assertFalse(connection.mappingExists(mappingName));

        mappingName = "test3";
        connection.dropMapping(mappingName);
        assertFalse(connection.mappingExists(mappingName));
        connection.execute("CREATE TEMP MAPPING " + mappingName + " for table unknown_table"
                           + " (keyval key, "
                           + "f1 (val1 int[] , val2 object[] alias val3),"
                           + "f2 include unmapped(val1 int[] , val2 string alias val4 default 'test val'))");
        assertTrue(connection.mappingExists(mappingName));
        mapping = connection.getMapping(mappingName);
View Full Code Here

    public void describeTable() throws HBqlException {

        // START SNIPPET: describe-table

        HConnection conn = HConnectionManager.newConnection();
        System.out.println(conn.execute("DESCRIBE TABLE foo"));

        // END SNIPPET: describe-table

    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.