carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [27/52] [partial] incubator-carbondata git commit: Renamed packages to org.apache.carbondata and fixed errors
Date Mon, 15 Aug 2016 07:09:12 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/intf/ExpressionType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/intf/ExpressionType.java b/core/src/main/java/org/apache/carbondata/scan/filter/intf/ExpressionType.java
new file mode 100644
index 0000000..4d658fc
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/intf/ExpressionType.java
@@ -0,0 +1,44 @@
+/*
+ * 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.scan.filter.intf;
+
+public enum ExpressionType {
+
+  AND,
+  OR,
+  NOT,
+  EQUALS,
+  NOT_EQUALS,
+  LESSTHAN,
+  LESSTHAN_EQUALTO,
+  GREATERTHAN,
+  GREATERTHAN_EQUALTO,
+  ADD,
+  SUBSTRACT,
+  DIVIDE,
+  MULTIPLY,
+  IN,
+  LIST,
+  NOT_IN,
+  UNKNOWN,
+  LITERAL,
+  RANGE
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/intf/FilterExecuterType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/intf/FilterExecuterType.java b/core/src/main/java/org/apache/carbondata/scan/filter/intf/FilterExecuterType.java
new file mode 100644
index 0000000..39b7979
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/intf/FilterExecuterType.java
@@ -0,0 +1,28 @@
+/*
+ * 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.scan.filter.intf;
+
+import java.io.Serializable;
+
+public enum FilterExecuterType implements Serializable {
+
+  INCLUDE, EXCLUDE, OR, AND, RESTRUCTURE, ROWLEVEL, RANGE, ROWLEVEL_GREATERTHAN,
+  ROWLEVEL_GREATERTHAN_EQUALTO, ROWLEVEL_LESSTHAN_EQUALTO, ROWLEVEL_LESSTHAN
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowImpl.java
new file mode 100644
index 0000000..e924e79
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.scan.filter.intf;
+
+public class RowImpl implements RowIntf {
+  private Object[] row;
+
+  public RowImpl() {
+    row = new Object[0];
+  }
+
+  @Override public Object getVal(int index) {
+    return row[index];
+  }
+
+  @Override public Object[] getValues() {
+    return row;
+  }
+
+  @Override public void setValues(final Object[] row) {
+    this.row = row;
+  }
+
+  @Override public int size() {
+    return this.row.length;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowIntf.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowIntf.java b/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowIntf.java
new file mode 100644
index 0000000..d4b2a8f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/intf/RowIntf.java
@@ -0,0 +1,31 @@
+/*
+ * 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.scan.filter.intf;
+
+public interface RowIntf {
+  Object getVal(int index);
+
+  Object[] getValues();
+
+  void setValues(Object[] setValues);
+
+  int size();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/AndFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/AndFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/AndFilterResolverImpl.java
new file mode 100644
index 0000000..2495621
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/AndFilterResolverImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.BinaryExpression;
+import org.apache.carbondata.scan.filter.intf.ExpressionType;
+
+public class AndFilterResolverImpl extends LogicalFilterResolverImpl {
+
+  /**
+   *i
+   */
+  private static final long serialVersionUID = -761688076874662001L;
+
+  public AndFilterResolverImpl(FilterResolverIntf leftEvalutor, FilterResolverIntf rightEvalutor,
+      ExpressionType filterExpressionType,BinaryExpression expression) {
+    super(leftEvalutor, rightEvalutor, expression);
+  }
+
+  @Override public void getStartKey(long[] startKeys,
+      SortedMap<Integer, byte[]> noDicStartKeys, List<long[]> startKeyList)
+      throws QueryExecutionException {
+    leftEvalutor.getStartKey(startKeys, noDicStartKeys, startKeyList);
+    rightEvalutor.getStartKey(startKeys, noDicStartKeys, startKeyList);
+  }
+
+  @Override public void getEndKey(SegmentProperties segmentProperties,
+      AbsoluteTableIdentifier tableIdentifier, long[] endKeys,
+      SortedMap<Integer, byte[]> noDicEndKeys, List<long[]> endKeyList)
+      throws QueryExecutionException {
+    leftEvalutor.getEndKey(segmentProperties, tableIdentifier, endKeys, noDicEndKeys, endKeyList);
+    rightEvalutor.getEndKey(segmentProperties, tableIdentifier, endKeys, noDicEndKeys, endKeyList);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
new file mode 100644
index 0000000..bcb0a1b
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
@@ -0,0 +1,241 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.core.carbon.metadata.encoder.Encoding;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.conditional.BinaryConditionalExpression;
+import org.apache.carbondata.scan.expression.conditional.ConditionalExpression;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.FilterUtil;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.metadata.FilterResolverMetadata;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.visitor.FilterInfoTypeVisitorFactory;
+
+public class ConditionalFilterResolverImpl implements FilterResolverIntf {
+
+  private static final long serialVersionUID = 1838955268462201691L;
+  protected Expression exp;
+  protected boolean isExpressionResolve;
+  protected boolean isIncludeFilter;
+  private DimColumnResolvedFilterInfo dimColResolvedFilterInfo;
+
+  public ConditionalFilterResolverImpl(Expression exp, boolean isExpressionResolve,
+      boolean isIncludeFilter) {
+    this.exp = exp;
+    this.isExpressionResolve = isExpressionResolve;
+    this.isIncludeFilter = isIncludeFilter;
+    this.dimColResolvedFilterInfo = new DimColumnResolvedFilterInfo();
+  }
+
+  /**
+   * This API will resolve the filter expression and generates the
+   * dictionaries for executing/evaluating the filter expressions in the
+   * executer layer.
+   *
+   * @throws QueryExecutionException
+   * @throws FilterUnsupportedException
+   */
+  @Override public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier)
+      throws FilterUnsupportedException {
+    FilterResolverMetadata metadata = new FilterResolverMetadata();
+    metadata.setTableIdentifier(absoluteTableIdentifier);
+    if ((!isExpressionResolve) && exp instanceof BinaryConditionalExpression) {
+      BinaryConditionalExpression binaryConditionalExpression = (BinaryConditionalExpression) exp;
+      Expression leftExp = binaryConditionalExpression.getLeft();
+      Expression rightExp = binaryConditionalExpression.getRight();
+      if (leftExp instanceof ColumnExpression) {
+        ColumnExpression columnExpression = (ColumnExpression) leftExp;
+        metadata.setColumnExpression(columnExpression);
+        metadata.setExpression(rightExp);
+        metadata.setIncludeFilter(isIncludeFilter);
+        // If imei=imei comes in filter condition then we need to
+        // skip processing of right expression.
+        // This flow has reached here assuming that this is a single
+        // column expression.
+        // we need to check if the other expression contains column
+        // expression or not in depth.
+        CarbonDimension dimension = columnExpression.getDimension();
+        if (FilterUtil.checkIfExpressionContainsColumn(rightExp)
+            || FilterUtil.isExpressionNeedsToResolved(rightExp, isIncludeFilter) &&
+            dimension.hasEncoding(Encoding.DICTIONARY) && !dimension
+            .hasEncoding(Encoding.DIRECT_DICTIONARY)) {
+          isExpressionResolve = true;
+        } else {
+          //Visitor pattern is been used in this scenario inorder to populate the
+          // dimColResolvedFilterInfo
+          //visitable object with filter member values based on the visitor type, currently there
+          //3 types of visitors custom,direct and no dictionary, all types of visitor populate
+          //the visitable instance as per its buisness logic which is different for all the
+          // visitors.
+          dimColResolvedFilterInfo.populateFilterInfoBasedOnColumnType(
+              FilterInfoTypeVisitorFactory.getResolvedFilterInfoVisitor(columnExpression),
+              metadata);
+        }
+      } else if (rightExp instanceof ColumnExpression) {
+        ColumnExpression columnExpression = (ColumnExpression) rightExp;
+        metadata.setColumnExpression(columnExpression);
+        metadata.setExpression(leftExp);
+        metadata.setIncludeFilter(isIncludeFilter);
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
+          isExpressionResolve = true;
+        } else {
+          // if imei=imei comes in filter condition then we need to
+          // skip processing of right expression.
+          // This flow has reached here assuming that this is a single
+          // column expression.
+          // we need to check if the other expression contains column
+          // expression or not in depth.
+          if (FilterUtil.checkIfExpressionContainsColumn(leftExp)) {
+            isExpressionResolve = true;
+          } else {
+
+            dimColResolvedFilterInfo.populateFilterInfoBasedOnColumnType(
+                FilterInfoTypeVisitorFactory.getResolvedFilterInfoVisitor(columnExpression),
+                metadata);
+
+          }
+        }
+      } else {
+        isExpressionResolve = true;
+      }
+    }
+    if (isExpressionResolve && exp instanceof ConditionalExpression) {
+      ConditionalExpression conditionalExpression = (ConditionalExpression) exp;
+      List<ColumnExpression> columnList = conditionalExpression.getColumnList();
+      metadata.setColumnExpression(columnList.get(0));
+      metadata.setExpression(exp);
+      metadata.setIncludeFilter(isIncludeFilter);
+      if (!columnList.get(0).getDimension().hasEncoding(Encoding.DICTIONARY)) {
+        dimColResolvedFilterInfo.populateFilterInfoBasedOnColumnType(
+            FilterInfoTypeVisitorFactory.getResolvedFilterInfoVisitor(columnList.get(0)), metadata);
+
+      } else if (columnList.get(0).getDimension().hasEncoding(Encoding.DICTIONARY) && !(
+          columnList.get(0).getDimension().getDataType()
+              == org.apache.carbondata.core.carbon.metadata.datatype.DataType.STRUCT
+              || columnList.get(0).getDimension().getDataType()
+              == org.apache.carbondata.core.carbon.metadata.datatype.DataType.ARRAY)) {
+        dimColResolvedFilterInfo.setFilterValues(FilterUtil
+            .getFilterListForAllValues(absoluteTableIdentifier, exp, columnList.get(0),
+                isIncludeFilter));
+
+        dimColResolvedFilterInfo.setColumnIndex(columnList.get(0).getDimension().getOrdinal());
+        dimColResolvedFilterInfo.setDimension(columnList.get(0).getDimension());
+      }
+    }
+
+  }
+
+  /**
+   * Left node will not be presentin this scenario
+   *
+   * @return left node of type FilterResolverIntf instance
+   */
+  public FilterResolverIntf getLeft() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * Right node will not be presentin this scenario
+   *
+   * @return left node of type FilterResolverIntf instance
+   */
+  @Override public FilterResolverIntf getRight() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which consists
+   * the mapping of the respective dimension and its surrogates involved in
+   * filter expression.
+   *
+   * @return DimColumnResolvedFilterInfo
+   */
+  public DimColumnResolvedFilterInfo getDimColResolvedFilterInfo() {
+    return dimColResolvedFilterInfo;
+  }
+
+  /**
+   * method will calculates the start key based on the filter surrogates
+   */
+  public void getStartKey(long[] startKey,
+      SortedMap<Integer, byte[]> setOfStartKeyByteArray, List<long[]> startKeyList)
+      throws QueryExecutionException {
+    if (null == dimColResolvedFilterInfo.getStarIndexKey()) {
+      FilterUtil.getStartKey(dimColResolvedFilterInfo.getDimensionResolvedFilterInstance(),
+          startKey, startKeyList);
+      FilterUtil.getStartKeyForNoDictionaryDimension(dimColResolvedFilterInfo,
+          setOfStartKeyByteArray);
+    }
+  }
+
+  /**
+   * method will get the start key based on the filter surrogates
+   *
+   * @return end IndexKey
+   * @throws QueryExecutionException
+   */
+  @Override public void getEndKey(SegmentProperties segmentProperties,
+      AbsoluteTableIdentifier absoluteTableIdentifier, long[] endKeys,
+      SortedMap<Integer, byte[]> setOfEndKeyByteArray, List<long[]> endKeyList)
+      throws QueryExecutionException {
+    if (null == dimColResolvedFilterInfo.getEndIndexKey()) {
+      FilterUtil.getEndKey(dimColResolvedFilterInfo.getDimensionResolvedFilterInstance(),
+          absoluteTableIdentifier, endKeys, segmentProperties, endKeyList);
+      FilterUtil.getEndKeyForNoDictionaryDimension(dimColResolvedFilterInfo,
+          setOfEndKeyByteArray);
+    }
+  }
+
+  /**
+   * Method will return the executer type for particular conditional resolver
+   * basically two types of executers will be formed for the conditional query.
+   *
+   * @return the filter executer type
+   */
+  @Override public FilterExecuterType getFilterExecuterType() {
+    switch (exp.getFilterExpressionType()) {
+      case NOT_EQUALS:
+      case NOT_IN:
+        return FilterExecuterType.EXCLUDE;
+
+      default:
+        return FilterExecuterType.INCLUDE;
+    }
+
+  }
+
+  @Override public Expression getFilterExpression() {
+    // TODO Auto-generated method stub
+    return exp;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/FilterResolverIntf.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/FilterResolverIntf.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/FilterResolverIntf.java
new file mode 100644
index 0000000..cd108fb
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/FilterResolverIntf.java
@@ -0,0 +1,102 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+
+public interface FilterResolverIntf extends Serializable {
+
+  /**
+   * This API will resolve the filter expression and generates the
+   * dictionaries for executing/evaluating the filter expressions in the
+   * executer layer.
+   *
+   * @throws QueryExecutionException
+   * @throws FilterUnsupportedException
+   */
+  void resolve(AbsoluteTableIdentifier absoluteTableIdentifier) throws FilterUnsupportedException;
+
+  /**
+   * This API will provide the left column filter expression
+   * inorder to resolve the left expression filter.
+   *
+   * @return FilterResolverIntf
+   */
+  FilterResolverIntf getLeft();
+
+  /**
+   * API will provide the right column filter expression inorder to resolve
+   * the right expression filter.
+   *
+   * @return FilterResolverIntf
+   */
+  FilterResolverIntf getRight();
+
+  /**
+   * API will return the resolved filter instance, this instance will provide
+   * the resolved surrogates based on the applied filter
+   *
+   * @return DimColumnResolvedFilterInfo object
+   */
+  DimColumnResolvedFilterInfo getDimColResolvedFilterInfo();
+
+  /**
+   * API will get the start key based on the filter applied based on the key generator
+   *
+   * @param segmentProperties
+   * @param startKey
+   * @param setOfStartKeyByteArray
+   */
+  void getStartKey(long[] startKey, SortedMap<Integer, byte[]> setOfStartKeyByteArray,
+      List<long[]> startKeyList) throws QueryExecutionException;
+
+  /**
+   * API will read the end key based on the max surrogate of
+   * particular dimension column
+   *
+   * @param setOfEndKeyByteArray
+   * @param endKeys
+   * @return
+   * @throws QueryExecutionException
+   */
+  void getEndKey(SegmentProperties segmentProperties, AbsoluteTableIdentifier tableIdentifier,
+      long[] endKeys, SortedMap<Integer, byte[]> setOfEndKeyByteArray, List<long[]> endKeyList)
+      throws QueryExecutionException;
+
+  /**
+   * API will return the filter executer type which will be used to evaluate
+   * the resolved filter while query execution
+   *
+   * @return FilterExecuterType.
+   */
+  FilterExecuterType getFilterExecuterType();
+
+  Expression getFilterExpression();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/LogicalFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/LogicalFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/LogicalFilterResolverImpl.java
new file mode 100644
index 0000000..3ab3e25
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/LogicalFilterResolverImpl.java
@@ -0,0 +1,118 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.BinaryExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+
+public class LogicalFilterResolverImpl implements FilterResolverIntf {
+  /**
+   *
+   */
+  private static final long serialVersionUID = 5734382980564402914L;
+
+  protected FilterResolverIntf leftEvalutor;
+
+  protected FilterResolverIntf rightEvalutor;
+
+  protected ExpressionType filterExpressionType;
+
+  private BinaryExpression filterExpression;
+
+  public LogicalFilterResolverImpl(FilterResolverIntf leftEvalutor,
+      FilterResolverIntf rightEvalutor, BinaryExpression currentExpression) {
+    this.leftEvalutor = leftEvalutor;
+    this.rightEvalutor = rightEvalutor;
+    this.filterExpressionType = currentExpression.getFilterExpressionType();
+    this.filterExpression = currentExpression;
+  }
+
+  /**
+   * Logical filter resolver will return the left and right filter expresison
+   * node for filter evaluation, so in this instance no implementation is required.
+   *
+   * @param absoluteTableIdentifier
+   */
+  @Override public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier) {
+
+  }
+
+  /**
+   * Since its a binary condition expresion the getLeft method will get the left
+   * node of filter expression
+   *
+   * @return FilterResolverIntf.
+   */
+  public FilterResolverIntf getLeft() {
+    return leftEvalutor;
+  }
+
+  /**
+   * Since its a binary condition expresion the getRight method will get the left
+   * node of filter expression
+   *
+   * @return FilterResolverIntf.
+   */
+  public FilterResolverIntf getRight() {
+    return rightEvalutor;
+  }
+
+  @Override public DimColumnResolvedFilterInfo getDimColResolvedFilterInfo() {
+    return null;
+  }
+
+  @Override
+  public void getStartKey(long[] startKey, SortedMap<Integer, byte[]> setOfStartKeyByteArray,
+      List<long[]> startKeyList) throws QueryExecutionException {
+
+  }
+
+  @Override public void getEndKey(SegmentProperties segmentProperties,
+      AbsoluteTableIdentifier tableIdentifier, long[] endKeys,
+      SortedMap<Integer, byte[]> setOfEndKeyByteArray, List<long[]> endKeyList)
+      throws QueryExecutionException {
+
+  }
+
+  @Override public FilterExecuterType getFilterExecuterType() {
+    switch (filterExpressionType) {
+      case OR:
+        return FilterExecuterType.OR;
+      case AND:
+        return FilterExecuterType.AND;
+
+      default:
+        return null;
+    }
+  }
+
+  @Override public Expression getFilterExpression() {
+    return filterExpression;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
new file mode 100644
index 0000000..a674698
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
@@ -0,0 +1,206 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.conditional.BinaryConditionalExpression;
+import org.apache.carbondata.scan.expression.conditional.ConditionalExpression;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.FilterUtil;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+
+public class RestructureFilterResolverImpl implements FilterResolverIntf {
+  /**
+   *
+   */
+  private static final long serialVersionUID = -5399656036192814524L;
+
+  protected DimColumnResolvedFilterInfo dimColumnResolvedFilterInfo;
+
+  private Expression exp;
+
+  private String defaultValue;
+
+  private int surrogate;
+
+  private boolean isExpressionResolve;
+
+  private boolean isIncludeFilter;
+
+  public RestructureFilterResolverImpl(Expression exp, String defaultValue, int surrogate,
+      boolean isExpressionResolve, boolean isIncludeFilter) {
+    dimColumnResolvedFilterInfo = new DimColumnResolvedFilterInfo();
+    this.exp = exp;
+    this.defaultValue = defaultValue;
+    this.surrogate = surrogate;
+    this.isExpressionResolve = isExpressionResolve;
+    this.isIncludeFilter = isIncludeFilter;
+  }
+
+  /**
+   * Method will resolve the filters and it will replace the newly added dimension with default
+   * value
+   *
+   * @param absoluteTableIdentifier
+   * @throws FilterUnsupportedException
+   */
+  @Override public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier)
+      throws FilterUnsupportedException {
+
+    DimColumnResolvedFilterInfo dimColumnResolvedFilterInfo = new DimColumnResolvedFilterInfo();
+    if (!this.isExpressionResolve && exp instanceof BinaryConditionalExpression) {
+      BinaryConditionalExpression binaryConditionalExpression = (BinaryConditionalExpression) exp;
+      Expression left = binaryConditionalExpression.getLeft();
+      Expression right = binaryConditionalExpression.getRight();
+      if (left instanceof ColumnExpression) {
+        ColumnExpression columnExpression = (ColumnExpression) left;
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
+          isExpressionResolve = true;
+        } else {
+          // If imei=imei comes in filter condition then we need to
+          // skip processing of right expression.
+          // This flow has reached here assuming that this is a single
+          // column expression.
+          // we need to check if the other expression contains column
+          // expression or not in depth.
+          if (FilterUtil.checkIfExpressionContainsColumn(right)) {
+            isExpressionResolve = true;
+          } else {
+            dimColumnResolvedFilterInfo
+                .setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
+            dimColumnResolvedFilterInfo.setFilterValues(
+                FilterUtil.getFilterListForRS(right, columnExpression, defaultValue, surrogate));
+          }
+        }
+      } else if (right instanceof ColumnExpression) {
+        ColumnExpression columnExpression = (ColumnExpression) right;
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
+          isExpressionResolve = true;
+        } else {
+
+          // If imei=imei comes in filter condition then we need to
+          // skip processing of right expression.
+          // This flow has reached here assuming that this is a single
+          // column expression.
+          // we need to check if the other expression contains column
+          // expression or not in depth.
+          if (checkIfExpressionContainsColumn(left)) {
+            isExpressionResolve = true;
+          } else {
+            dimColumnResolvedFilterInfo
+                .setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
+            dimColumnResolvedFilterInfo.setFilterValues(
+                FilterUtil.getFilterListForRS(left, columnExpression, defaultValue, surrogate));
+          }
+        }
+      }
+    }
+    if (this.isExpressionResolve && exp instanceof ConditionalExpression) {
+      ConditionalExpression conditionalExpression = (ConditionalExpression) exp;
+      List<ColumnExpression> columnList = conditionalExpression.getColumnList();
+      dimColumnResolvedFilterInfo.setColumnIndex(columnList.get(0).getDimension().getOrdinal());
+      dimColumnResolvedFilterInfo.setFilterValues(FilterUtil
+          .getFilterListForAllMembersRS(exp, columnList.get(0), defaultValue, surrogate,
+              isIncludeFilter));
+    }
+
+  }
+
+  /**
+   * This method will check if a given expression contains a column expression recursively.
+   *
+   * @return boolean
+   */
+  private boolean checkIfExpressionContainsColumn(Expression expression) {
+    if (expression instanceof ColumnExpression) {
+      return true;
+    }
+    for (Expression child : expression.getChildren()) {
+      if (checkIfExpressionContainsColumn(child)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  @Override public FilterResolverIntf getLeft() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override public FilterResolverIntf getRight() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which consists
+   * the mapping of the respective dimension and its surrogates involved in
+   * filter expression.
+   *
+   * @return DimColumnResolvedFilterInfo
+   */
+  public DimColumnResolvedFilterInfo getDimColResolvedFilterInfo() {
+    return dimColumnResolvedFilterInfo;
+  }
+
+  /**
+   * For restructure resolver no implementation is required for getting
+   * the start key since it already has default values
+   */
+  @Override public void getStartKey(long[] startKeys,
+      SortedMap<Integer, byte[]> noDicStartKeys, List<long[]> startKeyList) {
+
+  }
+
+  /**
+   * For restructure resolver no implementation is required for getting
+   * the end  key since it already has default values
+   *
+   * @return IndexKey.
+   */
+  @Override public void getEndKey(SegmentProperties segmentProperties,
+      AbsoluteTableIdentifier tableIdentifier, long[] endKeys,
+      SortedMap<Integer, byte[]> noDicEndKeys, List<long[]> endKeyList) {
+  }
+
+  /**
+   * Method will get the executer type inorder to create filter executer tree
+   *
+   * @return FilterExecuterType
+   */
+  @Override public FilterExecuterType getFilterExecuterType() {
+    return FilterExecuterType.RESTRUCTURE;
+  }
+
+  @Override public Expression getFilterExpression() {
+    // TODO Auto-generated method stub
+    return exp;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelFilterResolverImpl.java
new file mode 100644
index 0000000..466d048
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelFilterResolverImpl.java
@@ -0,0 +1,141 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonMeasure;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.conditional.ConditionalExpression;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo;
+
+public class RowLevelFilterResolverImpl extends ConditionalFilterResolverImpl {
+
+  private static final long serialVersionUID = 176122729713729929L;
+  protected boolean isExpressionResolve;
+  protected boolean isIncludeFilter;
+
+  private List<DimColumnResolvedFilterInfo> dimColEvaluatorInfoList;
+  private List<MeasureColumnResolvedFilterInfo> msrColEvalutorInfoList;
+  private AbsoluteTableIdentifier tableIdentifier;
+
+  public RowLevelFilterResolverImpl(Expression exp, boolean isExpressionResolve,
+      boolean isIncludeFilter, AbsoluteTableIdentifier tableIdentifier) {
+    super(exp, isExpressionResolve, isIncludeFilter);
+    dimColEvaluatorInfoList =
+        new ArrayList<DimColumnResolvedFilterInfo>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    msrColEvalutorInfoList = new ArrayList<MeasureColumnResolvedFilterInfo>(
+        CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    this.tableIdentifier = tableIdentifier;
+  }
+
+  /**
+   * Method which will resolve the filter expression by converting the filter member
+   * to its assigned dictionary values.
+   */
+  public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier) {
+    DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = null;
+    MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = null;
+    int index = 0;
+    if (exp instanceof ConditionalExpression) {
+      ConditionalExpression conditionalExpression = (ConditionalExpression) exp;
+      List<ColumnExpression> columnList = conditionalExpression.getColumnList();
+      for (ColumnExpression columnExpression : columnList) {
+        if (columnExpression.isDimension()) {
+          dimColumnEvaluatorInfo = new DimColumnResolvedFilterInfo();
+          dimColumnEvaluatorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
+          dimColumnEvaluatorInfo.setRowIndex(index++);
+          dimColumnEvaluatorInfo.setDimension(columnExpression.getDimension());
+          dimColumnEvaluatorInfo.setDimensionExistsInCurrentSilce(false);
+          dimColEvaluatorInfoList.add(dimColumnEvaluatorInfo);
+        } else {
+          msrColumnEvalutorInfo = new MeasureColumnResolvedFilterInfo();
+          msrColumnEvalutorInfo.setRowIndex(index++);
+          msrColumnEvalutorInfo.setAggregator(
+              ((CarbonMeasure) columnExpression.getCarbonColumn()).getAggregateFunction());
+          msrColumnEvalutorInfo
+              .setColumnIndex(((CarbonMeasure) columnExpression.getCarbonColumn()).getOrdinal());
+          msrColumnEvalutorInfo.setType(columnExpression.getCarbonColumn().getDataType());
+          msrColEvalutorInfoList.add(msrColumnEvalutorInfo);
+        }
+      }
+    }
+  }
+
+  /**
+   * This method will provide the executer type to the callee inorder to identify
+   * the executer type for the filter resolution, Row level filter executer is a
+   * special executer since it get all the rows of the specified filter dimension
+   * and will be send to the spark for processing
+   */
+  @Override public FilterExecuterType getFilterExecuterType() {
+    return FilterExecuterType.ROWLEVEL;
+  }
+
+  /**
+   * Method will the read filter expression corresponding to the resolver.
+   * This method is required in row level executer inorder to evaluate the filter
+   * expression against spark, as mentioned above row level is a special type
+   * filter resolver.
+   *
+   * @return Expression
+   */
+  public Expression getFilterExpresion() {
+    return exp;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which consists
+   * the mapping of the respective dimension and its surrogates involved in
+   * filter expression.
+   *
+   * @return DimColumnResolvedFilterInfo
+   */
+  public List<DimColumnResolvedFilterInfo> getDimColEvaluatorInfoList() {
+    return dimColEvaluatorInfoList;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which containts
+   * measure level details.
+   *
+   * @return MeasureColumnResolvedFilterInfo
+   */
+  public List<MeasureColumnResolvedFilterInfo> getMsrColEvalutorInfoList() {
+    return msrColEvalutorInfoList;
+  }
+
+  /**
+   * Method will return table information which will be required for retrieving
+   * dictionary cache inorder to read all the members of respective dimension.
+   *
+   * @return AbsoluteTableIdentifier
+   */
+  public AbsoluteTableIdentifier getTableIdentifier() {
+    return tableIdentifier;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
new file mode 100644
index 0000000..0f9b47d
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
@@ -0,0 +1,287 @@
+/*
+ * 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.scan.filter.resolver;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.SortedMap;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.apache.carbondata.core.carbon.metadata.encoder.Encoding;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonMeasure;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
+import org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
+import org.apache.carbondata.core.util.ByteUtil;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.conditional.BinaryConditionalExpression;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.expression.logical.BinaryLogicalExpression;
+import org.apache.carbondata.scan.filter.DimColumnFilterInfo;
+import org.apache.carbondata.scan.filter.FilterUtil;
+import org.apache.carbondata.scan.filter.intf.FilterExecuterType;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo;
+
+public class RowLevelRangeFilterResolverImpl extends ConditionalFilterResolverImpl {
+
+  /**
+   *
+   */
+  private static final long serialVersionUID = 6629319265336666789L;
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(RowLevelRangeFilterResolverImpl.class.getName());
+  private List<DimColumnResolvedFilterInfo> dimColEvaluatorInfoList;
+  private List<MeasureColumnResolvedFilterInfo> msrColEvalutorInfoList;
+  private AbsoluteTableIdentifier tableIdentifier;
+
+  public RowLevelRangeFilterResolverImpl(Expression exp, boolean isExpressionResolve,
+      boolean isIncludeFilter, AbsoluteTableIdentifier tableIdentifier) {
+    super(exp, isExpressionResolve, isIncludeFilter);
+    dimColEvaluatorInfoList =
+        new ArrayList<DimColumnResolvedFilterInfo>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    msrColEvalutorInfoList = new ArrayList<MeasureColumnResolvedFilterInfo>(
+        CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    this.tableIdentifier = tableIdentifier;
+  }
+
+  /**
+   * This method will return the filter values which is present in the range level
+   * conditional expressions.
+   *
+   * @return
+   */
+  public byte[][] getFilterRangeValues(SegmentProperties segmentProperties) {
+
+    if (null != dimColEvaluatorInfoList.get(0).getFilterValues() && !dimColEvaluatorInfoList.get(0)
+        .getDimension().hasEncoding(Encoding.DICTIONARY)) {
+      List<byte[]> noDictFilterValuesList =
+          dimColEvaluatorInfoList.get(0).getFilterValues().getNoDictionaryFilterValuesList();
+      return noDictFilterValuesList.toArray((new byte[noDictFilterValuesList.size()][]));
+    } else if (null != dimColEvaluatorInfoList.get(0).getFilterValues() && dimColEvaluatorInfoList
+        .get(0).getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
+      return FilterUtil.getKeyArray(this.dimColEvaluatorInfoList.get(0).getFilterValues(),
+          this.dimColEvaluatorInfoList.get(0).getDimension(),
+          segmentProperties.getDimensionKeyGenerator());
+    }
+    return null;
+
+  }
+
+  /**
+   * method will get the start key based on the filter surrogates
+   *
+   * @return start IndexKey
+   */
+  public void getStartKey(long[] startKey,
+      SortedMap<Integer, byte[]> noDictStartKeys, List<long[]> startKeyList) {
+    if (null == dimColEvaluatorInfoList.get(0).getStarIndexKey()) {
+      try {
+        FilterUtil.getStartKey(dimColEvaluatorInfoList.get(0).getDimensionResolvedFilterInstance(),
+            startKey, startKeyList);
+        FilterUtil
+            .getStartKeyForNoDictionaryDimension(dimColEvaluatorInfoList.get(0), noDictStartKeys);
+      } catch (QueryExecutionException e) {
+        LOGGER.error("Can not get the start key during block prune");
+      }
+    }
+  }
+
+  /**
+   * method will get the start key based on the filter surrogates
+   *
+   * @return end IndexKey
+   */
+  @Override public void getEndKey(SegmentProperties segmentProperties,
+      AbsoluteTableIdentifier absoluteTableIdentifier, long[] endKeys,
+      SortedMap<Integer, byte[]> noDicEndKeys, List<long[]> endKeyList) {
+    if (null == dimColEvaluatorInfoList.get(0).getEndIndexKey()) {
+      try {
+        FilterUtil.getEndKey(dimColEvaluatorInfoList.get(0).getDimensionResolvedFilterInstance(),
+            absoluteTableIdentifier, endKeys, segmentProperties, endKeyList);
+        FilterUtil
+            .getEndKeyForNoDictionaryDimension(dimColEvaluatorInfoList.get(0), noDicEndKeys);
+      } catch (QueryExecutionException e) {
+        // TODO Auto-generated catch block
+        LOGGER.error("Can not get the end key during block prune");
+      }
+    }
+  }
+
+  private List<byte[]> getNoDictionaryRangeValues() {
+    List<ExpressionResult> listOfExpressionResults = new ArrayList<ExpressionResult>(20);
+    if (this.getFilterExpression() instanceof BinaryConditionalExpression) {
+      listOfExpressionResults =
+          ((BinaryConditionalExpression) this.getFilterExpression()).getLiterals();
+    }
+    List<byte[]> filterValuesList = new ArrayList<byte[]>(20);
+    boolean invalidRowsPresent = false;
+    for (ExpressionResult result : listOfExpressionResults) {
+      try {
+        if (result.getString() == null) {
+          filterValuesList.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL.getBytes());
+          continue;
+        }
+        filterValuesList.add(result.getString().getBytes());
+      } catch (FilterIllegalMemberException e) {
+        // Any invalid member while evaluation shall be ignored, system will log the
+        // error only once since all rows the evaluation happens so inorder to avoid
+        // too much log inforation only once the log will be printed.
+        FilterUtil.logError(e, invalidRowsPresent);
+      }
+    }
+    Comparator<byte[]> filterNoDictValueComaparator = new Comparator<byte[]>() {
+      @Override public int compare(byte[] filterMember1, byte[] filterMember2) {
+        return ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterMember1, filterMember2);
+      }
+
+    };
+    Collections.sort(filterValuesList, filterNoDictValueComaparator);
+    return filterValuesList;
+  }
+
+  /**
+   * Method which will resolve the filter expression by converting the filter
+   * member to its assigned dictionary values.
+   */
+  public void resolve(AbsoluteTableIdentifier absoluteTableIdentifier) {
+    DimColumnResolvedFilterInfo dimColumnEvaluatorInfo = null;
+    MeasureColumnResolvedFilterInfo msrColumnEvalutorInfo = null;
+    int index = 0;
+    if (exp instanceof BinaryLogicalExpression) {
+      BinaryLogicalExpression conditionalExpression = (BinaryLogicalExpression) exp;
+      List<ColumnExpression> columnList = conditionalExpression.getColumnList();
+      for (ColumnExpression columnExpression : columnList) {
+        if (columnExpression.isDimension()) {
+          dimColumnEvaluatorInfo = new DimColumnResolvedFilterInfo();
+          DimColumnFilterInfo filterInfo = new DimColumnFilterInfo();
+          dimColumnEvaluatorInfo.setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
+          //dimColumnEvaluatorInfo.se
+          dimColumnEvaluatorInfo.setRowIndex(index++);
+          dimColumnEvaluatorInfo.setDimension(columnExpression.getDimension());
+          dimColumnEvaluatorInfo.setDimensionExistsInCurrentSilce(false);
+          if (columnExpression.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
+            filterInfo.setFilterList(getDirectSurrogateValues(columnExpression));
+          } else {
+            filterInfo.setFilterListForNoDictionaryCols(getNoDictionaryRangeValues());
+          }
+          filterInfo.setIncludeFilter(isIncludeFilter);
+          dimColumnEvaluatorInfo.setFilterValues(filterInfo);
+          dimColumnEvaluatorInfo
+              .addDimensionResolvedFilterInstance(columnExpression.getDimension(), filterInfo);
+          dimColEvaluatorInfoList.add(dimColumnEvaluatorInfo);
+        } else {
+          msrColumnEvalutorInfo = new MeasureColumnResolvedFilterInfo();
+          msrColumnEvalutorInfo.setRowIndex(index++);
+          msrColumnEvalutorInfo.setAggregator(
+              ((CarbonMeasure) columnExpression.getCarbonColumn()).getAggregateFunction());
+          msrColumnEvalutorInfo
+              .setColumnIndex(((CarbonMeasure) columnExpression.getCarbonColumn()).getOrdinal());
+          msrColumnEvalutorInfo.setType(columnExpression.getCarbonColumn().getDataType());
+          msrColEvalutorInfoList.add(msrColumnEvalutorInfo);
+        }
+      }
+    }
+  }
+
+  private List<Integer> getDirectSurrogateValues(ColumnExpression columnExpression) {
+    List<ExpressionResult> listOfExpressionResults = new ArrayList<ExpressionResult>(20);
+    DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
+        .getDirectDictionaryGenerator(columnExpression.getDimension().getDataType());
+
+    if (this.getFilterExpression() instanceof BinaryConditionalExpression) {
+      listOfExpressionResults =
+          ((BinaryConditionalExpression) this.getFilterExpression()).getLiterals();
+    }
+    List<Integer> filterValuesList = new ArrayList<Integer>(20);
+    try {
+      // if any filter member provided by user is invalid throw error else
+      // system can display inconsistent result.
+      for (ExpressionResult result : listOfExpressionResults) {
+        filterValuesList.add(directDictionaryGenerator
+            .generateDirectSurrogateKey(result.getString(),
+                CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
+      }
+    } catch (FilterIllegalMemberException e) {
+      new FilterUnsupportedException(e);
+    }
+    return filterValuesList;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which consists
+   * the mapping of the respective dimension and its surrogates involved in
+   * filter expression.
+   *
+   * @return DimColumnResolvedFilterInfo
+   */
+  public List<DimColumnResolvedFilterInfo> getDimColEvaluatorInfoList() {
+    return dimColEvaluatorInfoList;
+  }
+
+  /**
+   * Method will return the DimColumnResolvedFilterInfo instance which containts
+   * measure level details.
+   *
+   * @return MeasureColumnResolvedFilterInfo
+   */
+  public List<MeasureColumnResolvedFilterInfo> getMsrColEvalutorInfoList() {
+    return msrColEvalutorInfoList;
+  }
+
+  public AbsoluteTableIdentifier getTableIdentifier() {
+    return tableIdentifier;
+  }
+
+  public Expression getFilterExpression() {
+    return this.exp;
+  }
+
+  /**
+   * This method will provide the executer type to the callee inorder to identify
+   * the executer type for the filter resolution, Row level filter executer is a
+   * special executer since it get all the rows of the specified filter dimension
+   * and will be send to the spark for processing
+   */
+  public FilterExecuterType getFilterExecuterType() {
+    switch (exp.getFilterExpressionType()) {
+      case GREATERTHAN:
+        return FilterExecuterType.ROWLEVEL_GREATERTHAN;
+      case GREATERTHAN_EQUALTO:
+        return FilterExecuterType.ROWLEVEL_GREATERTHAN_EQUALTO;
+      case LESSTHAN:
+        return FilterExecuterType.ROWLEVEL_LESSTHAN;
+      case LESSTHAN_EQUALTO:
+        return FilterExecuterType.ROWLEVEL_LESSTHAN_EQUALTO;
+
+      default:
+        return FilterExecuterType.ROWLEVEL;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/metadata/FilterResolverMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/metadata/FilterResolverMetadata.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/metadata/FilterResolverMetadata.java
new file mode 100644
index 0000000..cabba34
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/metadata/FilterResolverMetadata.java
@@ -0,0 +1,62 @@
+/*
+ * 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.scan.filter.resolver.metadata;
+
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+
+public class FilterResolverMetadata {
+  private AbsoluteTableIdentifier tableIdentifier;
+  private Expression expression;
+  private ColumnExpression columnExpression;
+  private boolean isIncludeFilter;
+
+  public AbsoluteTableIdentifier getTableIdentifier() {
+    return tableIdentifier;
+  }
+
+  public void setTableIdentifier(AbsoluteTableIdentifier tableIdentifier) {
+    this.tableIdentifier = tableIdentifier;
+  }
+
+  public Expression getExpression() {
+    return expression;
+  }
+
+  public void setExpression(Expression expression) {
+    this.expression = expression;
+  }
+
+  public ColumnExpression getColumnExpression() {
+    return columnExpression;
+  }
+
+  public void setColumnExpression(ColumnExpression columnExpression) {
+    this.columnExpression = columnExpression;
+  }
+
+  public boolean isIncludeFilter() {
+    return isIncludeFilter;
+  }
+
+  public void setIncludeFilter(boolean isIncludeFilter) {
+    this.isIncludeFilter = isIncludeFilter;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/DimColumnResolvedFilterInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/DimColumnResolvedFilterInfo.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/DimColumnResolvedFilterInfo.java
new file mode 100644
index 0000000..bf61d85
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/DimColumnResolvedFilterInfo.java
@@ -0,0 +1,194 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.carbondata.core.carbon.datastore.IndexKey;
+import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.DimColumnFilterInfo;
+import org.apache.carbondata.scan.filter.resolver.metadata.FilterResolverMetadata;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.visitable.ResolvedFilterInfoVisitable;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.visitor.ResolvedFilterInfoVisitorIntf;
+
+public class DimColumnResolvedFilterInfo implements Serializable, ResolvedFilterInfoVisitable {
+  /**
+   *
+   */
+  private static final long serialVersionUID = 3428115141211084114L;
+
+  /**
+   * column index in file
+   */
+  private int columnIndex = -1;
+
+  /**
+   * need compressed data from file
+   */
+  private boolean needCompressedData;
+
+  /**
+   * rowIndex
+   */
+  private int rowIndex = -1;
+
+  private boolean isDimensionExistsInCurrentSilce = true;
+
+  private int rsSurrogates;
+
+  private String defaultValue;
+
+  private CarbonDimension dimension;
+
+  /**
+   * start index key of the block based on the keygenerator
+   */
+  private transient IndexKey starIndexKey;
+
+  /**
+   * end index key  which is been formed considering the max surrogate values
+   * from dictionary cache
+   */
+  private transient IndexKey endIndexKey;
+
+  /**
+   * reolved filter object of a particlar filter Expression.
+   */
+  private DimColumnFilterInfo resolvedFilterValueObj;
+
+  private Map<CarbonDimension, List<DimColumnFilterInfo>> dimensionResolvedFilter;
+
+  public DimColumnResolvedFilterInfo() {
+    dimensionResolvedFilter = new HashMap<CarbonDimension, List<DimColumnFilterInfo>>(20);
+  }
+
+  public IndexKey getStarIndexKey() {
+    return starIndexKey;
+  }
+
+  public void setStarIndexKey(IndexKey starIndexKey) {
+    this.starIndexKey = starIndexKey;
+  }
+
+  public IndexKey getEndIndexKey() {
+    return endIndexKey;
+  }
+
+  public void setEndIndexKey(IndexKey endIndexKey) {
+    this.endIndexKey = endIndexKey;
+  }
+
+  public void addDimensionResolvedFilterInstance(CarbonDimension dimension,
+      DimColumnFilterInfo filterResolvedObj) {
+    List<DimColumnFilterInfo> currentVals = dimensionResolvedFilter.get(dimension);
+    if (null == currentVals) {
+      currentVals = new ArrayList<DimColumnFilterInfo>(20);
+      currentVals.add(filterResolvedObj);
+      dimensionResolvedFilter.put(dimension, currentVals);
+    } else {
+      currentVals.add(filterResolvedObj);
+    }
+  }
+
+  public Map<CarbonDimension, List<DimColumnFilterInfo>> getDimensionResolvedFilterInstance() {
+    return dimensionResolvedFilter;
+  }
+
+  public CarbonDimension getDimension() {
+    return dimension;
+  }
+
+  public void setDimension(CarbonDimension dimension) {
+    this.dimension = dimension;
+  }
+
+  public int getColumnIndex() {
+    return columnIndex;
+  }
+
+  public void setColumnIndex(int columnIndex) {
+    this.columnIndex = columnIndex;
+  }
+
+  public boolean isNeedCompressedData() {
+    return needCompressedData;
+  }
+
+  public void setNeedCompressedData(boolean needCompressedData) {
+    this.needCompressedData = needCompressedData;
+  }
+
+  public DimColumnFilterInfo getFilterValues() {
+    return resolvedFilterValueObj;
+  }
+
+  public void setFilterValues(final DimColumnFilterInfo resolvedFilterValueObj) {
+    this.resolvedFilterValueObj = resolvedFilterValueObj;
+  }
+
+  public int getRowIndex() {
+    return rowIndex;
+  }
+
+  public void setRowIndex(int rowIndex) {
+    this.rowIndex = rowIndex;
+  }
+
+  public boolean isDimensionExistsInCurrentSilce() {
+    return isDimensionExistsInCurrentSilce;
+  }
+
+  public void setDimensionExistsInCurrentSilce(boolean isDimensionExistsInCurrentSilce) {
+    this.isDimensionExistsInCurrentSilce = isDimensionExistsInCurrentSilce;
+  }
+
+  public int getRsSurrogates() {
+    return rsSurrogates;
+  }
+
+  public void setRsSurrogates(int rsSurrogates) {
+    this.rsSurrogates = rsSurrogates;
+  }
+
+  public String getDefaultValue() {
+    return defaultValue;
+  }
+
+  public void setDefaultValue(String defaultValue) {
+    this.defaultValue = defaultValue;
+  }
+
+  @Override public void populateFilterInfoBasedOnColumnType(ResolvedFilterInfoVisitorIntf visitor,
+      FilterResolverMetadata metadata) throws FilterUnsupportedException {
+    if (null != visitor) {
+      visitor.populateFilterResolvedInfo(this, metadata);
+      this.addDimensionResolvedFilterInstance(metadata.getColumnExpression().getDimension(),
+          this.getFilterValues());
+      this.setDimension(metadata.getColumnExpression().getDimension());
+      this.setColumnIndex(metadata.getColumnExpression().getDimension().getOrdinal());
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/MeasureColumnResolvedFilterInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/MeasureColumnResolvedFilterInfo.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/MeasureColumnResolvedFilterInfo.java
new file mode 100644
index 0000000..8055ae9
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/MeasureColumnResolvedFilterInfo.java
@@ -0,0 +1,105 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo;
+
+import java.io.Serializable;
+
+public class MeasureColumnResolvedFilterInfo implements Serializable {
+  /**
+   *
+   */
+  private static final long serialVersionUID = 4222568289115151561L;
+
+  private int columnIndex = -1;
+
+  private int rowIndex = -1;
+
+  private Object uniqueValue;
+
+  private String aggregator;
+
+  private boolean isMeasureExistsInCurrentSlice = true;
+
+  private Object defaultValue;
+
+  private org.apache.carbondata.core.carbon.metadata.datatype.DataType type;
+
+  public int getColumnIndex() {
+    return columnIndex;
+  }
+
+  public void setColumnIndex(int columnIndex) {
+    this.columnIndex = columnIndex;
+  }
+
+  public int getRowIndex() {
+    return rowIndex;
+  }
+
+  public void setRowIndex(int rowIndex) {
+    this.rowIndex = rowIndex;
+  }
+
+  public Object getUniqueValue() {
+    return uniqueValue;
+  }
+
+  public void setUniqueValue(Object uniqueValue) {
+    this.uniqueValue = uniqueValue;
+  }
+
+  public org.apache.carbondata.core.carbon.metadata.datatype.DataType getType() {
+    return type;
+  }
+
+  public void setType(org.apache.carbondata.core.carbon.metadata.datatype.DataType dataType) {
+    this.type = dataType;
+  }
+
+  /**
+   * @return Returns the aggregator.
+   */
+  public String getAggregator() {
+    return aggregator;
+  }
+
+  /**
+   * @param aggregator The aggregator to set.
+   */
+  public void setAggregator(String aggregator) {
+    this.aggregator = aggregator;
+  }
+
+  public boolean isMeasureExistsInCurrentSlice() {
+    return isMeasureExistsInCurrentSlice;
+  }
+
+  public void setMeasureExistsInCurrentSlice(boolean isMeasureExistsInCurrentSlice) {
+    this.isMeasureExistsInCurrentSlice = isMeasureExistsInCurrentSlice;
+  }
+
+  public Object getDefaultValue() {
+    return defaultValue;
+  }
+
+  public void setDefaultValue(double defaultValue) {
+    this.defaultValue = defaultValue;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitable/ResolvedFilterInfoVisitable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitable/ResolvedFilterInfoVisitable.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitable/ResolvedFilterInfoVisitable.java
new file mode 100644
index 0000000..bb71b96
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitable/ResolvedFilterInfoVisitable.java
@@ -0,0 +1,38 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo.visitable;
+
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.resolver.metadata.FilterResolverMetadata;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.visitor.ResolvedFilterInfoVisitorIntf;
+
+public interface ResolvedFilterInfoVisitable {
+  /**
+   * This visitable method will visit through the visitor classes which is passed as parameter
+   * and based on different visitor the visitable filter instance will be resolved.
+   *
+   * @param visitor
+   * @param metadata
+   * @throws QueryExecutionException
+   * @throws FilterUnsupportedException
+   */
+  void populateFilterInfoBasedOnColumnType(ResolvedFilterInfoVisitorIntf visitor,
+      FilterResolverMetadata metadata) throws FilterUnsupportedException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/CustomTypeDictionaryVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/CustomTypeDictionaryVisitor.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/CustomTypeDictionaryVisitor.java
new file mode 100644
index 0000000..3b2ec99
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/CustomTypeDictionaryVisitor.java
@@ -0,0 +1,110 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo.visitor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
+import org.apache.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.DimColumnFilterInfo;
+import org.apache.carbondata.scan.filter.FilterUtil;
+import org.apache.carbondata.scan.filter.resolver.metadata.FilterResolverMetadata;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+
+public class CustomTypeDictionaryVisitor implements ResolvedFilterInfoVisitorIntf {
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CustomTypeDictionaryVisitor.class.getName());
+
+  /**
+   * This Visitor method is been used to resolve or populate the filter details
+   * by using custom type dictionary value, the filter membrers will be resolved using
+   * custom type function which will generate dictionary for the direct column type filter members
+   *
+   * @param visitableObj
+   * @param metadata
+   * @throws FilterUnsupportedException,if exception occurs while evaluating
+   * filter models.
+   */
+  public void populateFilterResolvedInfo(DimColumnResolvedFilterInfo visitableObj,
+      FilterResolverMetadata metadata) throws FilterUnsupportedException {
+    DimColumnFilterInfo resolvedFilterObject = null;
+
+    List<String> evaluateResultListFinal;
+    try {
+      evaluateResultListFinal = metadata.getExpression().evaluate(null).getListAsString();
+    } catch (FilterIllegalMemberException e) {
+      throw new FilterUnsupportedException(e);
+    }
+    boolean isNotTimestampType = FilterUtil.checkIfDataTypeNotTimeStamp(metadata.getExpression());
+    resolvedFilterObject = getDirectDictionaryValKeyMemberForFilter(metadata.getTableIdentifier(),
+        metadata.getColumnExpression(), evaluateResultListFinal, metadata.isIncludeFilter(),
+        isNotTimestampType);
+    if (!metadata.isIncludeFilter() && null != resolvedFilterObject && !resolvedFilterObject
+        .getFilterList().contains(CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY)) {
+      // Adding default surrogate key of null member inorder to not display the same while
+      // displaying the report as per hive compatibility.
+      resolvedFilterObject.getFilterList()
+          .add(CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY);
+      Collections.sort(resolvedFilterObject.getFilterList());
+    }
+    visitableObj.setFilterValues(resolvedFilterObject);
+  }
+
+  private DimColumnFilterInfo getDirectDictionaryValKeyMemberForFilter(
+      AbsoluteTableIdentifier tableIdentifier, ColumnExpression columnExpression,
+      List<String> evaluateResultListFinal, boolean isIncludeFilter, boolean isNotTimestampType) {
+    List<Integer> surrogates = new ArrayList<Integer>(20);
+    DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
+        .getDirectDictionaryGenerator(columnExpression.getDimension().getDataType());
+    // Reading the dictionary value direct
+    getSurrogateValuesForDictionary(evaluateResultListFinal, surrogates, isNotTimestampType,
+        directDictionaryGenerator);
+
+    Collections.sort(surrogates);
+    DimColumnFilterInfo columnFilterInfo = null;
+    if (surrogates.size() > 0) {
+      columnFilterInfo = new DimColumnFilterInfo();
+      columnFilterInfo.setIncludeFilter(isIncludeFilter);
+      columnFilterInfo.setFilterList(surrogates);
+    }
+    return columnFilterInfo;
+  }
+
+  private void getSurrogateValuesForDictionary(List<String> evaluateResultListFinal,
+      List<Integer> surrogates, boolean isNotTimestampType,
+      DirectDictionaryGenerator directDictionaryGenerator) {
+    String timeFormat = CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT;
+    if (isNotTimestampType) {
+      timeFormat = null;
+    }
+    for (String filterMember : evaluateResultListFinal) {
+      surrogates
+          .add(directDictionaryGenerator.generateDirectSurrogateKey(filterMember, timeFormat));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/DictionaryColumnVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/DictionaryColumnVisitor.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/DictionaryColumnVisitor.java
new file mode 100644
index 0000000..6cb2348
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/DictionaryColumnVisitor.java
@@ -0,0 +1,74 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo.visitor;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.scan.executor.exception.QueryExecutionException;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.DimColumnFilterInfo;
+import org.apache.carbondata.scan.filter.FilterUtil;
+import org.apache.carbondata.scan.filter.resolver.metadata.FilterResolverMetadata;
+import org.apache.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
+
+public class DictionaryColumnVisitor implements ResolvedFilterInfoVisitorIntf {
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(DictionaryColumnVisitor.class.getName());
+
+  /**
+   * This Visitor method is used to populate the visitableObj with direct dictionary filter details
+   * where the filters values will be resolve using dictionary cache.
+   *
+   * @param visitableObj
+   * @param metadata
+   * @throws FilterUnsupportedException,if exception occurs while evaluating
+   * filter models.
+   * @throws QueryExecutionException
+   */
+  public void populateFilterResolvedInfo(DimColumnResolvedFilterInfo visitableObj,
+      FilterResolverMetadata metadata) throws FilterUnsupportedException {
+    DimColumnFilterInfo resolvedFilterObject = null;
+    List<String> evaluateResultListFinal;
+    try {
+      evaluateResultListFinal = metadata.getExpression().evaluate(null).getListAsString();
+    } catch (FilterIllegalMemberException e) {
+      throw new FilterUnsupportedException(e);
+    }
+    try {
+      resolvedFilterObject = FilterUtil
+          .getFilterValues(metadata.getTableIdentifier(), metadata.getColumnExpression(),
+              evaluateResultListFinal, metadata.isIncludeFilter());
+      if (!metadata.isIncludeFilter() && null != resolvedFilterObject) {
+        // Adding default surrogate key of null member inorder to not display the same while
+        // displaying the report as per hive compatibility.
+        resolvedFilterObject.getFilterList()
+            .add(CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY);
+        Collections.sort(resolvedFilterObject.getFilterList());
+      }
+    } catch (QueryExecutionException e) {
+      throw new FilterUnsupportedException(e);
+    }
+    visitableObj.setFilterValues(resolvedFilterObject);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/FilterInfoTypeVisitorFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/FilterInfoTypeVisitorFactory.java b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/FilterInfoTypeVisitorFactory.java
new file mode 100644
index 0000000..986bedc
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/visitor/FilterInfoTypeVisitorFactory.java
@@ -0,0 +1,45 @@
+/*
+ * 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.scan.filter.resolver.resolverinfo.visitor;
+
+import org.apache.carbondata.core.carbon.metadata.encoder.Encoding;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+
+public class FilterInfoTypeVisitorFactory {
+
+  /**
+   * This factory method will be used in order to get the visitor instance based on the
+   * column expression metadata where filters has been applied.
+   *
+   * @param columnExpression
+   * @return
+   */
+  public static ResolvedFilterInfoVisitorIntf getResolvedFilterInfoVisitor(
+      ColumnExpression columnExpression) {
+    if (columnExpression.getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
+      return new CustomTypeDictionaryVisitor();
+    } else if (!columnExpression.getDimension().hasEncoding(Encoding.DICTIONARY)) {
+      return new NoDictionaryTypeVisitor();
+    } else if (columnExpression.getDimension().hasEncoding(Encoding.DICTIONARY)) {
+      return new DictionaryColumnVisitor();
+    }
+
+    return null;
+  }
+}


Mime
View raw message