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

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


        // START SNIPPET: drop-async-executor

        HConnection conn = HConnectionManager.newConnection();

        conn.execute("DROP ASYNC EXECUTOR asyncExec IF asyncExecutorExists('asyncExec')");

        // Or, using the API
        if (AsyncExecutorManager.asyncExecutorExists("asyncExec"))
            AsyncExecutorManager.dropAsyncExecutor("asyncExec");
View Full Code Here


        // START SNIPPET: index1

        HConnection conn = HConnectionManager.newConnection();

        conn.execute("CREATE TEMP MAPPING tab1 FOR TABLE table1"
                     + "("
                     + "keyval KEY WIDTH 15, "
                     + "f1 INCLUDE UNMAPPED ("
                     + "  val1 STRING WIDTH 10 ALIAS val1, "
                     + "  val2 INT ALIAS val5"
View Full Code Here

                     + "f3 INCLUDE UNMAPPED ("
                     + "  val2 INT ALIAS val6, "
                     + "  val3 INT ALIAS val7 "
                     + "))");

        conn.execute("CREATE INDEX val1idx ON tab1 (val1) INCLUDE (val5, val6) IF NOT indexExistsForTable('val1idx', 'tab1')");

        HPreparedStatement pstmt = conn.prepareStatement("SELECT keyval, f1:val1, val5 FROM tab1 "
                                                         + "WITH INDEX val1idx KEYS FIRST TO :endkey "
                                                         + "INDEX FILTER WHERE val5 < 8 "
                                                         + "CLIENT FILTER WHERE val6 > 4");
View Full Code Here

        // START SNIPPET: select1

        HConnection conn = HConnectionManager.newConnection();

        conn.execute("CREATE TEMP MAPPING tab1 FOR TABLE table1"
                     + "("
                     + "keyval KEY, "
                     + "f1 INCLUDE UNMAPPED ("
                     + "  val1 STRING ALIAS val1, "
                     + "  val2 INT ALIAS val5"
View Full Code Here

        // Get a connection to HBase
        HConnection conn = HConnectionManager.newConnection();

        // CREATE TEMP MAPPING
        conn.execute("CREATE TEMP MAPPING demo1 FOR TABLE example1"
                     + "("
                     + "keyval KEY, "
                     + "f1 ("
                     + "  val1 STRING ALIAS val1, "
                     + "  val2 INT ALIAS val2, "
View Full Code Here

                     + "  val3 STRING DEFAULT 'This is a default value' "
                     + "))");

        // Clean up table
        if (!conn.tableExists("example1"))
            conn.execute("CREATE TABLE example1 (f1()) ");
        else
            conn.execute("DELETE FROM demo1");

        // Add some records using an INSERT stmt
        HPreparedStatement stmt = conn.prepareStatement("INSERT INTO demo1 " +
View Full Code Here

        // Clean up table
        if (!conn.tableExists("example1"))
            conn.execute("CREATE TABLE example1 (f1()) ");
        else
            conn.execute("DELETE FROM demo1");

        // Add some records using an INSERT stmt
        HPreparedStatement stmt = conn.prepareStatement("INSERT INTO demo1 " +
                                                        "(keyval, val1, val2, f1:val3) VALUES " +
                                                        "(ZEROPAD(:key, 10), :val1, :val2, DEFAULT)");
View Full Code Here

        // START SNIPPET: annotatedExample2

        // Get a connection to HBase
        HConnection conn = HConnectionManager.newConnection();

        conn.execute("CREATE TEMP MAPPING demo2 FOR TABLE example2"
                     + "("
                     + "keyval KEY, "
                     + "f1 ("
                     + "  val1 STRING ALIAS val1, "
                     + "  val2 INT ALIAS val2, "
View Full Code Here

                     + "  val3 STRING ALIAS val3 DEFAULT 'This is a default value' "
                     + "))");

        // Clean up table
        if (!conn.tableExists("example2"))
            conn.execute("CREATE TABLE example2 (f1())");
        else
            conn.execute("DELETE FROM demo2");

        // Add some records using an INSERT stmt
        HPreparedStatement stmt = conn.prepareStatement("INSERT INTO demo2 " +
View Full Code Here

        // Clean up table
        if (!conn.tableExists("example2"))
            conn.execute("CREATE TABLE example2 (f1())");
        else
            conn.execute("DELETE FROM demo2");

        // Add some records using an INSERT stmt
        HPreparedStatement stmt = conn.prepareStatement("INSERT INTO demo2 " +
                                                        "(keyval, val1, val2, val3) VALUES " +
                                                        "(ZEROPAD(:key, 10), :val1, :val2, DEFAULT)");
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.