carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [25/57] [abbrv] incubator-carbondata git commit: move org.apache.carbon.common in core
Date Sat, 14 Jan 2017 07:57:34 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
new file mode 100644
index 0000000..c3a0949
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
@@ -0,0 +1,545 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additiona   l 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 java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+
+public class ExpressionResult implements Comparable<ExpressionResult> {
+
+  protected DataType dataType;
+
+  protected Object value;
+
+  private List<ExpressionResult> expressionResults;
+
+  private boolean isLiteral = false;
+
+  public ExpressionResult(DataType dataType, Object value) {
+    this.dataType = dataType;
+    this.value = value;
+  }
+
+  public ExpressionResult(DataType dataType, Object value, boolean isLiteral) {
+    this(dataType, value);
+    this.isLiteral = isLiteral;
+  }
+
+  public ExpressionResult(List<ExpressionResult> expressionResults) {
+    this.expressionResults = expressionResults;
+  }
+
+  public void set(DataType dataType, Object value) {
+    this.dataType = dataType;
+    this.value = value;
+    this.expressionResults = null;
+  }
+
+  public DataType getDataType() {
+    return dataType;
+  }
+
+  public Integer getInt() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return Integer.parseInt(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+        case SHORT:
+          return ((Short) value).intValue();
+        case INT:
+        case DOUBLE:
+          if (value instanceof Double) {
+            return ((Double) value).intValue();
+          }
+          if (value instanceof Long) {
+            return ((Long) value).intValue();
+          }
+          return (Integer) value;
+        case DATE:
+          if (value instanceof java.sql.Date) {
+            return (int) (((java.sql.Date) value).getTime());
+          } else {
+            return (Integer) value;
+          }
+        case TIMESTAMP:
+          if (value instanceof Timestamp) {
+            return (int) (((Timestamp) value).getTime());
+          } else {
+            if (isLiteral) {
+              Long l = (Long) value /1000;
+              return l.intValue();
+            }
+            return (Integer) value;
+          }
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to integer type value");
+      }
+
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Integer type value");
+    }
+  }
+
+  public Short getShort() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return Short.parseShort(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+        case SHORT:
+        case INT:
+        case DOUBLE:
+
+          if (value instanceof Double) {
+            return ((Double) value).shortValue();
+          } else if (value instanceof Integer) {
+            return ((Integer) value).shortValue();
+          }
+          return (Short) value;
+
+        case DATE:
+
+          if (value instanceof java.sql.Date) {
+            return (short) (((java.sql.Date) value).getTime());
+          } else {
+            return (Short) value;
+          }
+        case TIMESTAMP:
+
+          if (value instanceof Timestamp) {
+            return (short) (((Timestamp) value).getTime());
+          } else {
+            if (isLiteral) {
+              Long l = ((long)value/1000);
+              return l.shortValue();
+            }
+            return (Short) value;
+          }
+
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to integer type value");
+      }
+
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Integer type value");
+    }
+  }
+
+  public String getString() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case DATE:
+        case TIMESTAMP:
+          SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
+              .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
+                  CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
+          if (value instanceof Timestamp) {
+            return parser.format((Timestamp) value);
+          } else if (value instanceof java.sql.Date) {
+            return parser.format((java.sql.Date) value);
+          } else if (value instanceof Long) {
+            if (isLiteral) {
+              return parser.format(new Timestamp((long) value/1000));
+            }
+            return parser.format(new Timestamp((long) value));
+          } else if (value instanceof Integer) {
+            return parser.format(new java.sql.Date((int)value));
+          }
+          return value.toString();
+        default:
+          return value.toString();
+      }
+    } catch (Exception e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to String type value");
+    }
+  }
+
+  public Double getDouble() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return Double.parseDouble(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+        case SHORT:
+          return ((Short) value).doubleValue();
+        case INT:
+          return ((Integer) value).doubleValue();
+        case LONG:
+          return ((Long) value).doubleValue();
+        case DOUBLE:
+          return (Double) value;
+        case DATE:
+          if (value instanceof java.sql.Date) {
+            return (double) ((java.sql.Date) value).getTime();
+          } else {
+            return (Double) (value);
+          }
+        case TIMESTAMP:
+          if (value instanceof Timestamp) {
+            return (double) ((Timestamp) value).getTime();
+          } else {
+            if (isLiteral) {
+              Long l = (Long) value/1000;
+              return l.doubleValue();
+            }
+            return (Double) (value);
+          }
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to double type value");
+      }
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Double type value");
+    }
+  }
+
+  public Long getLong() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return Long.parseLong(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+        case SHORT:
+          return ((Short) value).longValue();
+        case INT:
+          return (Long) value;
+        case LONG:
+          return (Long) value;
+        case DOUBLE:
+          return (Long) value;
+        case DATE:
+          if (value instanceof java.sql.Date) {
+            return ((java.sql.Date) value).getTime();
+          } else {
+            return (Long) value;
+          }
+        case TIMESTAMP:
+          if (value instanceof Timestamp) {
+            return ((Timestamp) value).getTime();
+          } else {
+            return (Long) value;
+          }
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to Long type value");
+      }
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Long type value");
+    }
+
+  }
+
+  //Add to judge for BigDecimal
+  public BigDecimal getDecimal() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return new BigDecimal(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+        case SHORT:
+          return new BigDecimal((short) value);
+        case INT:
+          return new BigDecimal((int) value);
+        case LONG:
+          return new BigDecimal((long) value);
+        case DOUBLE:
+          return new BigDecimal(value.toString());
+        case DECIMAL:
+          return new BigDecimal(value.toString());
+        case DATE:
+          if (value instanceof java.sql.Date) {
+            return new BigDecimal(((java.sql.Date) value).getTime());
+          } else {
+            return new BigDecimal((long) value);
+          }
+        case TIMESTAMP:
+          if (value instanceof Timestamp) {
+            return new BigDecimal(((Timestamp) value).getTime());
+          } else {
+            if (isLiteral) {
+              return new BigDecimal((long)value/1000);
+            }
+            return new BigDecimal((long) value);
+          }
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to Long type value");
+      }
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Long type value");
+    }
+
+  }
+
+  public Long getTime() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          // Currently the query engine layer only supports yyyy-MM-dd HH:mm:ss date format
+          // no matter in which format the data is been stored, so while retrieving the direct
+          // surrogate value for filter member first it should be converted in date form as per
+          // above format and needs to retrieve time stamp.
+          SimpleDateFormat parser =
+              new SimpleDateFormat(CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT);
+          Date dateToStr;
+          try {
+            dateToStr = parser.parse(value.toString());
+            return dateToStr.getTime();
+          } catch (ParseException e) {
+            throw new FilterIllegalMemberException(
+                "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
+          }
+        case SHORT:
+          return ((Short) value).longValue();
+        case INT:
+        case LONG:
+          return (Long) value;
+        case DOUBLE:
+          return (Long) value;
+        case DATE:
+          if (value instanceof java.sql.Date) {
+            return ((Date) value).getTime();
+          } else {
+            return (Long) value;
+          }
+        case TIMESTAMP:
+          if (value instanceof Timestamp) {
+            return ((Timestamp) value).getTime();
+          } else {
+            if (isLiteral) {
+              return (Long) value/1000;
+            }
+            return (Long) value;
+          }
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
+      }
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
+    }
+
+  }
+
+  public Boolean getBoolean() throws FilterIllegalMemberException {
+    if (value == null) {
+      return null;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          try {
+            return Boolean.parseBoolean(value.toString());
+          } catch (NumberFormatException e) {
+            throw new FilterIllegalMemberException(e);
+          }
+
+        case BOOLEAN:
+          return Boolean.parseBoolean(value.toString());
+
+        default:
+          throw new FilterIllegalMemberException(
+              "Cannot convert" + this.getDataType().name() + " to boolean type value");
+      }
+    } catch (ClassCastException e) {
+      throw new FilterIllegalMemberException(
+          "Cannot convert" + this.getDataType().name() + " to Boolean type value");
+    }
+  }
+
+  public List<ExpressionResult> getList() {
+    if (null == expressionResults) {
+      List<ExpressionResult> a = new ArrayList<ExpressionResult>(20);
+      a.add(new ExpressionResult(dataType, value, isLiteral));
+      return a;
+    } else {
+      return expressionResults;
+    }
+  }
+
+  public List<String> getListAsString() throws FilterIllegalMemberException {
+    List<String> evaluateResultListFinal = new ArrayList<String>(20);
+    List<ExpressionResult> evaluateResultList = getList();
+    for (ExpressionResult result : evaluateResultList) {
+      String resultString = result.getString();
+      if (resultString == null) {
+        evaluateResultListFinal.add(CarbonCommonConstants.MEMBER_DEFAULT_VAL);
+        continue;
+      }
+      evaluateResultListFinal.add(resultString);
+    }
+    return evaluateResultListFinal;
+  }
+
+  @Override public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    if (null != expressionResults) {
+      result = prime * result + expressionResults.hashCode();
+    } else if (null != value) {
+      result = prime * result + value.toString().hashCode();
+    } else {
+      result = prime * result + "".hashCode();
+    }
+
+    return result;
+  }
+
+  @Override public boolean equals(Object obj) {
+    if (!(obj instanceof ExpressionResult)) {
+      return false;
+    }
+    if (this == obj) {
+      return true;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    ExpressionResult objToCompare = (ExpressionResult) obj;
+    boolean result = false;
+    if (this.value == objToCompare.value) {
+      return true;
+    }
+    try {
+      switch (this.getDataType()) {
+        case STRING:
+          result = this.getString().equals(objToCompare.getString());
+          break;
+        case SHORT:
+          result = this.getShort().equals(objToCompare.getShort());
+          break;
+        case INT:
+          result = this.getInt().equals(objToCompare.getInt());
+          break;
+        case LONG:
+        case DATE:
+        case TIMESTAMP:
+          result = this.getLong().equals(objToCompare.getLong());
+          break;
+        case DOUBLE:
+          result = this.getDouble().equals(objToCompare.getDouble());
+          break;
+        case DECIMAL:
+          result = this.getDecimal().equals(objToCompare.getDecimal());
+          break;
+        default:
+          break;
+      }
+    } catch (FilterIllegalMemberException ex) {
+      return false;
+    }
+
+    return result;
+  }
+
+  public boolean isNull() {
+    return value == null;
+  }
+
+  @Override public int compareTo(ExpressionResult o) {
+    try {
+      switch (o.dataType) {
+        case SHORT:
+        case INT:
+        case LONG:
+        case DOUBLE:
+          Double d1 = this.getDouble();
+          Double d2 = o.getDouble();
+          return d1.compareTo(d2);
+        case DECIMAL:
+          java.math.BigDecimal val1 = this.getDecimal();
+          java.math.BigDecimal val2 = o.getDecimal();
+          return val1.compareTo(val2);
+        case DATE:
+        case TIMESTAMP:
+          SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
+              .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
+                  CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
+          Date date1 = null;
+          Date date2 = null;
+          date1 = parser.parse(this.getString());
+          date2 = parser.parse(o.getString());
+          return date1.compareTo(date2);
+        case STRING:
+        default:
+          return this.getString().compareTo(o.getString());
+      }
+    } catch (Exception e) {
+      return -1;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/LeafExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/LeafExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/LeafExpression.java
new file mode 100644
index 0000000..6c79b08
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/LeafExpression.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public abstract class LeafExpression extends Expression {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/LiteralExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/LiteralExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/LiteralExpression.java
new file mode 100644
index 0000000..73b2114
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/LiteralExpression.java
@@ -0,0 +1,69 @@
+/*
+ * 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;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class LiteralExpression extends LeafExpression {
+
+  /**
+   *
+   */
+  private static final long serialVersionUID = 1L;
+  private Object value;
+  private DataType dataType;
+
+  public LiteralExpression(Object value, DataType dataType) {
+    this.value = value;
+    this.dataType = dataType;
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value) {
+    ExpressionResult expressionResult = new ExpressionResult(dataType, this.value, true);
+    return expressionResult;
+  }
+
+  public ExpressionResult getExpressionResult() {
+    ExpressionResult expressionResult = new ExpressionResult(dataType, this.value, true);
+    return expressionResult;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    // TODO Auto-generated method stub
+    return ExpressionType.LITERAL;
+  }
+
+  @Override public String getString() {
+    // TODO Auto-generated method stub
+    return "LiteralExpression(" + value + ')';
+  }
+
+  /**
+   * getLiteralExpDataType.
+   *
+   * @return
+   */
+  public DataType getLiteralExpDataType() {
+    return dataType;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/UnknownExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/UnknownExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/UnknownExpression.java
new file mode 100644
index 0000000..818720a
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/UnknownExpression.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.core.scan.expression;
+
+import java.util.List;
+
+public abstract class UnknownExpression extends Expression {
+
+  public abstract List<ColumnExpression> getAllColumnList();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/BinaryConditionalExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/BinaryConditionalExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/BinaryConditionalExpression.java
new file mode 100644
index 0000000..f6725de
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/BinaryConditionalExpression.java
@@ -0,0 +1,37 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.logical.BinaryLogicalExpression;
+
+public abstract class BinaryConditionalExpression extends BinaryLogicalExpression
+    implements ConditionalExpression {
+
+  /**
+   *
+   */
+  private static final long serialVersionUID = 1L;
+  public boolean isNull;
+  public BinaryConditionalExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ConditionalExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ConditionalExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ConditionalExpression.java
new file mode 100644
index 0000000..6f6e7fa
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ConditionalExpression.java
@@ -0,0 +1,37 @@
+/*
+ * 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.conditional;
+
+import java.util.List;
+
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+
+public interface ConditionalExpression {
+
+  // Will get the column informations involved in the expressions by
+  // traversing the tree
+  List<ColumnExpression> getColumnList();
+
+  boolean isSingleDimension();
+
+  List<ExpressionResult> getLiterals();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/EqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/EqualToExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/EqualToExpression.java
new file mode 100644
index 0000000..45dc33f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/EqualToExpression.java
@@ -0,0 +1,109 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.FilterUtil;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class EqualToExpression extends BinaryConditionalExpression {
+
+  private static final long serialVersionUID = 1L;
+
+  public EqualToExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  public EqualToExpression(Expression left, Expression right, boolean isNull) {
+    super(left, right);
+    this.isNull = isNull;
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult elRes = left.evaluate(value);
+    ExpressionResult erRes = right.evaluate(value);
+
+    boolean result = false;
+
+    ExpressionResult val1 = elRes;
+    ExpressionResult val2 = erRes;
+
+    if (elRes.isNull() || erRes.isNull()) {
+      if (isNull) {
+        elRes.set(DataType.BOOLEAN, elRes.isNull() == erRes.isNull());
+      } else {
+        elRes.set(DataType.BOOLEAN, false);
+      }
+      return elRes;
+    }
+    //default implementation if the data types are different for the resultsets
+    if (elRes.getDataType() != erRes.getDataType()) {
+      if (elRes.getDataType().getPrecedenceOrder() < erRes.getDataType().getPrecedenceOrder()) {
+        val2 = elRes;
+        val1 = erRes;
+      }
+    }
+
+    switch (val1.getDataType()) {
+      case STRING:
+        result = val1.getString().equals(val2.getString());
+        break;
+      case SHORT:
+        result = val1.getShort().equals(val2.getShort());
+        break;
+      case INT:
+        result = val1.getInt().equals(val2.getInt());
+        break;
+      case DOUBLE:
+        result = FilterUtil.nanSafeEqualsDoubles(val1.getDouble(), val2.getDouble());
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = val1.getTime().equals(val2.getTime());
+        break;
+      case LONG:
+        result = val1.getLong().equals(val2.getLong());
+        break;
+      case DECIMAL:
+        result = val1.getDecimal().compareTo(val2.getDecimal()) == 0;
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "DataType: " + val1.getDataType() + " not supported for the filter expression");
+    }
+    val1.set(DataType.BOOLEAN, result);
+    return val1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.EQUALS;
+  }
+
+  @Override public String getString() {
+    return "EqualTo(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanEqualToExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanEqualToExpression.java
new file mode 100644
index 0000000..b572fe2
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanEqualToExpression.java
@@ -0,0 +1,91 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class GreaterThanEqualToExpression extends BinaryConditionalExpression {
+  private static final long serialVersionUID = 4185317066280688984L;
+
+  public GreaterThanEqualToExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult elRes = left.evaluate(value);
+    ExpressionResult erRes = right.evaluate(value);
+    ExpressionResult exprResVal1 = elRes;
+    if (elRes.isNull() || erRes.isNull()) {
+      elRes.set(DataType.BOOLEAN, false);
+      return elRes;
+    }
+    if (elRes.getDataType() != erRes.getDataType()) {
+      if (elRes.getDataType().getPrecedenceOrder() < erRes.getDataType().getPrecedenceOrder()) {
+        exprResVal1 = erRes;
+      }
+
+    }
+    boolean result = false;
+    switch (exprResVal1.getDataType()) {
+      case STRING:
+        result = elRes.getString().compareTo(erRes.getString()) >= 0;
+        break;
+      case SHORT:
+        result = elRes.getShort() >= (erRes.getShort());
+        break;
+      case INT:
+        result = elRes.getInt() >= (erRes.getInt());
+        break;
+      case DOUBLE:
+        result = elRes.getDouble() >= (erRes.getDouble());
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = elRes.getTime() >= (erRes.getTime());
+        break;
+      case LONG:
+        result = elRes.getLong() >= (erRes.getLong());
+        break;
+      case DECIMAL:
+        result = elRes.getDecimal().compareTo(erRes.getDecimal()) >= 0;
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "DataType: " + exprResVal1.getDataType() + " not supported for the filter expression");
+    }
+    exprResVal1.set(DataType.BOOLEAN, result);
+    return exprResVal1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.GREATERTHAN_EQUALTO;
+  }
+
+  @Override public String getString() {
+    return "GreaterThanEqualTo(" + left.getString() + ',' + right.getString() + ')';
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpression.java
new file mode 100644
index 0000000..78c9381
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpression.java
@@ -0,0 +1,94 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+
+public class GreaterThanExpression extends BinaryConditionalExpression {
+  private static final long serialVersionUID = -5319109756575539219L;
+
+  public GreaterThanExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult exprLeftRes = left.evaluate(value);
+    ExpressionResult exprRightRes = right.evaluate(value);
+    ExpressionResult val1 = exprLeftRes;
+    if (exprLeftRes.isNull() || exprRightRes.isNull()) {
+      exprLeftRes.set(DataType.BOOLEAN, false);
+      return exprLeftRes;
+    }
+    if (exprLeftRes.getDataType() != exprRightRes.getDataType()) {
+      if (exprLeftRes.getDataType().getPrecedenceOrder() < exprRightRes.getDataType()
+          .getPrecedenceOrder()) {
+        val1 = exprRightRes;
+      }
+
+    }
+    boolean result = false;
+    switch (val1.getDataType()) {
+      case STRING:
+        result = exprLeftRes.getString().compareTo(exprRightRes.getString()) > 0;
+        break;
+      case DOUBLE:
+        result = exprLeftRes.getDouble() > (exprRightRes.getDouble());
+        break;
+      case SHORT:
+        result = exprLeftRes.getShort() > (exprRightRes.getShort());
+        break;
+      case INT:
+        result = exprLeftRes.getInt() > (exprRightRes.getInt());
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = exprLeftRes.getTime() > (exprRightRes.getTime());
+        break;
+      case LONG:
+        result = exprLeftRes.getLong() > (exprRightRes.getLong());
+        break;
+      case DECIMAL:
+        result = exprLeftRes.getDecimal().compareTo(exprRightRes.getDecimal()) > 0;
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "DataType: " + val1.getDataType() + " not supported for the filter expression");
+    }
+    val1.set(DataType.BOOLEAN, result);
+    return val1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.GREATERTHAN;
+  }
+
+  @Override public String getString() {
+    return "GreaterThan(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/InExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/InExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/InExpression.java
new file mode 100644
index 0000000..4ae1c04
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/InExpression.java
@@ -0,0 +1,99 @@
+/*
+ * 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.conditional;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class InExpression extends BinaryConditionalExpression {
+  private static final long serialVersionUID = -3149927446694175489L;
+
+  protected transient Set<ExpressionResult> setOfExprResult;
+
+  public InExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult leftRsult = left.evaluate(value);
+
+    if (setOfExprResult == null) {
+      ExpressionResult rightRsult = right.evaluate(value);
+      ExpressionResult val = null;
+      setOfExprResult = new HashSet<ExpressionResult>(10);
+      for (ExpressionResult expressionResVal : rightRsult.getList()) {
+        if (expressionResVal.getDataType().getPrecedenceOrder() < leftRsult.getDataType()
+            .getPrecedenceOrder()) {
+          val = leftRsult;
+        } else {
+          val = expressionResVal;
+        }
+        switch (val.getDataType()) {
+          case STRING:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getString());
+            break;
+          case SHORT:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getShort());
+            break;
+          case INT:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getInt());
+            break;
+          case DOUBLE:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getDouble());
+            break;
+          case LONG:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getLong());
+            break;
+          case DATE:
+          case TIMESTAMP:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getTime());
+            break;
+          case DECIMAL:
+            val = new ExpressionResult(val.getDataType(), expressionResVal.getDecimal());
+            break;
+          default:
+            throw new FilterUnsupportedException(
+                "DataType: " + val.getDataType() + " not supported for the filter expression");
+        }
+        setOfExprResult.add(val);
+      }
+    }
+    leftRsult.set(DataType.BOOLEAN, setOfExprResult.contains(leftRsult));
+    return leftRsult;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.IN;
+  }
+
+  @Override public String getString() {
+    return "IN(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpression.java
new file mode 100644
index 0000000..688ed5d
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpression.java
@@ -0,0 +1,93 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class LessThanEqualToExpression extends BinaryConditionalExpression {
+  private static final long serialVersionUID = 1L;
+
+  public LessThanEqualToExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult elRes = left.evaluate(value);
+    ExpressionResult erRes = right.evaluate(value);
+    ExpressionResult exprResValue1 = elRes;
+    if (elRes.isNull() || erRes.isNull()) {
+      elRes.set(DataType.BOOLEAN, false);
+      return elRes;
+    }
+    if (elRes.getDataType() != erRes.getDataType()) {
+      if (elRes.getDataType().getPrecedenceOrder() < erRes.getDataType().getPrecedenceOrder()) {
+        exprResValue1 = erRes;
+      }
+
+    }
+    boolean result = false;
+    switch (exprResValue1.getDataType()) {
+      case STRING:
+        result = elRes.getString().compareTo(erRes.getString()) <= 0;
+        break;
+      case SHORT:
+        result = elRes.getShort() <= (erRes.getShort());
+        break;
+      case INT:
+        result = elRes.getInt() <= (erRes.getInt());
+        break;
+      case DOUBLE:
+        result = elRes.getDouble() <= (erRes.getDouble());
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = elRes.getTime() <= (erRes.getTime());
+        break;
+      case LONG:
+        result = elRes.getLong() <= (erRes.getLong());
+        break;
+      case DECIMAL:
+        result = elRes.getDecimal().compareTo(erRes.getDecimal()) <= 0;
+        break;
+      default:
+        throw new FilterUnsupportedException("DataType: " + exprResValue1.getDataType()
+            + " not supported for the filter expression");
+    }
+    exprResValue1.set(DataType.BOOLEAN, result);
+    return exprResValue1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    // TODO Auto-generated method stub
+    return ExpressionType.LESSTHAN_EQUALTO;
+  }
+
+  @Override public String getString() {
+    return "LessThanEqualTo(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpression.java
new file mode 100644
index 0000000..a575494
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpression.java
@@ -0,0 +1,96 @@
+/*
+ * 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.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class LessThanExpression extends BinaryConditionalExpression {
+
+  private static final long serialVersionUID = 6343040416663699924L;
+
+  public LessThanExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult erRes = right.evaluate(value);
+    ExpressionResult elRes = left.evaluate(value);
+
+    ExpressionResult val1 = elRes;
+
+    boolean result = false;
+
+    if (elRes.isNull() || erRes.isNull()) {
+      elRes.set(DataType.BOOLEAN, false);
+      return elRes;
+    }
+    if (elRes.getDataType() != erRes.getDataType()) {
+      if (elRes.getDataType().getPrecedenceOrder() < erRes.getDataType().getPrecedenceOrder()) {
+        val1 = erRes;
+      }
+
+    }
+    switch (val1.getDataType()) {
+      case STRING:
+        result = elRes.getString().compareTo(erRes.getString()) < 0;
+        break;
+      case SHORT:
+        result = elRes.getShort() < (erRes.getShort());
+        break;
+      case INT:
+        result = elRes.getInt() < (erRes.getInt());
+        break;
+      case DOUBLE:
+        result = elRes.getDouble() < (erRes.getDouble());
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = elRes.getTime() < (erRes.getTime());
+        break;
+      case LONG:
+        result = elRes.getLong() < (erRes.getLong());
+        break;
+      case DECIMAL:
+        result = elRes.getDecimal().compareTo(erRes.getDecimal()) < 0;
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "DataType: " + val1.getDataType() + " not supported for the filter expression");
+    }
+    val1.set(DataType.BOOLEAN, result);
+    return val1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.LESSTHAN;
+  }
+
+  @Override public String getString() {
+    return "LessThan(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java
new file mode 100644
index 0000000..831437a
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.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.core.scan.expression.conditional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class ListExpression extends Expression {
+  private static final long serialVersionUID = 1L;
+
+  public ListExpression(List<Expression> children) {
+    this.children = children;
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value) throws FilterUnsupportedException {
+    List<ExpressionResult> listOfExprRes = new ArrayList<ExpressionResult>(10);
+
+    for (Expression expr : children) {
+      try {
+        listOfExprRes.add(expr.evaluate(value));
+      } catch (FilterIllegalMemberException e) {
+        continue;
+      }
+    }
+    return new ExpressionResult(listOfExprRes);
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    // TODO Auto-generated method stub
+    return ExpressionType.LIST;
+  }
+
+  @Override public String getString() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpression.java
new file mode 100644
index 0000000..2f656cd
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpression.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.core.scan.expression.conditional;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class NotEqualsExpression extends BinaryConditionalExpression {
+
+  private static final long serialVersionUID = 8684006025540863973L;
+  private boolean isNotNull = false;
+  public NotEqualsExpression(Expression left, Expression right, boolean isNotNull) {
+    super(left, right);
+    this.isNotNull = isNotNull;
+  }
+
+  public NotEqualsExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult elRes = left.evaluate(value);
+    ExpressionResult erRes = right.evaluate(value);
+
+    boolean result = false;
+    ExpressionResult val1 = elRes;
+    ExpressionResult val2 = erRes;
+    if (elRes.isNull() || erRes.isNull()) {
+      if (isNotNull) {
+        elRes.set(DataType.BOOLEAN, elRes.isNull() != erRes.isNull());
+      } else {
+        elRes.set(DataType.BOOLEAN, false);
+      }
+      return elRes;
+    }
+    //default implementation if the data types are different for the resultsets
+    if (elRes.getDataType() != erRes.getDataType()) {
+      //            result = elRes.getString().equals(erRes.getString());
+      if (elRes.getDataType().getPrecedenceOrder() < erRes.getDataType().getPrecedenceOrder()) {
+        val1 = erRes;
+        val2 = elRes;
+      }
+    }
+    switch (val1.getDataType()) {
+      case STRING:
+        result = !val1.getString().equals(val2.getString());
+        break;
+      case SHORT:
+        result = val1.getShort().shortValue() != val2.getShort().shortValue();
+        break;
+      case INT:
+        result = val1.getInt().intValue() != val2.getInt().intValue();
+        break;
+      case DOUBLE:
+        result = val1.getDouble().doubleValue() != val2.getDouble().doubleValue();
+        break;
+      case DATE:
+      case TIMESTAMP:
+        result = val1.getTime().longValue() != val2.getTime().longValue();
+        break;
+      case LONG:
+        result = elRes.getLong().longValue() != (erRes.getLong()).longValue();
+        break;
+      case DECIMAL:
+        result = elRes.getDecimal().compareTo(erRes.getDecimal()) != 0;
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "DataType: " + val1.getDataType() + " not supported for the filter expression");
+    }
+    val1.set(DataType.BOOLEAN, result);
+    return val1;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.NOT_EQUALS;
+  }
+
+  @Override public String getString() {
+    return "NotEquals(" + left.getString() + ',' + right.getString() + ')';
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpression.java
new file mode 100644
index 0000000..e56d6f6
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpression.java
@@ -0,0 +1,98 @@
+/*
+ * 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.conditional;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class NotInExpression extends BinaryConditionalExpression {
+  private static final long serialVersionUID = -6835841923752118034L;
+  protected transient Set<ExpressionResult> setOfExprResult;
+
+  public NotInExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult leftRsult = left.evaluate(value);
+    if (setOfExprResult == null) {
+      ExpressionResult val = null;
+      ExpressionResult rightRsult = right.evaluate(value);
+      setOfExprResult = new HashSet<ExpressionResult>(10);
+      for (ExpressionResult exprResVal : rightRsult.getList()) {
+        if (exprResVal.getDataType().getPrecedenceOrder() < leftRsult.getDataType()
+            .getPrecedenceOrder()) {
+          val = leftRsult;
+        } else {
+          val = exprResVal;
+        }
+        switch (val.getDataType()) {
+          case STRING:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getString());
+            break;
+          case SHORT:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getShort());
+            break;
+          case INT:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getInt());
+            break;
+          case DOUBLE:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getDouble());
+            break;
+          case DATE:
+          case TIMESTAMP:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getTime());
+            break;
+          case LONG:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getLong());
+            break;
+          case DECIMAL:
+            val = new ExpressionResult(val.getDataType(), exprResVal.getDecimal());
+            break;
+          default:
+            throw new FilterUnsupportedException(
+                "DataType: " + val.getDataType() + " not supported for the filter expression");
+        }
+        setOfExprResult.add(val);
+      }
+    }
+    leftRsult.set(DataType.BOOLEAN, !setOfExprResult.contains(leftRsult));
+
+    return leftRsult;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.NOT_IN;
+  }
+
+  @Override public String getString() {
+    return "NOT IN(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterIllegalMemberException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterIllegalMemberException.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterIllegalMemberException.java
new file mode 100644
index 0000000..80c364f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterIllegalMemberException.java
@@ -0,0 +1,94 @@
+/*
+ * 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.exception;
+
+import java.util.Locale;
+
+/**
+ * FilterIllegalMemberException class representing exception which can cause while evaluating
+ * filter members needs to be gracefully handled without propagating to outer layer so that
+ * the execution should not get interrupted.
+ */
+public class FilterIllegalMemberException extends Exception {
+
+  /**
+   * default serial version ID.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * The Error message.
+   */
+  private String msg = "";
+
+  /**
+   * Constructor
+   *
+   * @param msg       The error message for this exception.
+   */
+  public FilterIllegalMemberException(String msg) {
+    super(msg);
+    this.msg = msg;
+  }
+
+  /**
+   * Constructor
+   *
+   * @param msg       The error message for this exception.
+   */
+  public FilterIllegalMemberException(String msg, Throwable t) {
+    super(msg, t);
+    this.msg = msg;
+  }
+
+  /**
+   * Constructor
+   *
+   */
+  public FilterIllegalMemberException(Throwable t) {
+    super(t);
+  }
+
+  /**
+   * This method is used to get the localized message.
+   *
+   * @param locale - A Locale object represents a specific geographical,
+   *               political, or cultural region.
+   * @return - Localized error message.
+   */
+  public String getLocalizedMessage(Locale locale) {
+    return "";
+  }
+
+  /**
+   * getLocalizedMessage
+   */
+  @Override public String getLocalizedMessage() {
+    return super.getLocalizedMessage();
+  }
+
+  /**
+   * getMessage
+   */
+  public String getMessage() {
+    return this.msg;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterUnsupportedException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterUnsupportedException.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterUnsupportedException.java
new file mode 100644
index 0000000..4f88944
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/exception/FilterUnsupportedException.java
@@ -0,0 +1,88 @@
+/*
+ * 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.exception;
+
+import java.util.Locale;
+
+public class FilterUnsupportedException extends Exception {
+
+  /**
+   * default serial version ID.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * The Error message.
+   */
+  private String msg = "";
+
+  /**
+   * Constructor
+   *
+   * @param msg       The error message for this exception.
+   */
+  public FilterUnsupportedException(String msg) {
+    super(msg);
+    this.msg = msg;
+  }
+
+  /**
+   * Constructor
+   *
+   * @param msg       The error message for this exception.
+   */
+  public FilterUnsupportedException(String msg, Throwable t) {
+    super(msg, t);
+    this.msg = msg;
+  }
+
+  /**
+   * Constructor
+   *
+   */
+  public FilterUnsupportedException(Throwable t) {
+    super(t);
+  }
+
+  /**
+   * This method is used to get the localized message.
+   *
+   * @param locale - A Locale object represents a specific geographical,
+   *               political, or cultural region.
+   * @return - Localized error message.
+   */
+  public String getLocalizedMessage(Locale locale) {
+    return "";
+  }
+
+  /**
+   * getLocalizedMessage
+   */
+  @Override public String getLocalizedMessage() {
+    return super.getLocalizedMessage();
+  }
+
+  /**
+   * getMessage
+   */
+  public String getMessage() {
+    return this.msg;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/AndExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/AndExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/AndExpression.java
new file mode 100644
index 0000000..bbb1ef2
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/AndExpression.java
@@ -0,0 +1,63 @@
+/*
+ * 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.logical;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class AndExpression extends BinaryLogicalExpression {
+
+  private static final long serialVersionUID = 1L;
+
+  public AndExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ExpressionResult resultLeft = left.evaluate(value);
+    ExpressionResult resultRight = right.evaluate(value);
+    switch (resultLeft.getDataType()) {
+      case BOOLEAN:
+        resultLeft.set(DataType.BOOLEAN, (resultLeft.getBoolean() && resultRight.getBoolean()));
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "Incompatible datatype for applying AND Expression Filter");
+    }
+    return resultLeft;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    // TODO Auto-generated method stub
+    return ExpressionType.AND;
+  }
+
+  @Override public String getString() {
+    // TODO Auto-generated method stub
+    return "And(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
new file mode 100644
index 0000000..9209959
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
@@ -0,0 +1,109 @@
+/*
+ * 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.logical;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.scan.expression.BinaryExpression;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.LiteralExpression;
+
+public abstract class BinaryLogicalExpression extends BinaryExpression {
+
+  /**
+   *
+   */
+  private static final long serialVersionUID = 1L;
+
+  public BinaryLogicalExpression(Expression left, Expression right) {
+    super(left, right);
+    // TODO Auto-generated constructor stub
+  }
+
+  public List<ExpressionResult> getLiterals() {
+    List<ExpressionResult> listOfExp =
+        new ArrayList<ExpressionResult>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    getExpressionResultList(this, listOfExp);
+    Collections.sort(listOfExp);
+    return listOfExp;
+  }
+
+  // Will get the column informations involved in the expressions by
+  // traversing the tree
+  public List<ColumnExpression> getColumnList() {
+    // TODO
+    List<ColumnExpression> listOfExp =
+        new ArrayList<ColumnExpression>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    getColumnList(this, listOfExp);
+    return listOfExp;
+  }
+
+  private void getColumnList(Expression expression, List<ColumnExpression> lst) {
+    if (expression instanceof ColumnExpression) {
+      ColumnExpression colExp = (ColumnExpression) expression;
+      boolean found = false;
+
+      for (ColumnExpression currentColExp : lst) {
+        if (currentColExp.getColumnName().equals(colExp.getColumnName())) {
+          found = true;
+          colExp.setColIndex(currentColExp.getColIndex());
+          break;
+        }
+      }
+      if (!found) {
+        colExp.setColIndex(lst.size());
+        lst.add(colExp);
+      }
+    }
+    for (Expression child : expression.getChildren()) {
+      getColumnList(child, lst);
+    }
+  }
+
+  public boolean isSingleDimension() {
+    List<ColumnExpression> listOfExp =
+        new ArrayList<ColumnExpression>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+    getColumnList(this, listOfExp);
+    if (listOfExp.size() == 1 && listOfExp.get(0).isDimension()) {
+      return true;
+    }
+    return false;
+
+  }
+
+  private void getExpressionResultList(Expression binaryConditionalExpression,
+      List<ExpressionResult> listOfExp) {
+    if (binaryConditionalExpression instanceof LiteralExpression) {
+      ExpressionResult colExp =
+          ((LiteralExpression) binaryConditionalExpression).getExpressionResult();
+      listOfExp.add(colExp);
+    }
+    for (Expression child : binaryConditionalExpression.getChildren()) {
+      getExpressionResultList(child, listOfExp);
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/FalseExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/FalseExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/FalseExpression.java
new file mode 100644
index 0000000..64a8714
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/FalseExpression.java
@@ -0,0 +1,70 @@
+/*
+ * 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.logical;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.LiteralExpression;
+import org.apache.carbondata.core.scan.expression.conditional.BinaryConditionalExpression;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+
+
+/**
+ * This class will form an expression whose evaluation will be always false.
+ */
+public class FalseExpression  extends BinaryConditionalExpression {
+
+
+  private static final long serialVersionUID = -8390184061336799370L;
+
+  public FalseExpression(Expression child1) {
+    super(child1, new LiteralExpression(null,null));
+  }
+
+  /**
+   * This method will always return false, mainly used in the filter expressions
+   * which are illogical.
+   * eg: columnName NOT IN('Java',NULL)
+   * @param value
+   * @return
+   * @throws FilterUnsupportedException
+   * @throws FilterIllegalMemberException
+   */
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    return new ExpressionResult(DataType.BOOLEAN,false);
+  }
+
+  /**
+   * This method will return the expression types
+   * @return
+   */
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.FALSE;
+  }
+  @Override public String getString() {
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/OrExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/OrExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/OrExpression.java
new file mode 100644
index 0000000..13de9f4
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/OrExpression.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.core.scan.expression.logical;
+
+import org.apache.carbondata.core.metadata.DataType;
+import org.apache.carbondata.core.scan.expression.Expression;
+import org.apache.carbondata.core.scan.expression.ExpressionResult;
+import org.apache.carbondata.core.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.ExpressionType;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+public class OrExpression extends BinaryLogicalExpression {
+
+  private static final long serialVersionUID = 4220598043176438380L;
+
+  public OrExpression(Expression left, Expression right) {
+    super(left, right);
+  }
+
+  @Override public ExpressionResult evaluate(RowIntf value)
+      throws FilterIllegalMemberException, FilterUnsupportedException {
+    ExpressionResult resultLeft = left.evaluate(value);
+    ExpressionResult resultRight = right.evaluate(value);
+    switch (resultLeft.getDataType()) {
+      case BOOLEAN:
+        resultLeft.set(DataType.BOOLEAN, (resultLeft.getBoolean() || resultRight.getBoolean()));
+        break;
+      default:
+        throw new FilterUnsupportedException(
+            "Incompatible datatype for applying OR Expression Filter");
+    }
+
+    return resultLeft;
+  }
+
+  @Override public ExpressionType getFilterExpressionType() {
+    return ExpressionType.OR;
+  }
+
+  @Override public String getString() {
+    return "Or(" + left.getString() + ',' + right.getString() + ')';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/952cf517/core/src/main/java/org/apache/carbondata/core/scan/filter/DimColumnFilterInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/DimColumnFilterInfo.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/DimColumnFilterInfo.java
new file mode 100644
index 0000000..ece7944
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/DimColumnFilterInfo.java
@@ -0,0 +1,80 @@
+/*
+ * 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.filter;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class DimColumnFilterInfo implements Serializable {
+
+  private static final long serialVersionUID = 8181578747306832771L;
+
+  private boolean isIncludeFilter;
+
+  private List<Integer> filterList;
+
+  /**
+   * Implicit column filter values to be used for block and blocklet pruning
+   */
+  private List<String> implicitColumnFilterList;
+  private List<Integer> excludeFilterList;
+  /**
+   * maintain the no dictionary filter values list.
+   */
+  private List<byte[]> noDictionaryFilterValuesList;
+
+  public List<byte[]> getNoDictionaryFilterValuesList() {
+    return noDictionaryFilterValuesList;
+  }
+
+  public boolean isIncludeFilter() {
+    return isIncludeFilter;
+  }
+
+  public void setIncludeFilter(boolean isIncludeFilter) {
+    this.isIncludeFilter = isIncludeFilter;
+  }
+
+  public List<Integer> getFilterList() {
+    return filterList;
+  }
+
+  public void setFilterList(List<Integer> filterList) {
+    this.filterList = filterList;
+  }
+
+  public void setFilterListForNoDictionaryCols(List<byte[]> noDictionaryFilterValuesList) {
+    this.noDictionaryFilterValuesList = noDictionaryFilterValuesList;
+  }
+
+  public List<Integer> getExcludeFilterList() {
+    return excludeFilterList;
+  }
+  public void setExcludeFilterList(List<Integer> excludeFilterList) {
+    this.excludeFilterList = excludeFilterList;
+  }
+  public List<String> getImplicitColumnFilterList() {
+    return implicitColumnFilterList;
+  }
+
+  public void setImplicitColumnFilterList(List<String> implicitColumnFilterList) {
+    this.implicitColumnFilterList = implicitColumnFilterList;
+  }
+}



Mime
View raw message