Search in sources :

Example 1 with HBaseRecordSet

use of io.hetu.core.plugin.hbase.query.HBaseRecordSet 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 2 with HBaseRecordSet

use of io.hetu.core.plugin.hbase.query.HBaseRecordSet 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 3 with HBaseRecordSet

use of io.hetu.core.plugin.hbase.query.HBaseRecordSet 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

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