Search in sources :

Example 1 with TSComparator

use of org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator in project hive by apache.

the class TestSharedWorkOptimizer method testTSCmpOrdersById.

@Test
public void testTSCmpOrdersById() {
    TableScanOperator ts1 = getTsOp();
    TableScanOperator ts2 = getTsOp();
    ArrayList<TableScanOperator> li1 = Lists.newArrayList(ts1, ts2);
    ArrayList<TableScanOperator> li2 = Lists.newArrayList(ts2, ts1);
    li1.sort(new TSComparator());
    li2.sort(new TSComparator());
    assertTrue(li1.get(0) == li2.get(0));
}
Also used : TableScanOperator(org.apache.hadoop.hive.ql.exec.TableScanOperator) TSComparator(org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator) Test(org.junit.Test)

Example 2 with TSComparator

use of org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator in project hive by apache.

the class TestSharedWorkOptimizer method testTSCmp.

@Test
public void testTSCmp() {
    ArrayList<TableScanOperator> li = Lists.newArrayList(addFilter(getTsOp(), 1), getTsOp());
    li.sort(new TSComparator());
    assertNull(li.get(0).getConf().getFilterExpr());
}
Also used : TableScanOperator(org.apache.hadoop.hive.ql.exec.TableScanOperator) TSComparator(org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator) Test(org.junit.Test)

Example 3 with TSComparator

use of org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator in project hive by apache.

the class TestSharedWorkOptimizer method testTSCmpOrdersByDataSizeDesc.

@Test
public void testTSCmpOrdersByDataSizeDesc() {
    TableScanOperator ts1 = getTsOp();
    TableScanOperator ts2 = getTsOp();
    TableScanOperator ts3 = getTsOp();
    ts1.setStatistics(new Statistics(100, 100, 1, 1));
    ts2.setStatistics(new Statistics(1000, 1000, 1, 1));
    ts3.setStatistics(new Statistics(10, 10, 1, 1));
    ArrayList<TableScanOperator> li1 = Lists.newArrayList(ts1, ts3, ts2);
    li1.sort(new TSComparator());
    assertTrue(li1.get(0).getStatistics().getDataSize() == 1000);
    assertTrue(li1.get(1).getStatistics().getDataSize() == 100);
    assertTrue(li1.get(2).getStatistics().getDataSize() == 10);
}
Also used : TableScanOperator(org.apache.hadoop.hive.ql.exec.TableScanOperator) TSComparator(org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator) Statistics(org.apache.hadoop.hive.ql.plan.Statistics) Test(org.junit.Test)

Aggregations

TableScanOperator (org.apache.hadoop.hive.ql.exec.TableScanOperator)3 TSComparator (org.apache.hadoop.hive.ql.optimizer.SharedWorkOptimizer.TSComparator)3 Test (org.junit.Test)3 Statistics (org.apache.hadoop.hive.ql.plan.Statistics)1