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