Search in sources :

Example 1 with HBaseSplit

use of io.hetu.core.plugin.hbase.split.HBaseSplit in project hetu-core by openlookeng.

the class TestHBase method testGetSRecordSet.

/**
 * testGetSRecordSet
 */
@Test
public void testGetSRecordSet() {
    List<HostAddress> hostAddressList = new ArrayList<>(1);
    Map<Integer, List<Range>> ranges = new HashMap<>();
    HBaseSplit split = new HBaseSplit("rowkey", TestUtils.createHBaseTableHandle(), hostAddressList, null, null, ranges, 0, false, null);
    HBaseRecordSetProvider hrsp = new HBaseRecordSetProvider(hconn);
    RecordSet rs = hrsp.getRecordSet(new HBaseTransactionHandle(), session, split, TestUtils.createHBaseTableHandle(), hconn.getTable("hbase.test_table").getColumns());
    assertEquals(5, rs.getColumnTypes().size());
}
Also used : HashMap(java.util.HashMap) HBaseRecordSetProvider(io.hetu.core.plugin.hbase.query.HBaseRecordSetProvider) ArrayList(java.util.ArrayList) HBaseTransactionHandle(io.hetu.core.plugin.hbase.connector.HBaseTransactionHandle) List(java.util.List) ArrayList(java.util.ArrayList) HBaseSplit(io.hetu.core.plugin.hbase.split.HBaseSplit) RecordSet(io.prestosql.spi.connector.RecordSet) HostAddress(io.prestosql.spi.HostAddress) Test(org.testng.annotations.Test)

Example 2 with HBaseSplit

use of io.hetu.core.plugin.hbase.split.HBaseSplit in project hetu-core by openlookeng.

the class TestQuery method testHBaseRecordSetGetFiltersFromDomains.

/**
 * testHBaseRecordSetGetFiltersFromDomains
 */
