Search in sources :

Example 1 with HBasePageSinkProvider

use of io.hetu.core.plugin.hbase.query.HBasePageSinkProvider in project hetu-core by openlookeng.

the class TestHBase method setUp.

/**
 * setUp
 */
@BeforeClass
public void setUp() {
    hCConf.setZkClientPort("2181");
    hCConf.setZkQuorum("zk1");
    hetuMetastore = new TestingHetuMetastore();
    table = TestUtils.createHBaseTableHandle();
    schemaTableName = new SchemaTableName("hbase", "test_table");
    hconn = new TestHBaseClientConnection(hCConf, hetuMetastore.getHetuMetastore());
    hconn.createConnection();
    session = new TestingConnectorSession("root");
    hcm = new HBaseConnectorMetadata(hconn);
    hConnector = new HBaseConnector(new HBaseConnectorMetadataFactory(hconn, hCConf), new HBaseSplitManager(hconn), new HBasePageSinkProvider(hconn), new HBasePageSourceProvider(new HBaseRecordSetProvider(hconn), hconn), Optional.empty(), null);
}
Also used : HBasePageSinkProvider(io.hetu.core.plugin.hbase.query.HBasePageSinkProvider) TestingHetuMetastore(io.hetu.core.plugin.hbase.metadata.TestingHetuMetastore) TestHBaseClientConnection(io.hetu.core.plugin.hbase.connector.TestHBaseClientConnection) HBaseRecordSetProvider(io.hetu.core.plugin.hbase.query.HBaseRecordSetProvider) TestingConnectorSession(io.hetu.core.plugin.hbase.client.TestingConnectorSession) HBaseConnectorMetadataFactory(io.hetu.core.plugin.hbase.connector.HBaseConnectorMetadataFactory) HBaseSplitManager(io.hetu.core.plugin.hbase.split.HBaseSplitManager) HBasePageSourceProvider(io.hetu.core.plugin.hbase.query.HBasePageSourceProvider) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) HBaseConnectorMetadata(io.hetu.core.plugin.hbase.metadata.HBaseConnectorMetadata) HBaseConnector(io.hetu.core.plugin.hbase.connector.HBaseConnector) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with HBasePageSinkProvider

use of io.hetu.core.plugin.hbase.query.HBasePageSinkProvider in project hetu-core by openlookeng.

the class TestHBase method testPageSink.

/**
 * testPageSink
 */
@Test
public void testPageSink() {
    HBasePageSinkProvider hpsp = new HBasePageSinkProvider(hconn);
    HBaseTableHandle insertHandler = new HBaseTableHandle("hbase", "test_table", 0, hconn.getTable("hbase.test_table").getColumns(), hconn.getTable("hbase.test_table").getSerializerClassName(), Optional.of("test_table"), OptionalLong.empty());
    if (insertHandler instanceof ConnectorInsertTableHandle) {
        ConnectorPageSink cps = hpsp.createPageSink(new HBaseTransactionHandle(), session, (ConnectorInsertTableHandle) insertHandler);
        long completedBytes = cps.getCompletedBytes();
        long sysMemUsage = cps.getSystemMemoryUsage();
        long cpuNanos = cps.getValidationCpuNanos();
        assertTrue(cpuNanos >= 0);
        assertTrue(sysMemUsage >= 0);
        assertTrue(completedBytes >= 0);
        int[] offsets = { 0, 4 };
        Block rowkey = new VariableWidthBlock(1, TestSliceUtils.createSlice("0001"), offsets, Optional.empty());
        int[] offset2 = { 0, 5 };
        Block name = new VariableWidthBlock(1, TestSliceUtils.createSlice("name2"), offset2, Optional.empty());
        long[] longs = new long[1];
        longs[0] = 12;
        Block age = new LongArrayBlock(1, Optional.empty(), longs);
        int[] ints = new int[1];
        ints[0] = 17832;
        Block gender = new IntArrayBlock(1, Optional.empty(), ints);
        Block columnT = new LongArrayBlock(1, Optional.empty(), longs);
        Page page = new Page(rowkey, name, age, gender, columnT);
        assertEquals(NOT_BLOCKED, cps.appendPage(page));
        cps.abort();
    }
}
Also used : IntArrayBlock(io.prestosql.spi.block.IntArrayBlock) LongArrayBlock(io.prestosql.spi.block.LongArrayBlock) HBasePageSinkProvider(io.hetu.core.plugin.hbase.query.HBasePageSinkProvider) ConnectorInsertTableHandle(io.prestosql.spi.connector.ConnectorInsertTableHandle) HBaseTransactionHandle(io.hetu.core.plugin.hbase.connector.HBaseTransactionHandle) Page(io.prestosql.spi.Page) VariableWidthBlock(io.prestosql.spi.block.VariableWidthBlock) LongArrayBlock(io.prestosql.spi.block.LongArrayBlock) VariableWidthBlock(io.prestosql.spi.block.VariableWidthBlock) Block(io.prestosql.spi.block.Block) IntArrayBlock(io.prestosql.spi.block.IntArrayBlock) ConnectorPageSink(io.prestosql.spi.connector.ConnectorPageSink) HBaseTableHandle(io.hetu.core.plugin.hbase.connector.HBaseTableHandle) Test(org.testng.annotations.Test)

