use of org.apache.carbondata.core.scan.filter.resolver.LogicalFilterResolverImpl in project carbondata by apache.
the class FilterExpressionProcessor method createFilterResolverTree.
/**
* Pattern used : Visitor Pattern
* Method will create filter resolver tree based on the filter expression tree,
* in this algorithm based on the expression instance the resolvers will created
*
* @param expressionTree
* @param tableIdentifier
* @return
*/
private FilterResolverIntf createFilterResolverTree(Expression expressionTree, AbsoluteTableIdentifier tableIdentifier) {
ExpressionType filterExpressionType = expressionTree.getFilterExpressionType();
BinaryExpression currentExpression = null;
switch(filterExpressionType) {
case OR:
currentExpression = (BinaryExpression) expressionTree;
return new LogicalFilterResolverImpl(createFilterResolverTree(currentExpression.getLeft(), tableIdentifier), createFilterResolverTree(currentExpression.getRight(), tableIdentifier), currentExpression);
case AND:
currentExpression = (BinaryExpression) expressionTree;
return new LogicalFilterResolverImpl(createFilterResolverTree(currentExpression.getLeft(), tableIdentifier), createFilterResolverTree(currentExpression.getRight(), tableIdentifier), currentExpression);
case RANGE:
return getFilterResolverBasedOnExpressionType(ExpressionType.RANGE, true, expressionTree, tableIdentifier, expressionTree);
case EQUALS:
case IN:
return getFilterResolverBasedOnExpressionType(ExpressionType.EQUALS, ((BinaryConditionalExpression) expressionTree).isNull, expressionTree, tableIdentifier, expressionTree);
case GREATERTHAN:
case GREATERTHAN_EQUALTO:
case LESSTHAN:
case LESSTHAN_EQUALTO:
return getFilterResolverBasedOnExpressionType(ExpressionType.EQUALS, true, expressionTree, tableIdentifier, expressionTree);
case NOT_EQUALS:
case NOT_IN:
return getFilterResolverBasedOnExpressionType(ExpressionType.NOT_EQUALS, false, expressionTree, tableIdentifier, expressionTree);
case FALSE:
return getFilterResolverBasedOnExpressionType(ExpressionType.FALSE, false, expressionTree, tableIdentifier, expressionTree);
case TRUE:
return getFilterResolverBasedOnExpressionType(ExpressionType.TRUE, false, expressionTree, tableIdentifier, expressionTree);
default:
return getFilterResolverBasedOnExpressionType(ExpressionType.UNKNOWN, false, expressionTree, tableIdentifier, expressionTree);
}
}
Aggregations