carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [2/3] incubator-carbondata git commit: add test cases for EqualToExpression
Date Mon, 12 Dec 2016 12:37:53 GMT
add test cases for EqualToExpression

test cases for EqualTo AND GreaterThanEqualTo Expression

complete test cases for expression.conditional package


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/ee2f17ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/ee2f17ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/ee2f17ac

Branch: refs/heads/master
Commit: ee2f17ac80ae9ec5345d7d31b13043e63f57d8f6
Parents: 3325013
Author: Anurag <anurag@knoldus.com>
Authored: Thu Nov 17 11:15:37 2016 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Mon Dec 12 18:06:42 2016 +0530

----------------------------------------------------------------------
 .../conditional/EqualToExpressionUnitTest.java  | 315 ++++++++++++++
 .../GreaterThanEqualToExpressionUnitTest.java   | 294 ++++++++++++++
 .../GreaterThanExpressionUnitTest.java          | 364 +++++++++++++++++
 .../conditional/InExpressionUnitTest.java       | 276 +++++++++++++
 .../LessThanEqualToExpressionUnitTest.java      | 368 +++++++++++++++++
 .../conditional/LessThanExpressionUnitTest.java | 364 +++++++++++++++++
 .../conditional/ListExpressionUnitTest.java     |  64 +++
 .../NotEqualsExpressionUnitTest.java            | 406 +++++++++++++++++++
 .../conditional/NotInExpressionUnitTest.java    | 275 +++++++++++++
 9 files changed, 2726 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/EqualToExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/EqualToExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/EqualToExpressionUnitTest.java
