Search in sources :

Example 1 with MultiScanPlan

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

the class TestHBaseFilterPlanUtil method testMultiScanPlanAnd.

/**
   * Test MultiScanPlan AND
   */
@Test
public void testMultiScanPlanAnd() {
    MultiScanPlan l = createMultiScanPlan(new ScanPlan());
    MultiScanPlan r = createMultiScanPlan(new ScanPlan());
    // two MultiScanPlan with single scan plans should result in new FilterPlan
    // with just one scan
    Assert.assertEquals(1, l.and(r).getPlans().size());
    // l has one ScanPlan, r has two. AND result should have two
    r = createMultiScanPlan(new ScanPlan(), new ScanPlan());
    Assert.assertEquals(2, l.and(r).getPlans().size());
    Assert.assertEquals(2, r.and(l).getPlans().size());
    // l has 2 ScanPlans, r has 3. AND result should have 6
    l = createMultiScanPlan(new ScanPlan(), new ScanPlan());
    r = createMultiScanPlan(new ScanPlan(), new ScanPlan(), new ScanPlan());
    Assert.assertEquals(6, l.and(r).getPlans().size());
    Assert.assertEquals(6, r.and(l).getPlans().size());
}
Also used : MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) ScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan) MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) Test(org.junit.Test)

Example 2 with MultiScanPlan

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

the class TestHBaseFilterPlanUtil method testMultiScanPlanOr.

/**
   * Test MultiScanPlan OR
   */
@Test
public void testMultiScanPlanOr() {
    MultiScanPlan l = createMultiScanPlan(new ScanPlan());
    MultiScanPlan r = createMultiScanPlan(new ScanPlan());
    // verify OR of two multi plans with one plan each
    Assert.assertEquals(2, l.or(r).getPlans().size());
    // verify OR of multi plan with a single scanplan
    Assert.assertEquals(2, l.or(new ScanPlan()).getPlans().size());
    Assert.assertEquals(2, (new ScanPlan()).or(l).getPlans().size());
    // verify or of two multiplans with more than one scan plan
    r = createMultiScanPlan(new ScanPlan(), new ScanPlan());
    Assert.assertEquals(3, l.or(r).getPlans().size());
    Assert.assertEquals(3, r.or(l).getPlans().size());
}
Also used : MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) ScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan) MultiScanPlan(org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan) Test(org.junit.Test)

Aggregations

MultiScanPlan (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.MultiScanPlan)2 ScanPlan (org.apache.hadoop.hive.metastore.hbase.HBaseFilterPlanUtil.ScanPlan)2 Test (org.junit.Test)2