Example 3 with HBasePageSinkProvider

use of io.hetu.core.plugin.hbase.query.HBasePageSinkProvider in project hetu-core by openlookeng.

the class TestHBaseConnector method setUp.

/**
 * setUp
 */
@BeforeClass
public void setUp() {
    hCConf.setZkClientPort("2181");
    hCConf.setZkQuorum("zk1");
    hetuMetastore = new TestingHetuMetastore();
    schemaTableName = new SchemaTableName("hbase", "test_table");
    hconn = new TestHBaseClientConnection(hCConf, hetuMetastore.getHetuMetastore());
    hconn.createConnection();
    session = new TestingConnectorSession("root");
    hcm = new HBaseConnectorMetadata(hconn);
    hConnector = new HBaseConnector(new HBaseConnectorMetadataFactory(hconn, hCConf), new HBaseSplitManager(hconn), new HBasePageSinkProvider(hconn), new HBasePageSourceProvider(new HBaseRecordSetProvider(hconn), hconn), Optional.empty(), new HBaseTableProperties());
}
Also used : HBasePageSinkProvider(io.hetu.core.plugin.hbase.query.HBasePageSinkProvider) TestingHetuMetastore(io.hetu.core.plugin.hbase.metadata.TestingHetuMetastore) HBaseRecordSetProvider(io.hetu.core.plugin.hbase.query.HBaseRecordSetProvider) HBaseTableProperties(io.hetu.core.plugin.hbase.conf.HBaseTableProperties) TestingConnectorSession(io.hetu.core.plugin.hbase.client.TestingConnectorSession) HBaseSplitManager(io.hetu.core.plugin.hbase.split.HBaseSplitManager) HBasePageSourceProvider(io.hetu.core.plugin.hbase.query.HBasePageSourceProvider) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) HBaseConnectorMetadata(io.hetu.core.plugin.hbase.metadata.HBaseConnectorMetadata) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

HBasePageSinkProvider (io.hetu.core.plugin.hbase.query.HBasePageSinkProvider)3 TestingConnectorSession (io.hetu.core.plugin.hbase.client.TestingConnectorSession)2 HBaseConnectorMetadata (io.hetu.core.plugin.hbase.metadata.HBaseConnectorMetadata)2 TestingHetuMetastore (io.hetu.core.plugin.hbase.metadata.TestingHetuMetastore)2 HBasePageSourceProvider (io.hetu.core.plugin.hbase.query.HBasePageSourceProvider)2 HBaseRecordSetProvider (io.hetu.core.plugin.hbase.query.HBaseRecordSetProvider)2 HBaseSplitManager (io.hetu.core.plugin.hbase.split.HBaseSplitManager)2 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)2 BeforeClass (org.testng.annotations.BeforeClass)2 HBaseTableProperties (io.hetu.core.plugin.hbase.conf.HBaseTableProperties)1 HBaseConnector (io.hetu.core.plugin.hbase.connector.HBaseConnector)1 HBaseConnectorMetadataFactory (io.hetu.core.plugin.hbase.connector.HBaseConnectorMetadataFactory)1 HBaseTableHandle (io.hetu.core.plugin.hbase.connector.HBaseTableHandle)1 HBaseTransactionHandle (io.hetu.core.plugin.hbase.connector.HBaseTransactionHandle)1 TestHBaseClientConnection (io.hetu.core.plugin.hbase.connector.TestHBaseClientConnection)1 Page (io.prestosql.spi.Page)1 Block (io.prestosql.spi.block.Block)1 IntArrayBlock (io.prestosql.spi.block.IntArrayBlock)1 LongArrayBlock (io.prestosql.spi.block.LongArrayBlock)1 VariableWidthBlock (io.prestosql.spi.block.VariableWidthBlock)1