Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CARBONDATA-278] IS NULL and IS NOT NULL shall be push down to carbon #202

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class BinaryConditionalExpression extends BinaryLogicalExpressio
*
*/
private static final long serialVersionUID = 1L;

public boolean isNull;
public BinaryConditionalExpression(Expression left, Expression right) {
super(left, right);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
public class EqualToExpression extends BinaryConditionalExpression {

private static final long serialVersionUID = 1L;
private boolean isNull;

public EqualToExpression(Expression left, Expression right) {
super(left, right);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ private FilterResolverIntf createFilterResolverTree(Expression expressionTree,
currentExpression), currentExpression);
case EQUALS:
case IN:
return getFilterResolverBasedOnExpressionType(ExpressionType.EQUALS, false, expressionTree,
return getFilterResolverBasedOnExpressionType(ExpressionType.EQUALS,
((BinaryConditionalExpression) expressionTree).isNull, expressionTree,
tableIdentifier, expressionTree);
case GREATERTHAN:
case GREATERTHAN_EQUALTO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public ConditionalFilterResolverImpl(Expression exp, boolean isExpressionResolve
metadata.setColumnExpression(columnList.get(0));
metadata.setExpression(exp);
metadata.setIncludeFilter(isIncludeFilter);
if (!columnList.get(0).getDimension().hasEncoding(Encoding.DICTIONARY)) {
if (!columnList.get(0).getDimension().hasEncoding(Encoding.DICTIONARY)
|| columnList.get(0).getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
dimColResolvedFilterInfo.populateFilterInfoBasedOnColumnType(
FilterInfoTypeVisitorFactory.getResolvedFilterInfoVisitor(columnList.get(0)), metadata);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ object CarbonFilters {
Some(sources.Not(sources.EqualTo(a.name, v)))
case Not(EqualTo(Literal(v, t), Cast(a: Attribute, _))) => new
Some(sources.Not(sources.EqualTo(a.name, v)))

case IsNotNull(a: Attribute) => Some(sources.IsNotNull(a.name))
case IsNull(a: Attribute) => Some(sources.IsNull(a.name))
case Not(In(a: Attribute, list)) if !list.exists(!_.isInstanceOf[Literal]) =>
val hSet = list.map(e => e.eval(EmptyRow))
Some(sources.Not(sources.In(a.name, hSet.toArray)))
Expand Down Expand Up @@ -257,7 +258,12 @@ object CarbonFilters {
Some(new NotEqualsExpression(transformExpression(a).get, transformExpression(l).get))
case Not(EqualTo(l@Literal(v, t), Cast(a: Attribute, _))) => new
Some(new NotEqualsExpression(transformExpression(a).get, transformExpression(l).get))

case IsNotNull(child) =>
Some(new NotEqualsExpression(transformExpression(child).get,
transformExpression(Literal(null)).get, true))
case IsNull(child) =>
Some(new EqualToExpression(transformExpression(child).get,
transformExpression(Literal(null)).get, true))
case Not(In(a: Attribute, list))
if !list.exists(!_.isInstanceOf[Literal]) =>
if (list.exists(x => (isNullLiteral(x.asInstanceOf[Literal])))) {
Expand Down