Search in sources :

Example 1 with FilterPlan

use of org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.FilterPlan in project hive by apache.

the class TestHBaseFilterPlanUtil method testScanPlanOr.

/**
   * Test ScanPlan OR operation
   */
@Test
public void testScanPlanOr() {
    ScanPlan l = new ScanPlan();
    ScanPlan r = new ScanPlan();
    l.setStartMarker("a", "int", "1", INCLUSIVE);
    r.setStartMarker("a", "int", "11", INCLUSIVE);
    FilterPlan res1 = l.or(r);
    Assert.assertEquals(2, res1.getPlans().size());
    res1.getPlans().get(0).markers.get("a").startMarker.equals(l.markers.get("a").startMarker);
    res1.getPlans().get(1).markers.get("a").startMarker.equals(r.markers.get("a").startMarker);
    FilterPlan res2 = res1.or(r);
    Assert.assertEquals(3, res2.getPlans().size());
}
Also used : MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) ScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan) FilterPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.FilterPlan) Test(org.junit.Test)

Example 2 with FilterPlan

use of org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.FilterPlan in project hive by apache.

the class TestHBaseFilterPlanUtil method verifyPlan.

private void verifyPlan(TreeNode l, List<FieldSchema> parts, String keyName, ScanMarker startMarker, ScanMarker endMarker, boolean hasUnsupportedCondition) throws MetaException {
    ExpressionTree e = null;
    if (l != null) {
        e = new ExpressionTree();
        e.setRootForTest(l);
    }
    PlanResult planRes = HBaseFilterPlanUtil.getFilterPlan(e, parts);
    FilterPlan plan = planRes.plan;
    Assert.assertEquals("Has unsupported condition", hasUnsupportedCondition, planRes.hasUnsupportedCondition);
    Assert.assertEquals(1, plan.getPlans().size());
    ScanPlan splan = plan.getPlans().get(0);
    if (startMarker != null) {
        Assert.assertEquals(startMarker, splan.markers.get(keyName).startMarker);
    } else {
        Assert.assertTrue(splan.markers.get(keyName) == null || splan.markers.get(keyName).startMarker == null);
    }
    if (endMarker != null) {
        Assert.assertEquals(endMarker, splan.markers.get(keyName).endMarker);
    } else {
        Assert.assertTrue(splan.markers.get(keyName) == null || splan.markers.get(keyName).endMarker == null);
    }
}
Also used : PlanResult(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.PlanResult) MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) ScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan) ExpressionTree(org.apache.hadoop.hive.metastore.parser.ExpressionTree) FilterPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.FilterPlan)

Aggregations

FilterPlan (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.FilterPlan)2 MultiScanPlan (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan)2 ScanPlan (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan)2 PlanResult (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.PlanResult)1 ExpressionTree (org.apache.hadoop.hive.metastore.parser.ExpressionTree)1 Test (org.junit.Test)1