Skip to content

Commit

Permalink
[CARBONDATA-792] Range filter optimization. This closes apache#670
Browse files Browse the repository at this point in the history
  • Loading branch information
gvramana committed Mar 23, 2017
2 parents d8d4c98 + c2e4eb2 commit 67acca2
Show file tree
Hide file tree
Showing 42 changed files with 3,377 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ public Expression getRight() {
return right;
}

@Override public void findAndSetChild(Expression oldExpr, Expression newExpr) {
for (int i = 0; i < children.size(); i++) {
if (oldExpr.equals(children.get(i))) {
if (this.left.equals(children.get(i))) {
this.left = newExpr;
} else if (this.right.equals(children.get(i))) {
this.right = newExpr;
}
children.remove(i);
children.add(newExpr);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,7 @@ public void setCarbonColumn(CarbonColumn carbonColumn) {
this.carbonColumn = carbonColumn;
}

@Override public void findAndSetChild(Expression oldExpr, Expression newExpr) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public List<Expression> getChildren() {
return children;
}

/**
* This method finds the Expression pointed by oldExpr and replace it with newExpr.
* @param oldExpr
* @param newExpr
*/
public abstract void findAndSetChild(Expression oldExpr, Expression newExpr);

public abstract String getString();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.carbondata.core.scan.expression;

import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.scan.filter.intf.ExpressionType;

public class FilterModificationNode {
private Expression currentExp;
private Expression parentExp;
private ExpressionType expType;
private ExpressionResult literalValue;
private String columnName;

public FilterModificationNode(Expression currentNode, Expression parentNode,
ExpressionType expType, DataType dataType, Object literalVal, String colName) {
this.currentExp = currentNode;
this.parentExp = parentNode;
this.expType = expType;
this.columnName = colName;
this.literalValue = new ExpressionResult(dataType, literalVal);
}

public Expression getCurrentExp() {
return currentExp;
}

public void setCurrentExp(Expression currentExp) {
this.currentExp = currentExp;
}

public Expression getParentExp() {
return parentExp;
}

public void setParentExp(Expression parentExp) {
this.parentExp = parentExp;
}

public ExpressionType getExpType() {
return expType;
}

public void setExpType(ExpressionType expType) {
this.expType = expType;
}

public ExpressionResult getLiteralValue() {
return literalValue;
}

public void setLiteralValue(ExpressionResult literalValue) {
this.literalValue = literalValue;
}

public String getColumnName() {
return columnName;
}

public void setColumnName(String columnName) {
this.columnName = columnName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.carbondata.core.scan.expression;


import org.apache.carbondata.core.metadata.datatype.DataType;
import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
import org.apache.carbondata.core.scan.filter.intf.RowIntf;
Expand Down Expand Up @@ -64,4 +65,11 @@ public DataType getLiteralExpDataType() {
return dataType;
}

public Object getLiteralExpValue() {
return value;
}

@Override public void findAndSetChild(Expression oldExpr, Expression newExpr) {
}

}
Loading

0 comments on commit 67acca2

Please sign in to comment.