use of org.apache.carbondata.core.scan.expression.conditional.InExpression in project carbondata by apache.
the class FilterUtilTest method testRemoveInExpressionNodeWithPositionIdColumn.
@Test
public void testRemoveInExpressionNodeWithPositionIdColumn() {
List<Expression> children = new ArrayList<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
// create literal expression
LiteralExpression literalExpression = new LiteralExpression("0/1/0-0_batchno0-0-1517808273200/0", DataTypes.STRING);
children.add(literalExpression);
// create list expression
ListExpression listExpression = new ListExpression(children);
// create column expression with column name as positionId
ColumnExpression columnExpression = new ColumnExpression(CarbonCommonConstants.POSITION_ID, DataTypes.STRING);
// create InExpression as right node
InExpression inExpression = new InExpression(columnExpression, listExpression);
// create a dummy true expression as left node
TrueExpression trueExpression = new TrueExpression(null);
// create and expression as the root node
Expression expression = new AndExpression(trueExpression, inExpression);
// test remove expression method
FilterUtil.removeInExpressionNodeWithPositionIdColumn(expression);
// after removing the right node instance of right node should be of true expression
assert (((AndExpression) expression).getRight() instanceof TrueExpression);
}
Aggregations