carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [02/52] [partial] incubator-carbondata git commit: move core package
Date Mon, 16 Jan 2017 14:52:39 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpressionUnitTest.java
new file mode 100644
index 0000000..97e5e66
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/GreaterThanExpressionUnitTest.java
@@ -0,0 +1,364 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class GreaterThanExpressionUnitTest {
+  static GreaterThanExpression greaterThanExpression;
+
+  @Test public void testEvaluateForGreaterThanExpressionWithStringDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "string1" };
+    String[] row1 = { "String's Value" };
+    Object objectRow[] = { row, row1 };
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public String getString() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return "string1";
+
+        } else {
+          return "String's Value";
+
+        }
+
+      }
+    };
+    value.setValues(objectRow);
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("id", DataType.SHORT);
+    left.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 170 };
+    Short[] row1 = { 70 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Short getShort() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 170;
+
+        } else {
+          return 70;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 44D };
+    Double[] row1 = { 20D };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Double getDouble() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 44D;
+
+        } else {
+          return 20D;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_number", DataType.INT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_number", DataType.INT);
+    left.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 140 };
+    Integer[] row1 = { 150 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 150;
+
+        } else {
+          return 140;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+
+      greaterThanExpression = new GreaterThanExpression(left, right);
+
+      RowImpl value = new RowImpl();
+
+      DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
+      Date date = dateFormat.parse("23/09/2007");
+      long time = date.getTime();
+      Timestamp[] row = { new Timestamp(time) };
+
+      Date date1 = dateFormat.parse("24/09/2007");
+      long time1 = date1.getTime();
+      Timestamp[] row1 = { new Timestamp(time1) };
+
+      Object objectRow[] = { row1, row };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        Boolean returnMockFlag = true;
+
+        @Mock public Long getTime() {
+          if (returnMockFlag) {
+            returnMockFlag = false;
+            return 1190592000L;
+          } else {
+            return 1190505600L;
+          }
+        }
+      };
+
+      ExpressionResult result = greaterThanExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.LONG);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.LONG);
+    left.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 1234567654321L };
+    Long[] row1 = { 123456765432234L };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Long getLong() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 123456765432234L;
+        } else {
+          return 1234567654321L;
+        }
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DECIMAL);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.DECIMAL);
+    left.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(12345.0) };
+    Decimal[] row1 = new Decimal[] { Decimal.apply(123451245.0) };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public BigDecimal getDecimal() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return new BigDecimal(123451245.0);
+        } else {
+          return new BigDecimal(12345.0);
+        }
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForGreaterThanExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    greaterThanExpression = new GreaterThanExpression(right, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+    greaterThanExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithIsNullReturnTrue()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    greaterThanExpression = new GreaterThanExpression(right, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForGreaterThanExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(1);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "String1" };
+    Integer[] row1 = { 14 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 15;
+        } else {
+          return 14;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = greaterThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testForGreaterThanExpressionWithGetString() throws Exception {
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    greaterThanExpression = new GreaterThanExpression(left, right);
+    String expected_result = "GreaterThan(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = greaterThanExpression.getString();
+    assertEquals(expected_result, result);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/InExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/InExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/InExpressionUnitTest.java
new file mode 100644
index 0000000..fca0826
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/InExpressionUnitTest.java
@@ -0,0 +1,276 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class InExpressionUnitTest {
+
+  static InExpression inExpression;
+
+  @Test public void testEvaluateForInExpressionWithString()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    String row = "string1";
+    String row1 = "string1";
+    Object objectRow[] = { row, row1 };
+
+    new MockUp<ExpressionResult>() {
+
+      @Mock public DataType getDataType() {
+        return DataType.STRING;
+      }
+
+      @Mock public String getString() {
+        return "string1";
+      }
+    };
+
+    value.setValues(objectRow);
+    ExpressionResult result = inExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForInExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+
+    ColumnExpression left = new ColumnExpression("left_id", DataType.SHORT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_id", DataType.SHORT);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short row = 150;
+    Short row1 = 150;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 150;
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertEquals(result.getDataType(), DataType.BOOLEAN);
+
+  }
+
+  @Test public void testEvaluateForInExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+
+    ColumnExpression left = new ColumnExpression("left_id", DataType.INT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_id", DataType.INT);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer row = 15052;
+    Integer row1 = 15052;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 15052;
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertEquals(result.getDataType(), DataType.BOOLEAN);
+
+  }
+
+  @Test public void testEvaluateForInExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double row = 44521D;
+    Double row1 = 44521D;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Double getDouble() {
+        return 44521D;
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForInExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.LONG);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.LONG);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long row = 1234567654321L;
+    Long row1 = 1234567654321L;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Long getLong() {
+        return 1234567654321L;
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForInExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("left_timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("right_timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+      inExpression = new InExpression(left, right);
+
+      RowImpl value = new RowImpl();
+      DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+      Date date = dateFormat.parse("23/09/2007");
+
+      long time = date.getTime();
+
+      Timestamp row = new Timestamp(time);
+      Timestamp row1 = new Timestamp(time);
+      Object objectRow[] = { row, row1 };
+      value.setValues(objectRow);
+
+     new MockUp<ExpressionResult>() {
+        @Mock public Long getTime() {
+          return 18465213000000L;
+        }
+      };
+
+      ExpressionResult result = inExpression.evaluate(value);
+      assertFalse(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test public void testEvaluateForInExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DECIMAL);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DECIMAL);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal row = Decimal.apply(123452154.0);
+    Decimal row1 = Decimal.apply(123452154.0);
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public BigDecimal getDecimal() {
+        return new BigDecimal(123452154.0);
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForInExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("contact", DataType.BOOLEAN);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    Boolean row = true;
+    Boolean row1 = true;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+    inExpression.evaluate(value);
+  }
+
+  @Test public void testForInExpressionWithGetString() throws Exception {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    String expected_result = "IN(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = inExpression.getString();
+    assertEquals(expected_result, result);
+  }
+
+  @Test public void testEvaluateForInExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("name", DataType.STRING);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("number", DataType.INT);
+    left.setColIndex(1);
+    inExpression = new InExpression(left, right);
+    RowImpl value = new RowImpl();
+    String row1 =  "String1";
+    Integer row =  14523 ;
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 14523;
+      }
+    };
+
+    ExpressionResult result = inExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java
new file mode 100644
index 0000000..642b863
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java
@@ -0,0 +1,368 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class LessThanEqualToExpressionUnitTest {
+
+  static LessThanEqualToExpression lessThanEqualToExpression;
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithBothStringISSame()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, left);
+    RowImpl value = new RowImpl();
+    String[] row = { "String is Value" };
+    String[] row1 = { "string1" };
+    Object objectRow[] = { row, row1 };
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public String getString() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return "String is Value";
+
+        } else {
+          return "string1";
+
+        }
+
+      }
+    };
+
+    value.setValues(objectRow);
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("id", DataType.SHORT);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 1550 };
+    Short[] row1 = { 3365 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Short getShort() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 1550;
+
+        } else {
+          return 3365;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 4852.2D };
+    Double[] row1 = { 4852.2D };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Double getDouble() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 4852.2D;
+
+        } else {
+          return 4852.2D;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_number", DataType.INT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_number", DataType.INT);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 144580 };
+    Integer[] row1 = { 14500 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 14500;
+
+        } else {
+          return 144580;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+
+      lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+
+      RowImpl value = new RowImpl();
+
+      DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
+      Date date = dateFormat.parse("23/09/2007");
+      long time = date.getTime();
+      Timestamp[] row = { new Timestamp(time) };
+
+      Date date1 = dateFormat.parse("24/09/2007");
+      long time1 = date1.getTime();
+      Timestamp[] row1 = { new Timestamp(time1) };
+
+      Object objectRow[] = { row, row1 };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        Boolean returnMockFlag = true;
+
+        @Mock public Long getTime() {
+          if (returnMockFlag) {
+            returnMockFlag = false;
+            return 1190505600L;
+          } else {
+            return 1190592000L;
+          }
+        }
+      };
+
+      ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.LONG);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.LONG);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 4751256L };
+    Long[] row1 = { 48512586L };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Long getLong() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 4751256L;
+        } else {
+          return 48512586L;
+        }
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DECIMAL);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DECIMAL);
+    left.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(46851.2) };
+    Decimal[] row1 = new Decimal[] { Decimal.apply(45821.02) };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public BigDecimal getDecimal() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return new BigDecimal(45821.02);
+        } else {
+          return new BigDecimal(46851.2);
+        }
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForLessThanEqualToExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    lessThanEqualToExpression = new LessThanEqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+    lessThanEqualToExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithIsNullReturnTrue()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    lessThanEqualToExpression = new LessThanEqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15856 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15856;
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForLessThanEqualToExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(1);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "S" };
+    Integer[] row1 = { 1450 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 84;
+        } else {
+          return 1450;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testForLessThanEqualToExpressionWithGetString() throws Exception {
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    lessThanEqualToExpression = new LessThanEqualToExpression(left, right);
+    String expected_result =
+        "LessThanEqualTo(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = lessThanEqualToExpression.getString();
+    assertEquals(expected_result, result);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpressionUnitTest.java
new file mode 100644
index 0000000..6dfdd5f
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/LessThanExpressionUnitTest.java
@@ -0,0 +1,364 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class LessThanExpressionUnitTest {
+  static LessThanExpression lessThanExpression;
+
+  @Test public void testEvaluateForLessThanExpressionWithStringDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "First String Value" };
+    String[] row1 = { "string1" };
+    Object objectRow[] = { row, row1 };
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public String getString() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return "First String Value";
+
+        } else {
+          return "string1";
+
+        }
+
+      }
+    };
+    value.setValues(objectRow);
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("id", DataType.SHORT);
+    left.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 7052 };
+    Short[] row1 = { 7450 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Short getShort() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 7052;
+
+        } else {
+          return 7450;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForLessThanExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 2087D };
+    Double[] row1 = { 4454D };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Double getDouble() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 2087D;
+
+        } else {
+          return 4454D;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForLessThanExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_number", DataType.INT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_number", DataType.INT);
+    left.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 1550 };
+    Integer[] row1 = { 1420 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 1420;
+
+        } else {
+          return 1550;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+ @Test public void testEvaluateForLessThanExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+
+      lessThanExpression = new LessThanExpression(left, right);
+
+      RowImpl value = new RowImpl();
+
+      DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
+      Date date = dateFormat.parse("23/09/2007");
+      long time = date.getTime();
+      Timestamp[] row = { new Timestamp(time) };
+
+      Date date1 = dateFormat.parse("24/09/2007");
+      long time1 = date1.getTime();
+      Timestamp[] row1 = { new Timestamp(time1) };
+
+      Object objectRow[] = { row, row1 };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        Boolean returnMockFlag = true;
+
+        @Mock public Long getTime() {
+          if (returnMockFlag) {
+            returnMockFlag = false;
+            return 1190505600L;
+          } else {
+            return 1190592000L;
+          }
+        }
+      };
+
+      ExpressionResult result = lessThanExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+ @Test public void testEvaluateForLessThanExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.LONG);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.LONG);
+    left.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 14523656L };
+    Long[] row1 = { 12456325L };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Long getLong() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 12456325L;
+        } else {
+          return 14523656L;
+        }
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+ @Test public void testEvaluateForLessThanExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DECIMAL);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.DECIMAL);
+    left.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(256324.0) };
+    Decimal[] row1 = new Decimal[] { Decimal.apply(123451245.0) };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public BigDecimal getDecimal() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return new BigDecimal(256324.0);
+        } else {
+          return new BigDecimal(123451245.0);
+        }
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForLessThanExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    lessThanExpression = new LessThanExpression(right, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+    lessThanExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateForLessThanExpressionWithIsNullReturnTrue()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    lessThanExpression = new LessThanExpression(right, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForLessThanExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(1);
+    lessThanExpression = new LessThanExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "S" };
+    Integer[] row1 = { 1864 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 84;
+        } else {
+          return 1864;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = lessThanExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+ @Test public void testForLessThanExpressionWithGetString() throws Exception {
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    lessThanExpression = new LessThanExpression(left, right);
+    String expected_result = "LessThan(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = lessThanExpression.getString();
+    assertEquals(expected_result, result);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/ListExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/ListExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/ListExpressionUnitTest.java
new file mode 100644
index 0000000..ab4af79
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/ListExpressionUnitTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.metadata.datatype.DataType;
+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.exception.FilterIllegalMemberException;
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.core.scan.filter.intf.RowImpl;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class ListExpressionUnitTest {
+
+  static ListExpression listExpression;
+
+  @Test public void test() throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+
+    List<Expression> children = new ArrayList<>();
+    children.add(left);
+    children.add(right);
+
+    listExpression = new ListExpression(children);
+    RowImpl value = new RowImpl();
+    String row = "Row is for left";
+    String row1 = "I am row 1";
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+    String expected_value = "Row is for left";
+    ExpressionResult result = listExpression.evaluate(value);
+    assertThat(expected_value, is(equalTo(result.getList().get(0).getString())));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpressionUnitTest.java
new file mode 100644
index 0000000..f167196
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotEqualsExpressionUnitTest.java
@@ -0,0 +1,406 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class NotEqualsExpressionUnitTest {
+
+  static NotEqualsExpression notEqualsExpression;
+
+  @Test public void testEvaluateForNotEqualsExpressionWithBothStringISSame()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "string1" };
+    String[] row1 = { "string2" };
+    Object objectRow[] = { row, row1 };
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public String getString() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return "string1";
+
+        } else {
+          return "string2";
+        }
+      }
+    };
+
+    value.setValues(objectRow);
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+
+    ColumnExpression left = new ColumnExpression("left_id", DataType.SHORT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_id", DataType.SHORT);
+    right.setColIndex(1);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Short[] row1 = { 16 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Short getShort() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 15;
+
+        } else {
+          return 16;
+
+        }
+
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_number", DataType.INT);
+    right.setColIndex(1);
+    ColumnExpression left = new ColumnExpression("left_number", DataType.INT);
+    left.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 15 };
+    Integer[] row1 = { 16 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 15;
+
+        } else {
+          return 16;
+        }
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(1);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 445.2D };
+    Double[] row1 = { 452.08D };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Double getDouble() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 445.2D;
+
+        } else {
+          return 452.08D;
+        }
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.LONG);
+    right.setColIndex(1);
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.LONG);
+    left.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 1234567654321L };
+    Long[] row1 = { 12345676541L };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Long getLong() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 1234567654321L;
+        } else {
+          return 12345676541L;
+        }
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("left_timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("right_timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+
+      notEqualsExpression = new NotEqualsExpression(left, right);
+
+      RowImpl value = new RowImpl();
+
+      DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+
+      Date date = dateFormat.parse("23/09/2007");
+      long time = date.getTime();
+      Timestamp[] row = { new Timestamp(time) };
+
+      Date date1 = dateFormat.parse("24/09/2007");
+      long time1 = date1.getTime();
+      Timestamp[] row1 = { new Timestamp(time1) };
+
+      Object objectRow[] = { row1, row };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        Boolean returnMockFlag = true;
+
+        @Mock public Long getTime() {
+          if (returnMockFlag) {
+            returnMockFlag = false;
+            return 1190592000L;
+          } else {
+            return 1190505600L;
+          }
+        }
+      };
+
+      ExpressionResult result = notEqualsExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForNotEqualsExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(right, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+    notEqualsExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateWithForNotEqualsExpressionDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DECIMAL);
+    right.setColIndex(1);
+    ColumnExpression left = new ColumnExpression("contact", DataType.DECIMAL);
+    left.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(12345.0) };
+    Decimal[] row1 = new Decimal[] { Decimal.apply(1235445.0) };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public BigDecimal getDecimal() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return new BigDecimal(12345.0);
+        } else {
+          return new BigDecimal(1235445.0);
+        }
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithIsNullReturnTrue()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(right, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 150 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 150;
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(1);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row1 = { "S" };
+    Integer[] row = { 14 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      Boolean returnMockFlag = true;
+
+      @Mock public Integer getInt() {
+        if (returnMockFlag) {
+          returnMockFlag = false;
+          return 84;
+        } else {
+          return 14;
+        }
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testForNotEqualsExpressionWithGetString() throws Exception {
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    notEqualsExpression = new NotEqualsExpression(left, right);
+    String expected_result = "NotEquals(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = notEqualsExpression.getString();
+    assertEquals(expected_result, result);
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithNullWhileCreatingObject()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(right, right, false);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertEquals(DataType.BOOLEAN, result.getDataType());
+
+  }
+
+  @Test public void testEvaluateForNotEqualsExpressionWithNullISTureWhileCreatingObject()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    notEqualsExpression = new NotEqualsExpression(right, right, true);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    ExpressionResult result = notEqualsExpression.evaluate(value);
+    assertEquals(DataType.BOOLEAN, result.getDataType());
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpressionUnitTest.java
new file mode 100644
index 0000000..64c6d20
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/conditional/NotInExpressionUnitTest.java
@@ -0,0 +1,275 @@
+/*
+ * 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.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.spark.sql.types.Decimal;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class NotInExpressionUnitTest {
+
+  static NotInExpression notInExpression;
+
+  @Test public void testEvaluateForNotInExpressionWithString()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    String row = "Row is for left";
+    String row1 = "I am row 1";
+    Object objectRow[] = { row, row1 };
+
+    new MockUp<ExpressionResult>() {
+
+      @Mock public DataType getDataType() {
+        return DataType.STRING;
+      }
+
+      @Mock public String getString() {
+        return "string1";
+      }
+    };
+
+    value.setValues(objectRow);
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+
+    ColumnExpression left = new ColumnExpression("left_id", DataType.SHORT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_id", DataType.SHORT);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short row = 15653;
+    Short row1 = 15582;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15582;
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertEquals(result.getDataType(), DataType.BOOLEAN);
+
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+
+    ColumnExpression left = new ColumnExpression("left_id", DataType.INT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_id", DataType.INT);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer row = 150569;
+    Integer row1 = 15052;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 15052;
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertEquals(result.getDataType(), DataType.BOOLEAN);
+
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DOUBLE);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DOUBLE);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double row = 44521D;
+    Double row1 = 44521.023D;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Double getDouble() {
+        return 44521.023D;
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.LONG);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.LONG);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long row = 123456256325632L;
+    Long row1 = 156212456245556L;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Long getLong() {
+        return 156212456245556L;
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("left_timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("right_timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+      notInExpression = new NotInExpression(right, right);
+
+      RowImpl value = new RowImpl();
+      DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
+      Date date = dateFormat.parse("2007/03/03");
+
+      long time = date.getTime();
+
+      Timestamp row = new Timestamp(time);
+      Timestamp row1 = new Timestamp(time);
+      Object objectRow[] = { row, row1 };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        @Mock public Long getTime() {
+          return 1172860200000L;
+        }
+      };
+
+      ExpressionResult result = notInExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test public void testEvaluateForNotInExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("left_contact", DataType.DECIMAL);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_contact", DataType.DECIMAL);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal row = Decimal.apply(123452154.0);
+    Decimal row1 = Decimal.apply(1234521215454.0);
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public BigDecimal getDecimal() {
+        return new BigDecimal(1234521215454.0);
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testDefaultCaseForNotInExpression()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("contact", DataType.BOOLEAN);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    Boolean row = true;
+    Boolean row1 = true;
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+    notInExpression.evaluate(value);
+  }
+
+  @Test public void testForNotInExpressionWithGetString() throws Exception {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    String expected_result = "NOT IN(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = notInExpression.getString();
+    assertEquals(expected_result, result);
+  }
+  @Test public void testEvaluateForNotInExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("name", DataType.STRING);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("number", DataType.INT);
+    left.setColIndex(1);
+    notInExpression = new NotInExpression(left, right);
+    RowImpl value = new RowImpl();
+    String row1 = "String1";
+    Integer row = 14523213;
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 145232130;
+      }
+    };
+
+    ExpressionResult result = notInExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/AndExpressionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/AndExpressionTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/AndExpressionTest.java
new file mode 100644
index 0000000..96e3f9e
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/AndExpressionTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+
+public class AndExpressionTest {
+
+  private AndExpression andExpression;
+
+  @Before public void setUp() {
+    ColumnExpression leftExpression = new ColumnExpression("IMEI", DataType.BOOLEAN);
+    ColumnExpression rightExpression = new ColumnExpression("IMEI", DataType.BOOLEAN);
+    andExpression = new AndExpression(leftExpression, rightExpression);
+  }
+
+  @Test(expected = Exception.class) public void testEvaluateForDefault()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    RowImpl rowImpl = new RowImpl();
+    rowImpl.setValues(new Boolean[] { true });
+    final ExpressionResult expressionResult = new ExpressionResult(DataType.STRING, "test");
+    new MockUp<ColumnExpression>() {
+      @Mock public ExpressionResult evaluate(RowIntf value)
+          throws FilterUnsupportedException, FilterIllegalMemberException {
+        return expressionResult;
+      }
+    };
+    andExpression.evaluate(rowImpl);
+  }
+
+  @Test public void testEvaluate() throws FilterUnsupportedException, FilterIllegalMemberException {
+    RowImpl rowImpl = new RowImpl();
+    rowImpl.setValues(new Boolean[] { false });
+    final ExpressionResult expressionResult = new ExpressionResult(DataType.BOOLEAN, "test");
+    new MockUp<ColumnExpression>() {
+      @Mock public ExpressionResult evaluate(RowIntf value)
+          throws FilterUnsupportedException, FilterIllegalMemberException {
+        return expressionResult;
+      }
+    };
+    ExpressionResult actualValue = andExpression.evaluate(rowImpl);
+    assertTrue(actualValue instanceof ExpressionResult);
+  }
+
+  @Test public void testGetString() {
+    String actualValue = andExpression.getString();
+    String expectedValue = "And(ColumnExpression(IMEI),ColumnExpression(IMEI))";
+    assertEquals(expectedValue, actualValue);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/FalseExpressionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/FalseExpressionTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/FalseExpressionTest.java
new file mode 100644
index 0000000..0b94c22
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/FalseExpressionTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class FalseExpressionTest {
+  private FalseExpression falseExpression;
+
+  @Before public void setUp() {
+    ColumnExpression columnExpression = new ColumnExpression("IMEI", DataType.BOOLEAN);
+    falseExpression = new FalseExpression(columnExpression);
+  }
+
+  @Test public void testEvaluate() throws FilterUnsupportedException, FilterIllegalMemberException {
+    RowImpl rowImpl = new RowImpl();
+    rowImpl.setValues(new Boolean[] { true });
+    ExpressionResult actualValue = falseExpression.evaluate(rowImpl);
+    assertEquals(new ExpressionResult(DataType.BOOLEAN, false), actualValue);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/OrExpressionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/OrExpressionTest.java b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/OrExpressionTest.java
new file mode 100644
index 0000000..989824a
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/core/scan/expression/logical/OrExpressionTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.DataType;
+import org.apache.carbondata.core.scan.expression.ColumnExpression;
+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.RowImpl;
+import org.apache.carbondata.core.scan.filter.intf.RowIntf;
+
+import mockit.Mock;
+import mockit.MockUp;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.junit.Assert.assertEquals;
+
+public class OrExpressionTest {
+  private OrExpression orExpression;
+
+  @Before public void setUp() {
+    ColumnExpression leftExpression = new ColumnExpression("IMEI", DataType.BOOLEAN);
+    ColumnExpression rightExpression = new ColumnExpression("IMEI", DataType.BOOLEAN);
+    orExpression = new OrExpression(leftExpression, rightExpression);
+  }
+
+  @Test public void testGetString() {
+    String actualValue = orExpression.getString();
+    String expectedValue = "Or(ColumnExpression(IMEI),ColumnExpression(IMEI))";
+    assertEquals(expectedValue, actualValue);
+  }
+
+  @Test public void testEvaluate() throws FilterIllegalMemberException, FilterUnsupportedException {
+    RowImpl rowImpl = new RowImpl();
+    rowImpl.setValues(new Boolean[] { false });
+    final ExpressionResult expressionResult = new ExpressionResult(DataType.BOOLEAN, "test");
+    new MockUp<ColumnExpression>() {
+      @Mock public ExpressionResult evaluate(RowIntf value) {
+        return expressionResult;
+      }
+    };
+
+    assertTrue(orExpression.evaluate(rowImpl) instanceof ExpressionResult);
+  }
+
+  @Test(expected = Exception.class) public void testEvaluateForDefault()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    RowImpl rowImpl = new RowImpl();
+    rowImpl.setValues(new Boolean[] { true });
+    final ExpressionResult expressionResult = new ExpressionResult(DataType.STRING, "test");
+    new MockUp<ColumnExpression>() {
+      @Mock public ExpressionResult evaluate(RowIntf value)
+          throws FilterUnsupportedException, FilterIllegalMemberException {
+        return expressionResult;
+      }
+    };
+    orExpression.evaluate(rowImpl);
+  }
+}



Mime
View raw message