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);
FilterExtractor pColExtractor = new FilterExtractor(
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());
}
if (expFilterString == null) {
Assert.assertTrue("Check that filter can be removed:",
pColExtractor.isFilterRemovable());
} else {
if (unsupportedExpression) {
String actual = getTestExpression((LogicalExpression)pColExtractor.getFilteredPlan().getSources().get(0)).toString();
Assert.assertEquals("checking trimmed filter expression:", expFilterString, actual);
} else {
String actual = FilterExtractor.getExpression((LogicalExpression)pColExtractor.getFilteredPlan().getSources().get(0)).toString();
Assert.assertEquals("checking trimmed filter expression:", expFilterString, actual);
}
}
return pColExtractor;
}