new file mode 100644
index 0000000..8cc344e
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/EqualToExpressionUnitTest.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.scan.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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 junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class EqualToExpressionUnitTest {
+
+  static EqualToExpression equalToExpression;
+
+  @Test public void testForEqualToExpressionWithGetString() throws Exception {
+    ColumnExpression right = new ColumnExpression("name", DataType.STRING);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    String expected_result = "EqualTo(ColumnExpression(name),ColumnExpression(name))";
+    String result = equalToExpression.getString();
+    assertEquals(expected_result, result);
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithStringDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("name", DataType.STRING);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "String1" };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public String getString() {
+        return "String1";
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithIntDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 14 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 14;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithDoubleDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DOUBLE);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 44D };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Double getDouble() {
+        return 44D;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.LONG);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 1234567654321L };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Long getLong() {
+        return 1234567654321L;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression right = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      right.setColIndex(0);
+      equalToExpression = new EqualToExpression(right, 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) };
+      Object objectRow[] = { row };
+      value.setValues(objectRow);
+
+      new MockUp<ExpressionResult>() {
+        @Mock public Long getTime() {
+          return 18465213000000L;
+        }
+      };
+
+      ExpressionResult result = equalToExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForEqualToExpressionForDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+    ExpressionResult result = equalToExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithBooleanParameter()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right, true);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row1 = { "String1" };
+    Integer[] row = { 14 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 14;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithIsNullReturnFalse()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(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 = equalToExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithNullWhileCreatingObject()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(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;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertEquals(DataType.BOOLEAN, result.getDataType());
+
+  }
+
+  @Test public void testEvaluateForEqualToExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DECIMAL);
+    right.setColIndex(0);
+    equalToExpression = new EqualToExpression(right, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(12345.0) };
+    Object objectRow[] = { row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public BigDecimal getDecimal() {
+        return new BigDecimal(12345.0);
+      }
+    };
+
+    ExpressionResult result = equalToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanEqualToExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanEqualToExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanEqualToExpressionUnitTest.java
new file mode 100644
index 0000000..c076220
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanEqualToExpressionUnitTest.java
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.scan.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.scan.filter.intf.RowImpl;
+
+import junit.framework.Assert;
+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 GreaterThanEqualToExpressionUnitTest {
+
+  static GreaterThanEqualToExpression greaterThanEqualToExpression;
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithBothStringISSame()
+      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);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row = { "string1" };
+    String[] row1 = { "string1" };
+    Object objectRow[] = { row, row1 };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public String getString() {
+        return "string1";
+      }
+    };
+    value.setValues(objectRow);
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithShortDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("id", DataType.SHORT);
+    left.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Short[] row1 = { 16 };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 16;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithIntDataType()
+      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);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Integer[] row = { 140 };
+    Integer[] row1 = { 145 };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 145;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithDoubleDataType()
+      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);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Double[] row = { 44D };
+    Double[] row1 = { 45D };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Double getDouble() {
+        return 45D;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithLongDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.LONG);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.LONG);
+    left.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Long[] row = { 1234567654321L };
+    Long[] row1 = { 1234567654321L };
+    Object objectRow[] = { row1, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Long getLong() {
+        return 1234567654321L;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithTimestampDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    try {
+      ColumnExpression left = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      left.setColIndex(0);
+      ColumnExpression right = new ColumnExpression("timestamp", DataType.TIMESTAMP);
+      right.setColIndex(1);
+      greaterThanEqualToExpression = new GreaterThanEqualToExpression(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 = greaterThanEqualToExpression.evaluate(value);
+      assertTrue(result.getBoolean());
+    } catch (ParseException e) {
+      System.out.println("Error while parsing " + e.getMessage());
+    }
+  }
+
+  @Test(expected = FilterUnsupportedException.class) public void testForGreaterThanEqualToExpressionWithDefaultCase()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.BOOLEAN);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.BOOLEAN);
+    left.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Boolean[] row = { true };
+    Object objectRow[] = { row, row };
+    value.setValues(objectRow);
+    greaterThanEqualToExpression.evaluate(value);
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithDecimalDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression right = new ColumnExpression("contact", DataType.DECIMAL);
+    right.setColIndex(0);
+    ColumnExpression left = new ColumnExpression("contact", DataType.DECIMAL);
+    left.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Decimal[] row = new Decimal[] { Decimal.apply(12345.0) };
+    Object objectRow[] = { row, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public BigDecimal getDecimal() {
+        return new BigDecimal(12345.0);
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithIsNullReturnTrue()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("id", DataType.SHORT);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("id", DataType.SHORT);
+    right.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    Short[] row = { 15 };
+    Object objectRow[] = { row, row };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public boolean isNull() {
+        return true;
+      }
+    };
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Short getShort() {
+        return 15;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertFalse(result.getBoolean());
+
+  }
+
+  @Test public void testEvaluateForGreaterThanEqualToExpressionWithLeftAndRightDifferentDataType()
+      throws FilterUnsupportedException, FilterIllegalMemberException {
+    ColumnExpression left = new ColumnExpression("name", DataType.STRING);
+    left.setColIndex(1);
+    ColumnExpression right = new ColumnExpression("number", DataType.INT);
+    right.setColIndex(0);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    RowImpl value = new RowImpl();
+    String[] row1 = { "String1" };
+    Integer[] row = { 14 };
+    Object objectRow[] = { row, row1 };
+    value.setValues(objectRow);
+
+    new MockUp<ExpressionResult>() {
+      @Mock public Integer getInt() {
+        return 14;
+      }
+    };
+
+    ExpressionResult result = greaterThanEqualToExpression.evaluate(value);
+    assertTrue(result.getBoolean());
+  }
+
+  @Test public void testForGreaterThanEqualToExpressionWithGetString() throws Exception {
+    ColumnExpression left = new ColumnExpression("left_name", DataType.STRING);
+    left.setColIndex(0);
+    ColumnExpression right = new ColumnExpression("right_name", DataType.STRING);
+    right.setColIndex(1);
+    greaterThanEqualToExpression = new GreaterThanEqualToExpression(left, right);
+    String expected_result = "GreaterThanEqualTo(ColumnExpression(left_name),ColumnExpression(right_name))";
+    String result = greaterThanEqualToExpression.getString();
+    assertEquals(expected_result, result);
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/GreaterThanExpressionUnitTest.java
new file mode 100644
index 0000000..f8ecce3
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/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.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/InExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/InExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/InExpressionUnitTest.java
new file mode 100644
index 0000000..407f6a6
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/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.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanEqualToExpressionUnitTest.java
new file mode 100644
index 0000000..1a77ec2
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/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.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/LessThanExpressionUnitTest.java
new file mode 100644
index 0000000..88beb39
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/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.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.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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/ee2f17ac/core/src/test/java/org/apache/carbondata/scan/expression/conditional/ListExpressionUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/scan/expression/conditional/ListExpressionUnitTest.java b/core/src/test/java/org/apache/carbondata/scan/expression/conditional/ListExpressionUnitTest.java
new file mode 100644
index 0000000..be15e65
--- /dev/null
+++ b/core/src/test/java/org/apache/carbondata/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.scan.expression.conditional;
+
+import java.util.List;
+
+import org.apache.carbondata.core.carbon.metadata.datatype.DataType;
+import org.apache.carbondata.scan.expression.ColumnExpression;
+import org.apache.carbondata.scan.expression.Expression;
+import org.apache.carbondata.scan.expression.ExpressionResult;
+import org.apache.carbondata.scan.expression.exception.FilterIllegalMemberException;
+import org.apache.carbondata.scan.expression.exception.FilterUnsupportedException;
+import org.apache.carbondata.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())));
+  }
+}


Mime
View raw message