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());
}
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);
}
}
Aggregations