@Test
public void testHBaseRecordSetGetFiltersFromDomains() {
    List<HBaseColumnHandle> list = new ArrayList<>();
    list.add(TestUtils.createHBaseColumnRowId("rowkey"));
    HBaseTableHandle tableHandle = new HBaseTableHandle("hbase", "test_table", "rowkey", false, "io.hetu.core.plugin.hbase.utils.serializers.StringRowSerializer", Optional.of("test_table"), "", null, list, 0, OptionalLong.empty());
    // case ABOVE
    Map<Integer, List<Range>> ranges = new HashMap<>();
    long startRow = 1;
    long endRow = 12345678;
    List<Range> range = new ArrayList<>();
    range.add(new Range(Marker.above(BIGINT, startRow), Marker.below(BIGINT, endRow)));
    ranges.put(0, range);
    HBaseSplit hBasesplit = new HBaseSplit("rowkey", tableHandle, new ArrayList<HostAddress>(1), "1", "12345678", ranges, -1, false, null);
    HBaseRecordSet rSet = new HBaseRecordSet(hconn, session, hBasesplit, tableHandle, list);
    rSet.getFiltersFromDomains(ranges);
    // List<Range> is null
    ranges.clear();
    ranges.put(0, null);
    rSet.getFiltersFromDomains(ranges);
    // case EXACTLY
    range.clear();
    ranges.clear();
    long exactly = 12345678;
    range.add(Range.equal(BIGINT, exactly));
    ranges.put(0, range);
    rSet.getFiltersFromDomains(ranges);
    // other case
    range.add(Range.range(BIGINT, exactly, true, exactly * 2, true));
    ranges.put(1, range);
    list.add(TestUtils.createHBaseColumnHandle("a", "f_a", "q_a", 1));
    HBaseRecordSet rSet2Column = new HBaseRecordSet(hconn, session, hBasesplit, tableHandle, list);
    rSet2Column.getFiltersFromDomains(ranges);
}
Also used : HBaseColumnHandle(io.hetu.core.plugin.hbase.connector.HBaseColumnHandle) HBaseRecordSet(io.hetu.core.plugin.hbase.query.HBaseRecordSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HBaseSplit(io.hetu.core.plugin.hbase.split.HBaseSplit) Range(io.prestosql.spi.predicate.Range) HostAddress(io.prestosql.spi.HostAddress) ArrayList(java.util.ArrayList) List(java.util.List) HBaseTableHandle(io.hetu.core.plugin.hbase.connector.HBaseTableHandle) Test(org.testng.annotations.Test)

Example 3 with HBaseSplit

use of io.hetu.core.plugin.hbase.split.HBaseSplit in project hetu-core by openlookeng.

the class TestQuery method setUp.

/**
 * setUp
 */
@BeforeClass
public void setUp() {
    hCConf.setZkClientPort("2181");
    hCConf.setZkQuorum("zk1");
    hetuMetastore = new TestingHetuMetastore();
    hconn = new TestHBaseClientConnection(hCConf, hetuMetastore.getHetuMetastore());
    hconn.createConnection();
    session = new TestingConnectorSession("root");
    split = new HBaseSplit("rowKey", TestUtils.createHBaseTableHandle(), new ArrayList<HostAddress>(1), "startrow", "endrow", new HashMap<>(), -1, false, null);
    recordSet = new HBaseRecordSet(hconn, session, split, TestUtils.createHBaseTableHandle(), TestUtils.createColumnList());
}
Also used : HBaseRecordSet(io.hetu.core.plugin.hbase.query.HBaseRecordSet) TestingHetuMetastore(io.hetu.core.plugin.hbase.metadata.TestingHetuMetastore) TestHBaseClientConnection(io.hetu.core.plugin.hbase.connector.TestHBaseClientConnection) HashMap(java.util.HashMap) TestingConnectorSession(io.hetu.core.plugin.hbase.client.TestingConnectorSession) ArrayList(java.util.ArrayList) HBaseSplit(io.hetu.core.plugin.hbase.split.HBaseSplit) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with HBaseSplit

use of io.hetu.core.plugin.hbase.split.HBaseSplit in project hetu-core by openlookeng.

the class TestQuery method testHBaseRecordSetCursorIsBatchGet.

/**
 * testHBaseRecordSetCursorIsBatchGet
 */
@Test
public void testHBaseRecordSetCursorIsBatchGet() {
    HBaseTableHandle tableHandle = new HBaseTableHandle("hbase", "test_table", "rowkey", false, "io.hetu.core.plugin.hbase.utils.serializers.StringRowSerializer", Optional.of("test_table"), "", TestUtils.createTupleDomain(1), TestUtils.createColumnList(), 0, OptionalLong.empty());
    HBaseSplit hBasesplit = new HBaseSplit("rowKey", tableHandle, new ArrayList<HostAddress>(1), "startrow", "endrow", new HashMap<>(), -1, false, null);
    HBaseRecordSet rSet = new HBaseRecordSet(hconn, session, hBasesplit, tableHandle, TestUtils.createColumnList());
    rSet.cursor();
}
Also used : HBaseRecordSet(io.hetu.core.plugin.hbase.query.HBaseRecordSet) HBaseSplit(io.hetu.core.plugin.hbase.split.HBaseSplit) HostAddress(io.prestosql.spi.HostAddress) HBaseTableHandle(io.hetu.core.plugin.hbase.connector.HBaseTableHandle) Test(org.testng.annotations.Test)

Aggregations

HBaseSplit (io.hetu.core.plugin.hbase.split.HBaseSplit)4 HBaseRecordSet (io.hetu.core.plugin.hbase.query.HBaseRecordSet)3 HostAddress (io.prestosql.spi.HostAddress)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Test (org.testng.annotations.Test)3 HBaseTableHandle (io.hetu.core.plugin.hbase.connector.HBaseTableHandle)2 List (java.util.List)2 TestingConnectorSession (io.hetu.core.plugin.hbase.client.TestingConnectorSession)1 HBaseColumnHandle (io.hetu.core.plugin.hbase.connector.HBaseColumnHandle)1 HBaseTransactionHandle (io.hetu.core.plugin.hbase.connector.HBaseTransactionHandle)1 TestHBaseClientConnection (io.hetu.core.plugin.hbase.connector.TestHBaseClientConnection)1 TestingHetuMetastore (io.hetu.core.plugin.hbase.metadata.TestingHetuMetastore)1 HBaseRecordSetProvider (io.hetu.core.plugin.hbase.query.HBaseRecordSetProvider)1 RecordSet (io.prestosql.spi.connector.RecordSet)1 Range (io.prestosql.spi.predicate.Range)1 BeforeClass (org.testng.annotations.BeforeClass)1