throws Exception {
PigServer pigServer = new PigServer( pc );
LogicalPlan newLogicalPlan = Util.buildLp(pigServer, query);
Operator op = newLogicalPlan.getSinks().get(0);
LOFilter filter = (LOFilter)newLogicalPlan.getPredecessors(op).get(0);
PColFilterExtractor pColExtractor = new PColFilterExtractor(
filter.getFilterPlan(), partitionCols);
pColExtractor.visit();
if(expPartFilterString == null) {
Assert.assertEquals("Checking partition column filter:", null,
pColExtractor.getPColCondition());
} else {
Assert.assertEquals("Checking partition column filter:",
expPartFilterString,
pColExtractor.getPColCondition().toString());
}
// The getExpression() in PColFilterExtractor was written to get the
// pushdown filter expression and does not have support for columns of
// type tuple or map as partition columns are expected to be of
// primitive data type. But we are using the method in the tests for forming
// trimmed filter after pushdown. So skip check in cases where we expect a
// trimmed filter to have a map or tuple in the condition.
if (!skipTrimmedFilterCheck) {
if (expFilterString == null) {
Assert.assertTrue("Check that filter can be removed:",
pColExtractor.isFilterRemovable());
} else {
String actual = pColExtractor
.getExpression(
(LogicalExpression) filter.getFilterPlan().getSources().get(0))
.toString();
Assert.assertEquals("checking trimmed filter expression:", expFilterString, actual);
}