carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [2/3] incubator-carbondata git commit: [CARBONDATA-32] Refactor DataType related code
Date Mon, 04 Jul 2016 17:53:14 GMT
[CARBONDATA-32] Refactor DataType related code


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

Branch: refs/heads/master
Commit: b7c285b7267a32d3e32c9a3218ae4ab72dda1f0c
Parents: d422a81
Author: chenliang613 <chenliang613@apache.org>
Authored: Mon Jul 4 23:17:57 2016 +0530
Committer: chenliang613 <chenliang613@apache.org>
Committed: Mon Jul 4 23:17:57 2016 +0530

----------------------------------------------------------------------
 .../datastore/block/SegmentProperties.java      |   2 +-
 .../core/carbon/metadata/datatype/DataType.java |  35 ++--
 .../carbondata/core/constants/DataSetUtil.java  |  38 -----
 .../org/carbondata/core/util/DataTypeUtil.java  | 126 ++++++++++++--
 .../impl/ListBasedResultCollector.java          |   2 +-
 .../scan/expression/ColumnExpression.java       |   1 +
 .../carbondata/scan/expression/DataType.java    |  35 ----
 .../scan/expression/ExpressionResult.java       | 108 ++++++------
 .../scan/expression/LiteralExpression.java      |   1 +
 .../scan/expression/UnknownExpression.java      |  19 +++
 .../expression/arithmetic/AddExpression.java    |  24 +--
 .../expression/arithmetic/DivideExpression.java |  24 +--
 .../arithmetic/MultiplyExpression.java          |  25 ++-
 .../arithmetic/SubstractExpression.java         |  24 +--
 .../conditional/EqualToExpression.java          |  20 +--
 .../GreaterThanEqualToExpression.java           |  20 +--
 .../conditional/GreaterThanExpression.java      |  20 +--
 .../expression/conditional/InExpression.java    |  18 +-
 .../conditional/LessThanEqualToExpression.java  |  20 +--
 .../conditional/LessThanExpression.java         |  20 +--
 .../conditional/NotEqualsExpression.java        |  20 +--
 .../expression/conditional/NotInExpression.java |  18 +-
 .../scan/expression/logical/AndExpression.java  |   6 +-
 .../scan/expression/logical/NotExpression.java  |   8 +-
 .../scan/expression/logical/OrExpression.java   |   6 +-
 .../org/carbondata/scan/filter/FilterUtil.java  |  20 +--
 .../executer/RowLevelFilterExecuterImpl.java    |   2 +-
 .../resolver/ConditionalFilterResolverImpl.java |   4 +-
 .../resolver/RestructureFilterResolverImpl.java |   6 +-
 .../impl/AbstractQueryResultPreparator.java     |   2 +-
 .../impl/DetailQueryResultPreparatorImpl.java   |   2 +-
 .../impl/RawQueryResultPreparatorImpl.java      |   2 +-
 .../org/carbondata/scan/util/DataTypeUtil.java  | 127 --------------
 .../hadoop/ft/CarbonInputFormat_FT.java         |   6 +-
 .../hadoop/ft/CarbonInputMapperTest.java        |   6 +-
 .../test/util/ObjectSerializationUtilTest.java  |  10 +-
 .../query/metadata/CarbonDimensionFilter.java   | 170 -------------------
 .../query/metadata/CarbonMeasureFilter.java     | 120 -------------
 .../spark/query/metadata/CarbonPlanColumn.java  |  24 ---
 .../readsupport/SparkRowReadSupportImpl.java    |   2 +-
 .../spark/sql/CarbonDictionaryDecoder.scala     |   8 +-
 .../carbondata/spark/util/CarbonScalaUtil.scala |  48 +++---
 .../csvbased/CarbonCSVBasedSeqGenStep.java      |   3 +-
 43 files changed, 400 insertions(+), 802 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentProperties.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentProperties.java b/core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentProperties.java
index bfa5cdc..c1b6b8f 100644
--- a/core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentProperties.java
+++ b/core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentProperties.java
@@ -338,7 +338,7 @@ public class SegmentProperties {
         // as complex type will be stored at last so once complex type started all the dimension
         // will be added to complex type
         else if (isComplexDimensionStarted || CarbonUtil.hasDataType(columnSchema.getDataType(),
-            new DataType[] { DataType.ARRAY, DataType.STRUCT, DataType.MAP })) {
+            new DataType[] { DataType.ARRAY, DataType.STRUCT })) {
           cardinalityIndexForComplexDimensionColumn.add(tableOrdinal);
           carbonDimension = new CarbonDimension(columnSchema, ++dimensonOrdinal, -1, -1);
           complexDimensions.add(carbonDimension);

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/core/carbon/metadata/datatype/DataType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/carbon/metadata/datatype/DataType.java b/core/src/main/java/org/carbondata/core/carbon/metadata/datatype/DataType.java
index 9f2be8a..2891702 100644
--- a/core/src/main/java/org/carbondata/core/carbon/metadata/datatype/DataType.java
+++ b/core/src/main/java/org/carbondata/core/carbon/metadata/datatype/DataType.java
@@ -16,19 +16,32 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.carbondata.core.carbon.metadata.datatype;
 
 public enum DataType {
 
-  STRING,
-  INT,
-  SHORT,
-  LONG,
-  DOUBLE,
-  BOOLEAN,
-  DECIMAL,
-  TIMESTAMP,
-  ARRAY,
-  STRUCT,
-  MAP;
+  STRING(0),
+  DATE(1),
+  TIMESTAMP(2),
+  BOOLEAN(1),
+  SHORT(2),
+  INT(3),
+  FLOAT(4),
+  LONG(5),
+  DOUBLE(6),
+  NULL(7),
+  DECIMAL(8),
+  ARRAY(9),
+  STRUCT(10);
+
+  private int presedenceOrder;
+
+  DataType(int value) {
+    this.presedenceOrder = value;
+  }
+
+  public int getPresedenceOrder() {
+    return presedenceOrder;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/core/constants/DataSetUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/constants/DataSetUtil.java b/core/src/main/java/org/carbondata/core/constants/DataSetUtil.java
deleted file mode 100644
index f8b04a2..0000000
--- a/core/src/main/java/org/carbondata/core/constants/DataSetUtil.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.carbondata.core.constants;
-
-import org.carbondata.core.util.CarbonProperties;
-
-public final class DataSetUtil {
-  public static final String DATA_SET_LOCATION =
-      CarbonProperties.getInstance().getProperty("spark.dataset.location", "../datasets/");
-
-  public static final String DP_LOCATION =
-      CarbonProperties.getInstance().getProperty("spark.dp.location", "../datapipelines/");
-
-  public static final String DATA_SOURCE_LOCATION = CarbonProperties.getInstance()
-      .getProperty("spark.sqlconnections.location",
-          "../unibi-solutions/system/dbconnection/sqlconnections.xml");
-
-  private DataSetUtil() {
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/core/util/DataTypeUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/util/DataTypeUtil.java b/core/src/main/java/org/carbondata/core/util/DataTypeUtil.java
index 68bca6c..6e2308a 100644
--- a/core/src/main/java/org/carbondata/core/util/DataTypeUtil.java
+++ b/core/src/main/java/org/carbondata/core/util/DataTypeUtil.java
@@ -1,3 +1,22 @@
+/*
+ * 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.carbondata.core.util;
 
 import java.math.BigDecimal;
@@ -7,16 +26,22 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.carbondata.common.logging.LogService;
+import org.carbondata.common.logging.LogServiceFactory;
 import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.carbon.metadata.schema.table.column.CarbonMeasure;
 import org.carbondata.core.constants.CarbonCommonConstants;
 
 import org.apache.commons.lang.NumberUtils;
-public final class DataTypeUtil {
+import org.apache.spark.unsafe.types.UTF8String;
 
-  private DataTypeUtil() {
+public final class DataTypeUtil {
 
-  }
+  /**
+   * LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(DataTypeUtil.class.getName());
 
   /**
    * This method will convert a given value to its specific type
@@ -47,7 +72,7 @@ public final class DataTypeUtil {
    * @param allowedPrecision precision configured by the user
    * @return
    */
-  public static BigDecimal normalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision) {
+  private static BigDecimal normalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision) {
     if (bigDecimal.precision() > allowedPrecision) {
       return null;
     }
@@ -146,48 +171,113 @@ public final class DataTypeUtil {
   }
 
   /**
-   * Below method will be used to basically to know whether any non parseable
-   * data is present or not. if present then return null so that system can
-   * process to default null member value.
+   * Below method will be used to basically to know whether the input data is valid string of
+   * giving data type. If there is any non parseable string is present return false.
+   */
+  public static boolean isValidData(String data, DataType actualDataType) {
+    if (null == data) {
+      return false;
+    }
+    switch (actualDataType) {
+      case SHORT:
+      case INT:
+      case LONG:
+      case DOUBLE:
+      case DECIMAL:
+        return NumberUtils.isDigits(data);
+      case TIMESTAMP:
+        if (data.isEmpty()) {
+          return false;
+        }
+        SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
+            .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
+                CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
+        try {
+          parser.parse(data);
+          return true;
+        } catch (ParseException e) {
+          return false;
+        }
+      default:
+        return false;
+    }
+  }
+
+  /**
+   * Below method will be used to convert the data passed to its actual data
+   * type
    *
    * @param data           data
    * @param actualDataType actual data type
    * @return actual data after conversion
    */
   public static Object getDataBasedOnDataType(String data, DataType actualDataType) {
-    if (null == data) {
+
+    if (null == data || data.isEmpty() || CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(data)) {
       return null;
     }
     try {
       switch (actualDataType) {
         case INT:
+          return Integer.parseInt(data);
         case SHORT:
-        case LONG:
+          return Short.parseShort(data);
         case DOUBLE:
-        case DECIMAL:
-          if (!NumberUtils.isDigits(data)) {
-            return null;
-          }
-          return data;
+          return Double.parseDouble(data);
+        case LONG:
+          return Long.parseLong(data);
         case TIMESTAMP:
-          if (data.isEmpty()) {
-            return null;
-          }
           SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
               .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
                   CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
           Date dateToStr = null;
           try {
             dateToStr = parser.parse(data);
-            return dateToStr.getTime();
+            return dateToStr.getTime() * 1000;
           } catch (ParseException e) {
+            LOGGER.error("Cannot convert" + data + " to Time/Long type value" + e.getMessage());
             return null;
           }
+        case DECIMAL:
+          java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data);
+          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
+          org.apache.spark.sql.types.Decimal decConverter =
+              new org.apache.spark.sql.types.Decimal();
+          return decConverter.set(scalaDecVal);
+        default:
+          return UTF8String.fromString(data);
+      }
+    } catch (NumberFormatException ex) {
+      LOGGER.error("Problem while converting data type" + data);
+      return null;
+    }
+
+  }
+
+  public static Object getMeasureDataBasedOnDataType(Object data, DataType dataType) {
+
+    if (null == data) {
+      return null;
+    }
+    try {
+      switch (dataType) {
+        case DOUBLE:
+          return data;
+        case LONG:
+          return data;
+        case DECIMAL:
+          java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data.toString());
+          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
+          org.apache.spark.sql.types.Decimal decConverter =
+              new org.apache.spark.sql.types.Decimal();
+          return decConverter.set(scalaDecVal);
         default:
           return data;
       }
     } catch (NumberFormatException ex) {
+      LOGGER.error("Problem while converting data type" + data);
       return null;
     }
+
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/collector/impl/ListBasedResultCollector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/collector/impl/ListBasedResultCollector.java b/core/src/main/java/org/carbondata/scan/collector/impl/ListBasedResultCollector.java
index 92507ea..c2dc2ec 100644
--- a/core/src/main/java/org/carbondata/scan/collector/impl/ListBasedResultCollector.java
+++ b/core/src/main/java/org/carbondata/scan/collector/impl/ListBasedResultCollector.java
@@ -26,6 +26,7 @@ import org.carbondata.common.logging.LogServiceFactory;
 import org.carbondata.core.carbon.datastore.chunk.MeasureColumnDataChunk;
 import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.keygenerator.KeyGenException;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.collector.ScannedResultCollector;
 import org.carbondata.scan.executor.infos.BlockExecutionInfo;
 import org.carbondata.scan.executor.infos.KeyStructureInfo;
@@ -34,7 +35,6 @@ import org.carbondata.scan.result.AbstractScannedResult;
 import org.carbondata.scan.result.ListBasedResultWrapper;
 import org.carbondata.scan.result.Result;
 import org.carbondata.scan.result.impl.ListBasedResult;
-import org.carbondata.scan.util.DataTypeUtil;
 import org.carbondata.scan.wrappers.ByteArrayWrapper;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/ColumnExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/ColumnExpression.java b/core/src/main/java/org/carbondata/scan/expression/ColumnExpression.java
index 3807d29..7263f94 100644
--- a/core/src/main/java/org/carbondata/scan/expression/ColumnExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/ColumnExpression.java
@@ -19,6 +19,7 @@
 
 package org.carbondata.scan.expression;
 
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.carbon.metadata.schema.table.column.CarbonColumn;
 import org.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension;
 import org.carbondata.scan.filter.intf.ExpressionType;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/DataType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/DataType.java b/core/src/main/java/org/carbondata/scan/expression/DataType.java
deleted file mode 100644
index 062fad1..0000000
--- a/core/src/main/java/org/carbondata/scan/expression/DataType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.carbondata.scan.expression;
-
-public enum DataType {
-  StringType(0), DateType(1), TimestampType(2), BooleanType(1), IntegerType(3), FloatType(
-      4), LongType(5), DoubleType(6), NullType(7), DecimalType(8), ArrayType(9), StructType(
-      10), ShortType(11);
-  private int presedenceOrder;
-
-  private DataType(int value) {
-    this.presedenceOrder = value;
-  }
-
-  public int getPresedenceOrder() {
-    return presedenceOrder;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java b/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
index 63afabd..c90ed06 100644
--- a/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
+++ b/core/src/main/java/org/carbondata/scan/expression/ExpressionResult.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.constants.CarbonCommonConstants;
 import org.carbondata.core.util.CarbonProperties;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -66,31 +67,26 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return Integer.parseInt(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
-
-        case ShortType:
+        case SHORT:
           return ((Short) value).intValue();
-        case IntegerType:
-        case DoubleType:
-
+        case INT:
+        case DOUBLE:
           if (value instanceof Double) {
             return ((Double) value).intValue();
           }
           return (Integer) value;
-
-        case TimestampType:
-
+        case TIMESTAMP:
           if (value instanceof Timestamp) {
             return (int) (((Timestamp) value).getTime() % 1000);
           } else {
             return (Integer) value;
           }
-
         default:
           throw new FilterIllegalMemberException(
               "Cannot convert" + this.getDataType().name() + " to integer type value");
@@ -108,15 +104,15 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return Short.parseShort(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
-        case ShortType:
-        case IntegerType:
-        case DoubleType:
+        case SHORT:
+        case INT:
+        case DOUBLE:
 
           if (value instanceof Double) {
             return ((Double) value).shortValue();
@@ -125,7 +121,7 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
           }
           return (Short) value;
 
-        case TimestampType:
+        case TIMESTAMP:
 
           if (value instanceof Timestamp) {
             return (short) (((Timestamp) value).getTime() % 1000);
@@ -150,7 +146,7 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case TimestampType:
+        case TIMESTAMP:
           SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
               .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
                   CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
@@ -175,21 +171,21 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return Double.parseDouble(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
-        case ShortType:
+        case SHORT:
           return ((Short) value).doubleValue();
-        case IntegerType:
+        case INT:
           return ((Integer) value).doubleValue();
-        case LongType:
+        case LONG:
           return ((Long) value).doubleValue();
-        case DoubleType:
+        case DOUBLE:
           return (Double) value;
-        case TimestampType:
+        case TIMESTAMP:
           if (value instanceof Timestamp) {
             return (double) ((Timestamp) value).getTime() * 1000;
           } else {
@@ -212,21 +208,21 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return Long.parseLong(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
-        case ShortType:
+        case SHORT:
           return ((Short) value).longValue();
-        case IntegerType:
+        case INT:
           return (Long) value;
-        case LongType:
+        case LONG:
           return (Long) value;
-        case DoubleType:
+        case DOUBLE:
           return (Long) value;
-        case TimestampType:
+        case TIMESTAMP:
           if (value instanceof Timestamp) {
             return 1000 * ((Timestamp) value).getTime();
           } else {
@@ -250,23 +246,23 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return new BigDecimal(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
-        case ShortType:
+        case SHORT:
           return new BigDecimal((short) value);
-        case IntegerType:
+        case INT:
           return new BigDecimal((int) value);
-        case LongType:
+        case LONG:
           return new BigDecimal((long) value);
-        case DoubleType:
+        case DOUBLE:
           return new BigDecimal((double) value);
-        case DecimalType:
+        case DECIMAL:
           return new BigDecimal(value.toString());
-        case TimestampType:
+        case TIMESTAMP:
           if (value instanceof Timestamp) {
             return new BigDecimal(1000 * ((Timestamp) value).getTime());
           } else {
@@ -289,7 +285,7 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           // Currently the query engine layer only supports yyyy-MM-dd HH:mm:ss date format
           // no matter in which format the data is been stored, so while retrieving the direct
           // surrogate value for filter member first it should be converted in date form as per
@@ -304,14 +300,14 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
             throw new FilterIllegalMemberException(
                 "Cannot convert" + this.getDataType().name() + " to Time/Long type value");
           }
-        case ShortType:
+        case SHORT:
           return ((Short) value).longValue();
-        case IntegerType:
-        case LongType:
+        case INT:
+        case LONG:
           return (Long) value;
-        case DoubleType:
+        case DOUBLE:
           return (Long) value;
-        case TimestampType:
+        case TIMESTAMP:
           if (value instanceof Timestamp) {
             return ((Timestamp) value).getTime() * 1000;
           } else {
@@ -334,14 +330,14 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           try {
             return Boolean.parseBoolean(value.toString());
           } catch (NumberFormatException e) {
             throw new FilterIllegalMemberException(e);
           }
 
-        case BooleanType:
+        case BOOLEAN:
           return Boolean.parseBoolean(value.toString());
 
         default:
@@ -408,20 +404,19 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
     }
     try {
       switch (this.getDataType()) {
-        case StringType:
+        case STRING:
           result = this.getString().equals(objToCompare.getString());
           break;
-        case ShortType:
+        case SHORT:
           result = this.getShort().equals(objToCompare.getShort());
           break;
-        case IntegerType:
+        case INT:
           result = this.getInt().equals(objToCompare.getInt());
           break;
-
-        case DoubleType:
+        case DOUBLE:
           result = this.getDouble().equals(objToCompare.getDouble());
           break;
-        case TimestampType:
+        case TIMESTAMP:
           result = this.getLong().equals(objToCompare.getLong());
           break;
         default:
@@ -441,19 +436,18 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
   @Override public int compareTo(ExpressionResult o) {
     try {
       switch (o.dataType) {
-        case ShortType:
-        case IntegerType:
-        case LongType:
-        case DoubleType:
-
+        case SHORT:
+        case INT:
+        case LONG:
+        case DOUBLE:
           Double d1 = this.getDouble();
           Double d2 = o.getDouble();
           return d1.compareTo(d2);
-        case DecimalType:
+        case DECIMAL:
           java.math.BigDecimal val1 = this.getDecimal();
           java.math.BigDecimal val2 = o.getDecimal();
           return val1.compareTo(val2);
-        case TimestampType:
+        case TIMESTAMP:
           SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
               .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
                   CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
@@ -462,7 +456,7 @@ public class ExpressionResult implements Comparable<ExpressionResult> {
           date1 = parser.parse(this.getString());
           date2 = parser.parse(o.getString());
           return date1.compareTo(date2);
-        case StringType:
+        case STRING:
         default:
           return this.getString().compareTo(o.getString());
       }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java b/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
index edbaf44..cd48c4c 100644
--- a/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/LiteralExpression.java
@@ -19,6 +19,7 @@
 
 package org.carbondata.scan.expression;
 
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.filter.intf.ExpressionType;
 import org.carbondata.scan.filter.intf.RowIntf;
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java b/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
index 3f24e1c..42624b1 100644
--- a/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/UnknownExpression.java
@@ -1,3 +1,22 @@
+/*
+ * 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.carbondata.scan.expression;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
index 5bc1373..589e2c3 100644
--- a/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/arithmetic/AddExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.arithmetic;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -53,21 +53,21 @@ public class AddExpression extends BinaryArithmeticExpression {
       }
     }
     switch (val1.getDataType()) {
-      case StringType:
-      case DoubleType:
-        addExprRightRes.set(DataType.DoubleType, val1.getDouble() + val2.getDouble());
+      case STRING:
+      case DOUBLE:
+        addExprRightRes.set(DataType.DOUBLE, val1.getDouble() + val2.getDouble());
         break;
-      case ShortType:
-        addExprRightRes.set(DataType.ShortType, val1.getShort() + val2.getShort());
+      case SHORT:
+        addExprRightRes.set(DataType.SHORT, val1.getShort() + val2.getShort());
         break;
-      case IntegerType:
-        addExprRightRes.set(DataType.IntegerType, val1.getInt() + val2.getInt());
+      case INT:
+        addExprRightRes.set(DataType.INT, val1.getInt() + val2.getInt());
         break;
-      case LongType:
-        addExprRightRes.set(DataType.LongType, val1.getLong() + val2.getLong());
+      case LONG:
+        addExprRightRes.set(DataType.LONG, val1.getLong() + val2.getLong());
         break;
-      case DecimalType:
-        addExprRightRes.set(DataType.DecimalType, val1.getDecimal().add(val2.getDecimal()));
+      case DECIMAL:
+        addExprRightRes.set(DataType.DECIMAL, val1.getDecimal().add(val2.getDecimal()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
index 3e858e2..e41bee4 100644
--- a/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/arithmetic/DivideExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.arithmetic;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -52,21 +52,21 @@ public class DivideExpression extends BinaryArithmeticExpression {
       }
     }
     switch (val1.getDataType()) {
-      case StringType:
-      case DoubleType:
-        divideExprRightRes.set(DataType.DoubleType, val1.getDouble() / val2.getDouble());
+      case STRING:
+      case DOUBLE:
+        divideExprRightRes.set(DataType.DOUBLE, val1.getDouble() / val2.getDouble());
         break;
-      case ShortType:
-        divideExprRightRes.set(DataType.ShortType, val1.getShort() / val2.getShort());
+      case SHORT:
+        divideExprRightRes.set(DataType.SHORT, val1.getShort() / val2.getShort());
         break;
-      case IntegerType:
-        divideExprRightRes.set(DataType.IntegerType, val1.getInt() / val2.getInt());
+      case INT:
+        divideExprRightRes.set(DataType.INT, val1.getInt() / val2.getInt());
         break;
-      case LongType:
-        divideExprRightRes.set(DataType.LongType, val1.getLong() / val2.getLong());
+      case LONG:
+        divideExprRightRes.set(DataType.LONG, val1.getLong() / val2.getLong());
         break;
-      case DecimalType:
-        divideExprRightRes.set(DataType.DecimalType, val1.getDecimal().divide(val2.getDecimal()));
+      case DECIMAL:
+        divideExprRightRes.set(DataType.DECIMAL, val1.getDecimal().divide(val2.getDecimal()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
index 72b45c7..7c790d8 100644
--- a/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/arithmetic/MultiplyExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.arithmetic;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -53,22 +53,21 @@ public class MultiplyExpression extends BinaryArithmeticExpression {
       }
     }
     switch (val1.getDataType()) {
-      case StringType:
-      case DoubleType:
-        multiplyExprRightRes.set(DataType.DoubleType, val1.getDouble() * val2.getDouble());
+      case STRING:
+      case DOUBLE:
+        multiplyExprRightRes.set(DataType.DOUBLE, val1.getDouble() * val2.getDouble());
         break;
-      case ShortType:
-        multiplyExprRightRes.set(DataType.ShortType, val1.getShort() * val2.getShort());
+      case SHORT:
+        multiplyExprRightRes.set(DataType.SHORT, val1.getShort() * val2.getShort());
         break;
-      case IntegerType:
-        multiplyExprRightRes.set(DataType.IntegerType, val1.getInt() * val2.getInt());
+      case INT:
+        multiplyExprRightRes.set(DataType.INT, val1.getInt() * val2.getInt());
         break;
-      case LongType:
-        multiplyExprRightRes.set(DataType.LongType, val1.getLong() * val2.getLong());
+      case LONG:
+        multiplyExprRightRes.set(DataType.LONG, val1.getLong() * val2.getLong());
         break;
-      case DecimalType:
-        multiplyExprRightRes
-            .set(DataType.DecimalType, val1.getDecimal().multiply(val2.getDecimal()));
+      case DECIMAL:
+        multiplyExprRightRes.set(DataType.DECIMAL, val1.getDecimal().multiply(val2.getDecimal()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java b/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
index b65b032..682b725 100644
--- a/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/arithmetic/SubstractExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.arithmetic;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -53,22 +53,22 @@ public class SubstractExpression extends BinaryArithmeticExpression {
       }
     }
     switch (val1.getDataType()) {
-      case StringType:
-      case DoubleType:
-        subtractExprRightRes.set(DataType.DoubleType, val1.getDouble() - val2.getDouble());
+      case STRING:
+      case DOUBLE:
+        subtractExprRightRes.set(DataType.DOUBLE, val1.getDouble() - val2.getDouble());
         break;
-      case ShortType:
-        subtractExprRightRes.set(DataType.ShortType, val1.getShort() - val2.getShort());
+      case SHORT:
+        subtractExprRightRes.set(DataType.SHORT, val1.getShort() - val2.getShort());
         break;
-      case IntegerType:
-        subtractExprRightRes.set(DataType.IntegerType, val1.getInt() - val2.getInt());
+      case INT:
+        subtractExprRightRes.set(DataType.INT, val1.getInt() - val2.getInt());
         break;
-      case LongType:
-        subtractExprRightRes.set(DataType.LongType, val1.getLong() - val2.getLong());
+      case LONG:
+        subtractExprRightRes.set(DataType.LONG, val1.getLong() - val2.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         subtractExprRightRes
-            .set(DataType.DecimalType, val1.getDecimal().subtract(val2.getDecimal()));
+            .set(DataType.DECIMAL, val1.getDecimal().subtract(val2.getDecimal()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
index ce8be43..18d492d 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/EqualToExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -47,7 +47,7 @@ public class EqualToExpression extends BinaryConditionalExpression {
 
     if (elRes.isNull() || erRes.isNull()) {
       result = elRes.isNull() && erRes.isNull();
-      val1.set(DataType.BooleanType, result);
+      val1.set(DataType.BOOLEAN, result);
       return val1;
     }
     //default implementation if the data types are different for the resultsets
@@ -59,32 +59,32 @@ public class EqualToExpression extends BinaryConditionalExpression {
     }
 
     switch (val1.getDataType()) {
-      case StringType:
+      case STRING:
         result = val1.getString().equals(val2.getString());
         break;
-      case ShortType:
+      case SHORT:
         result = val1.getShort().equals(val2.getShort());
         break;
-      case IntegerType:
+      case INT:
         result = val1.getInt().equals(val2.getInt());
         break;
-      case DoubleType:
+      case DOUBLE:
         result = val1.getDouble().equals(val2.getDouble());
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = val1.getTime().equals(val2.getTime());
         break;
-      case LongType:
+      case LONG:
         result = val1.getLong().equals(val2.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         result = val1.getDecimal().compareTo(val2.getDecimal()) == 0;
         break;
       default:
         throw new FilterUnsupportedException(
             "DataType: " + val1.getDataType() + " not supported for the filter expression");
     }
-    val1.set(DataType.BooleanType, result);
+    val1.set(DataType.BOOLEAN, result);
     return val1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
index 5318408..ef562f0 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanEqualToExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -40,7 +40,7 @@ public class GreaterThanEqualToExpression extends BinaryConditionalExpression {
     ExpressionResult erRes = right.evaluate(value);
     ExpressionResult exprResVal1 = elRes;
     if (elRes.isNull() || erRes.isNull()) {
-      elRes.set(DataType.BooleanType, false);
+      elRes.set(DataType.BOOLEAN, false);
       return elRes;
     }
     if (elRes.getDataType() != erRes.getDataType()) {
@@ -51,32 +51,32 @@ public class GreaterThanEqualToExpression extends BinaryConditionalExpression {
     }
     boolean result = false;
     switch (exprResVal1.getDataType()) {
-      case StringType:
+      case STRING:
         result = elRes.getString().compareTo(erRes.getString()) >= 0;
         break;
-      case ShortType:
+      case SHORT:
         result = elRes.getShort() >= (erRes.getShort());
         break;
-      case IntegerType:
+      case INT:
         result = elRes.getInt() >= (erRes.getInt());
         break;
-      case DoubleType:
+      case DOUBLE:
         result = elRes.getDouble() >= (erRes.getDouble());
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = elRes.getTime() >= (erRes.getTime());
         break;
-      case LongType:
+      case LONG:
         result = elRes.getLong() >= (erRes.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         result = elRes.getDecimal().compareTo(erRes.getDecimal()) >= 0;
         break;
       default:
         throw new FilterUnsupportedException(
             "DataType: " + exprResVal1.getDataType() + " not supported for the filter expression");
     }
-    exprResVal1.set(DataType.BooleanType, result);
+    exprResVal1.set(DataType.BOOLEAN, result);
     return exprResVal1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
index 59ff84f..ff2ff92 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/GreaterThanExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -41,7 +41,7 @@ public class GreaterThanExpression extends BinaryConditionalExpression {
     ExpressionResult exprRightRes = right.evaluate(value);
     ExpressionResult val1 = exprLeftRes;
     if (exprLeftRes.isNull() || exprRightRes.isNull()) {
-      exprLeftRes.set(DataType.BooleanType, false);
+      exprLeftRes.set(DataType.BOOLEAN, false);
       return exprLeftRes;
     }
     if (exprLeftRes.getDataType() != exprRightRes.getDataType()) {
@@ -53,32 +53,32 @@ public class GreaterThanExpression extends BinaryConditionalExpression {
     }
     boolean result = false;
     switch (val1.getDataType()) {
-      case StringType:
+      case STRING:
         result = exprLeftRes.getString().compareTo(exprRightRes.getString()) > 0;
         break;
-      case DoubleType:
+      case DOUBLE:
         result = exprLeftRes.getDouble() > (exprRightRes.getDouble());
         break;
-      case ShortType:
+      case SHORT:
         result = exprLeftRes.getShort() > (exprRightRes.getShort());
         break;
-      case IntegerType:
+      case INT:
         result = exprLeftRes.getInt() > (exprRightRes.getInt());
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = exprLeftRes.getTime() > (exprRightRes.getTime());
         break;
-      case LongType:
+      case LONG:
         result = exprLeftRes.getLong() > (exprRightRes.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         result = exprLeftRes.getDecimal().compareTo(exprRightRes.getDecimal()) > 0;
         break;
       default:
         throw new FilterUnsupportedException(
             "DataType: " + val1.getDataType() + " not supported for the filter expression");
     }
-    val1.set(DataType.BooleanType, result);
+    val1.set(DataType.BOOLEAN, result);
     return val1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
index 06e6ec6..ff7586e 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/InExpression.java
@@ -22,7 +22,7 @@ package org.carbondata.scan.expression.conditional;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -57,25 +57,25 @@ public class InExpression extends BinaryConditionalExpression {
             val = expressionResVal;
           }
           switch (val.getDataType()) {
-            case StringType:
+            case STRING:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getString());
               break;
-            case ShortType:
+            case SHORT:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getShort());
               break;
-            case IntegerType:
+            case INT:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getInt());
               break;
-            case DoubleType:
+            case DOUBLE:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getDouble());
               break;
-            case TimestampType:
+            case TIMESTAMP:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getTime());
               break;
-            case LongType:
+            case LONG:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getLong());
               break;
-            case DecimalType:
+            case DECIMAL:
               val = new ExpressionResult(val.getDataType(), expressionResVal.getDecimal());
               break;
             default:
@@ -87,7 +87,7 @@ public class InExpression extends BinaryConditionalExpression {
 
       }
     }
-    leftRsult.set(DataType.BooleanType, setOfExprResult.contains(leftRsult));
+    leftRsult.set(DataType.BOOLEAN, setOfExprResult.contains(leftRsult));
     return leftRsult;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
index 54e7dd4..500531e 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanEqualToExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -40,7 +40,7 @@ public class LessThanEqualToExpression extends BinaryConditionalExpression {
     ExpressionResult erRes = right.evaluate(value);
     ExpressionResult exprResValue1 = elRes;
     if (elRes.isNull() || erRes.isNull()) {
-      elRes.set(DataType.BooleanType, false);
+      elRes.set(DataType.BOOLEAN, false);
       return elRes;
     }
     if (elRes.getDataType() != erRes.getDataType()) {
@@ -51,32 +51,32 @@ public class LessThanEqualToExpression extends BinaryConditionalExpression {
     }
     boolean result = false;
     switch (exprResValue1.getDataType()) {
-      case StringType:
+      case STRING:
         result = elRes.getString().compareTo(erRes.getString()) <= 0;
         break;
-      case ShortType:
+      case SHORT:
         result = elRes.getShort() <= (erRes.getShort());
         break;
-      case IntegerType:
+      case INT:
         result = elRes.getInt() <= (erRes.getInt());
         break;
-      case DoubleType:
+      case DOUBLE:
         result = elRes.getDouble() <= (erRes.getDouble());
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = elRes.getTime() <= (erRes.getTime());
         break;
-      case LongType:
+      case LONG:
         result = elRes.getLong() <= (erRes.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         result = elRes.getDecimal().compareTo(erRes.getDecimal()) <= 0;
         break;
       default:
         throw new FilterUnsupportedException("DataType: " + exprResValue1.getDataType()
             + " not supported for the filter expression");
     }
-    exprResValue1.set(DataType.BooleanType, result);
+    exprResValue1.set(DataType.BOOLEAN, result);
     return exprResValue1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
index 52ca777..74d80ed 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/LessThanExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -45,7 +45,7 @@ public class LessThanExpression extends BinaryConditionalExpression {
     boolean result = false;
 
     if (elRes.isNull() || erRes.isNull()) {
-      elRes.set(DataType.BooleanType, false);
+      elRes.set(DataType.BOOLEAN, false);
       return elRes;
     }
     if (elRes.getDataType() != erRes.getDataType()) {
@@ -55,32 +55,32 @@ public class LessThanExpression extends BinaryConditionalExpression {
 
     }
     switch (val1.getDataType()) {
-      case StringType:
+      case STRING:
         result = elRes.getString().compareTo(erRes.getString()) < 0;
         break;
-      case ShortType:
+      case SHORT:
         result = elRes.getShort() < (erRes.getShort());
         break;
-      case IntegerType:
+      case INT:
         result = elRes.getInt() < (erRes.getInt());
         break;
-      case DoubleType:
+      case DOUBLE:
         result = elRes.getDouble() < (erRes.getDouble());
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = elRes.getTime() < (erRes.getTime());
         break;
-      case LongType:
+      case LONG:
         result = elRes.getLong() < (erRes.getLong());
         break;
-      case DecimalType:
+      case DECIMAL:
         result = elRes.getDecimal().compareTo(erRes.getDecimal()) < 0;
         break;
       default:
         throw new FilterUnsupportedException(
             "DataType: " + val1.getDataType() + " not supported for the filter expression");
     }
-    val1.set(DataType.BooleanType, result);
+    val1.set(DataType.BOOLEAN, result);
     return val1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
index 4f9a3d1..a5d1fbe 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/NotEqualsExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.conditional;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -46,7 +46,7 @@ public class NotEqualsExpression extends BinaryConditionalExpression {
 
     if (elRes.isNull() || erRes.isNull()) {
       result = elRes.isNull() != erRes.isNull();
-      val1.set(DataType.BooleanType, result);
+      val1.set(DataType.BOOLEAN, result);
       return val1;
     }
 
@@ -59,32 +59,32 @@ public class NotEqualsExpression extends BinaryConditionalExpression {
       }
     }
     switch (val1.getDataType()) {
-      case StringType:
+      case STRING:
         result = !val1.getString().equals(val2.getString());
         break;
-      case ShortType:
+      case SHORT:
         result = val1.getShort().shortValue() != val2.getShort().shortValue();
         break;
-      case IntegerType:
+      case INT:
         result = val1.getInt().intValue() != val2.getInt().intValue();
         break;
-      case DoubleType:
+      case DOUBLE:
         result = val1.getDouble().doubleValue() != val2.getDouble().doubleValue();
         break;
-      case TimestampType:
+      case TIMESTAMP:
         result = val1.getTime().longValue() != val2.getTime().longValue();
         break;
-      case LongType:
+      case LONG:
         result = elRes.getLong().longValue() != (erRes.getLong()).longValue();
         break;
-      case DecimalType:
+      case DECIMAL:
         result = elRes.getDecimal().compareTo(erRes.getDecimal()) != 0;
         break;
       default:
         throw new FilterUnsupportedException(
             "DataType: " + val1.getDataType() + " not supported for the filter expression");
     }
-    val1.set(DataType.BooleanType, result);
+    val1.set(DataType.BOOLEAN, result);
     return val1;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java b/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
index eb9e6f6..e2f7698 100644
--- a/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/conditional/NotInExpression.java
@@ -22,7 +22,7 @@ package org.carbondata.scan.expression.conditional;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -57,25 +57,25 @@ public class NotInExpression extends BinaryConditionalExpression {
             val = exprResVal;
           }
           switch (val.getDataType()) {
-            case StringType:
+            case STRING:
               val = new ExpressionResult(val.getDataType(), exprResVal.getString());
               break;
-            case ShortType:
+            case SHORT:
               val = new ExpressionResult(val.getDataType(), exprResVal.getShort());
               break;
-            case IntegerType:
+            case INT:
               val = new ExpressionResult(val.getDataType(), exprResVal.getInt());
               break;
-            case DoubleType:
+            case DOUBLE:
               val = new ExpressionResult(val.getDataType(), exprResVal.getDouble());
               break;
-            case TimestampType:
+            case TIMESTAMP:
               val = new ExpressionResult(val.getDataType(), exprResVal.getTime());
               break;
-            case LongType:
+            case LONG:
               val = new ExpressionResult(val.getDataType(), exprResVal.getLong());
               break;
-            case DecimalType:
+            case DECIMAL:
               val = new ExpressionResult(val.getDataType(), exprResVal.getDecimal());
               break;
             default:
@@ -87,7 +87,7 @@ public class NotInExpression extends BinaryConditionalExpression {
 
       }
     }
-    leftRsult.set(DataType.BooleanType, !setOfExprResult.contains(leftRsult));
+    leftRsult.set(DataType.BOOLEAN, !setOfExprResult.contains(leftRsult));
 
     return leftRsult;
   }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/logical/AndExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/logical/AndExpression.java b/core/src/main/java/org/carbondata/scan/expression/logical/AndExpression.java
index 3a847bf..b06a232 100644
--- a/core/src/main/java/org/carbondata/scan/expression/logical/AndExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/logical/AndExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.logical;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -40,8 +40,8 @@ public class AndExpression extends BinaryLogicalExpression {
     ExpressionResult resultLeft = left.evaluate(value);
     ExpressionResult resultRight = right.evaluate(value);
     switch (resultLeft.getDataType()) {
-      case BooleanType:
-        resultLeft.set(DataType.BooleanType, (resultLeft.getBoolean() && resultRight.getBoolean()));
+      case BOOLEAN:
+        resultLeft.set(DataType.BOOLEAN, (resultLeft.getBoolean() && resultRight.getBoolean()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/logical/NotExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/logical/NotExpression.java b/core/src/main/java/org/carbondata/scan/expression/logical/NotExpression.java
index dba58aa..0d0128a 100644
--- a/core/src/main/java/org/carbondata/scan/expression/logical/NotExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/logical/NotExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.logical;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.UnaryExpression;
@@ -38,10 +38,10 @@ public class NotExpression extends UnaryExpression {
   @Override public ExpressionResult evaluate(RowIntf value)
       throws FilterIllegalMemberException, FilterUnsupportedException {
     ExpressionResult expResult = child.evaluate(value);
-    expResult.set(DataType.BooleanType, !(expResult.getBoolean()));
+    expResult.set(DataType.BOOLEAN, !(expResult.getBoolean()));
     switch (expResult.getDataType()) {
-      case BooleanType:
-        expResult.set(DataType.BooleanType, !(expResult.getBoolean()));
+      case BOOLEAN:
+        expResult.set(DataType.BOOLEAN, !(expResult.getBoolean()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/expression/logical/OrExpression.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/expression/logical/OrExpression.java b/core/src/main/java/org/carbondata/scan/expression/logical/OrExpression.java
index 43adbf4..69f699c 100644
--- a/core/src/main/java/org/carbondata/scan/expression/logical/OrExpression.java
+++ b/core/src/main/java/org/carbondata/scan/expression/logical/OrExpression.java
@@ -19,7 +19,7 @@
 
 package org.carbondata.scan.expression.logical;
 
-import org.carbondata.scan.expression.DataType;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.ExpressionResult;
 import org.carbondata.scan.expression.exception.FilterIllegalMemberException;
@@ -40,8 +40,8 @@ public class OrExpression extends BinaryLogicalExpression {
     ExpressionResult resultLeft = left.evaluate(value);
     ExpressionResult resultRight = right.evaluate(value);
     switch (resultLeft.getDataType()) {
-      case BooleanType:
-        resultLeft.set(DataType.BooleanType, (resultLeft.getBoolean() || resultRight.getBoolean()));
+      case BOOLEAN:
+        resultLeft.set(DataType.BOOLEAN, (resultLeft.getBoolean() || resultRight.getBoolean()));
         break;
       default:
         throw new FilterUnsupportedException(

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/filter/FilterUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/filter/FilterUtil.java b/core/src/main/java/org/carbondata/scan/filter/FilterUtil.java
index cafba7d..a991d0f 100644
--- a/core/src/main/java/org/carbondata/scan/filter/FilterUtil.java
+++ b/core/src/main/java/org/carbondata/scan/filter/FilterUtil.java
@@ -59,6 +59,7 @@ import org.carbondata.core.util.ByteUtil;
 import org.carbondata.core.util.CarbonProperties;
 import org.carbondata.core.util.CarbonUtil;
 import org.carbondata.core.util.CarbonUtilException;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.executor.exception.QueryExecutionException;
 import org.carbondata.scan.expression.ColumnExpression;
 import org.carbondata.scan.expression.Expression;
@@ -84,7 +85,6 @@ import org.carbondata.scan.filter.intf.RowIntf;
 import org.carbondata.scan.filter.resolver.FilterResolverIntf;
 import org.carbondata.scan.filter.resolver.RowLevelFilterResolverImpl;
 import org.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
-import org.carbondata.scan.util.DataTypeUtil;
 
 public final class FilterUtil {
   private static final LogService LOGGER =
@@ -1150,13 +1150,13 @@ public final class FilterUtil {
   }
 
   private static int compareFilterMembersBasedOnActualDataType(String filterMember1,
-      String filterMember2, org.carbondata.scan.expression.DataType dataType) {
+      String filterMember2, DataType dataType) {
     try {
       switch (dataType) {
-        case ShortType:
-        case IntegerType:
-        case LongType:
-        case DoubleType:
+        case SHORT:
+        case INT:
+        case LONG:
+        case DOUBLE:
 
           if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(filterMember1)) {
             return 1;
@@ -1164,14 +1164,14 @@ public final class FilterUtil {
           Double d1 = Double.parseDouble(filterMember1);
           Double d2 = Double.parseDouble(filterMember2);
           return d1.compareTo(d2);
-        case DecimalType:
+        case DECIMAL:
           if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(filterMember1)) {
             return 1;
           }
           java.math.BigDecimal val1 = new BigDecimal(filterMember1);
           java.math.BigDecimal val2 = new BigDecimal(filterMember2);
           return val1.compareTo(val2);
-        case TimestampType:
+        case TIMESTAMP:
           if (CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(filterMember1)) {
             return 1;
           }
@@ -1183,7 +1183,7 @@ public final class FilterUtil {
           date1 = parser.parse(filterMember1);
           date2 = parser.parse(filterMember2);
           return date1.compareTo(date2);
-        case StringType:
+        case STRING:
         default:
           return filterMember1.compareTo(filterMember2);
       }
@@ -1278,7 +1278,7 @@ public final class FilterUtil {
    */
   public static boolean isExpressionNeedsToResolved(Expression rightExp, boolean isIncludeFilter) {
     if (!isIncludeFilter && rightExp instanceof LiteralExpression && (
-        org.carbondata.scan.expression.DataType.NullType == ((LiteralExpression) rightExp)
+        DataType.NULL == ((LiteralExpression) rightExp)
             .getLiteralExpDataType())) {
       return true;
     }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/filter/executer/RowLevelFilterExecuterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/filter/executer/RowLevelFilterExecuterImpl.java b/core/src/main/java/org/carbondata/scan/filter/executer/RowLevelFilterExecuterImpl.java
index 9199907..1fa9b30 100644
--- a/core/src/main/java/org/carbondata/scan/filter/executer/RowLevelFilterExecuterImpl.java
+++ b/core/src/main/java/org/carbondata/scan/filter/executer/RowLevelFilterExecuterImpl.java
@@ -37,6 +37,7 @@ import org.carbondata.core.keygenerator.KeyGenException;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
 import org.carbondata.core.util.CarbonUtil;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.executor.exception.QueryExecutionException;
 import org.carbondata.scan.executor.infos.KeyStructureInfo;
 import org.carbondata.scan.executor.util.QueryUtil;
@@ -50,7 +51,6 @@ import org.carbondata.scan.filter.intf.RowIntf;
 import org.carbondata.scan.filter.resolver.resolverinfo.DimColumnResolvedFilterInfo;
 import org.carbondata.scan.filter.resolver.resolverinfo.MeasureColumnResolvedFilterInfo;
 import org.carbondata.scan.processor.BlocksChunkHolder;
-import org.carbondata.scan.util.DataTypeUtil;
 
 public class RowLevelFilterExecuterImpl implements FilterExecuter {
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java b/core/src/main/java/org/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
index bbef2d5..ff8d531 100644
--- a/core/src/main/java/org/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
+++ b/core/src/main/java/org/carbondata/scan/filter/resolver/ConditionalFilterResolverImpl.java
@@ -23,11 +23,11 @@ import java.util.SortedMap;
 
 import org.carbondata.core.carbon.AbsoluteTableIdentifier;
 import org.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.carbon.metadata.encoder.Encoding;
 import org.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension;
 import org.carbondata.scan.executor.exception.QueryExecutionException;
 import org.carbondata.scan.expression.ColumnExpression;
-import org.carbondata.scan.expression.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.conditional.BinaryConditionalExpression;
 import org.carbondata.scan.expression.conditional.ConditionalExpression;
@@ -103,7 +103,7 @@ public class ConditionalFilterResolverImpl implements FilterResolverIntf {
         metadata.setColumnExpression(columnExpression);
         metadata.setExpression(leftExp);
         metadata.setIncludeFilter(isIncludeFilter);
-        if (columnExpression.getDataType().equals(DataType.TimestampType)) {
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
           isExpressionResolve = true;
         } else {
           // if imei=imei comes in filter condition then we need to

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java b/core/src/main/java/org/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
index a04e5b4..da71c22 100644
--- a/core/src/main/java/org/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
+++ b/core/src/main/java/org/carbondata/scan/filter/resolver/RestructureFilterResolverImpl.java
@@ -24,8 +24,8 @@ import java.util.SortedMap;
 
 import org.carbondata.core.carbon.AbsoluteTableIdentifier;
 import org.carbondata.core.carbon.datastore.block.SegmentProperties;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.scan.expression.ColumnExpression;
-import org.carbondata.scan.expression.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.conditional.BinaryConditionalExpression;
 import org.carbondata.scan.expression.conditional.ConditionalExpression;
@@ -79,7 +79,7 @@ public class RestructureFilterResolverImpl implements FilterResolverIntf {
       Expression right = binaryConditionalExpression.getRight();
       if (left instanceof ColumnExpression) {
         ColumnExpression columnExpression = (ColumnExpression) left;
-        if (columnExpression.getDataType().equals(DataType.TimestampType)) {
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
           isExpressionResolve = true;
         } else {
           // If imei=imei comes in filter condition then we need to
@@ -99,7 +99,7 @@ public class RestructureFilterResolverImpl implements FilterResolverIntf {
         }
       } else if (right instanceof ColumnExpression) {
         ColumnExpression columnExpression = (ColumnExpression) right;
-        if (columnExpression.getDataType().equals(DataType.TimestampType)) {
+        if (columnExpression.getDataType().equals(DataType.TIMESTAMP)) {
           isExpressionResolve = true;
         } else {
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/result/preparator/impl/AbstractQueryResultPreparator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/result/preparator/impl/AbstractQueryResultPreparator.java b/core/src/main/java/org/carbondata/scan/result/preparator/impl/AbstractQueryResultPreparator.java
index a42dc67..fd6f1c8 100644
--- a/core/src/main/java/org/carbondata/scan/result/preparator/impl/AbstractQueryResultPreparator.java
+++ b/core/src/main/java/org/carbondata/scan/result/preparator/impl/AbstractQueryResultPreparator.java
@@ -6,12 +6,12 @@ import org.carbondata.core.carbon.metadata.encoder.Encoding;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
 import org.carbondata.core.util.CarbonUtil;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.executor.impl.QueryExecutorProperties;
 import org.carbondata.scan.model.QueryDimension;
 import org.carbondata.scan.model.QueryModel;
 import org.carbondata.scan.result.BatchResult;
 import org.carbondata.scan.result.preparator.QueryResultPreparator;
-import org.carbondata.scan.util.DataTypeUtil;
 
 public abstract class AbstractQueryResultPreparator<K, V> implements QueryResultPreparator<K, V> {
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/result/preparator/impl/DetailQueryResultPreparatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/result/preparator/impl/DetailQueryResultPreparatorImpl.java b/core/src/main/java/org/carbondata/scan/result/preparator/impl/DetailQueryResultPreparatorImpl.java
index 17735bc..b1fe64b 100644
--- a/core/src/main/java/org/carbondata/scan/result/preparator/impl/DetailQueryResultPreparatorImpl.java
+++ b/core/src/main/java/org/carbondata/scan/result/preparator/impl/DetailQueryResultPreparatorImpl.java
@@ -26,6 +26,7 @@ import org.carbondata.common.logging.LogServiceFactory;
 import org.carbondata.core.carbon.metadata.encoder.Encoding;
 import org.carbondata.core.constants.CarbonCommonConstants;
 import org.carbondata.core.util.CarbonUtil;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.executor.impl.QueryExecutorProperties;
 import org.carbondata.scan.model.QueryDimension;
 import org.carbondata.scan.model.QueryMeasure;
@@ -33,7 +34,6 @@ import org.carbondata.scan.model.QueryModel;
 import org.carbondata.scan.result.BatchResult;
 import org.carbondata.scan.result.ListBasedResultWrapper;
 import org.carbondata.scan.result.Result;
-import org.carbondata.scan.util.DataTypeUtil;
 import org.carbondata.scan.wrappers.ByteArrayWrapper;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/result/preparator/impl/RawQueryResultPreparatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/result/preparator/impl/RawQueryResultPreparatorImpl.java b/core/src/main/java/org/carbondata/scan/result/preparator/impl/RawQueryResultPreparatorImpl.java
index 75d78a2..8a38efe 100644
--- a/core/src/main/java/org/carbondata/scan/result/preparator/impl/RawQueryResultPreparatorImpl.java
+++ b/core/src/main/java/org/carbondata/scan/result/preparator/impl/RawQueryResultPreparatorImpl.java
@@ -7,6 +7,7 @@ import org.carbondata.common.logging.LogServiceFactory;
 import org.carbondata.core.carbon.metadata.encoder.Encoding;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryGenerator;
 import org.carbondata.core.keygenerator.directdictionary.DirectDictionaryKeyGeneratorFactory;
+import org.carbondata.core.util.DataTypeUtil;
 import org.carbondata.scan.executor.impl.QueryExecutorProperties;
 import org.carbondata.scan.model.QueryDimension;
 import org.carbondata.scan.model.QueryMeasure;
@@ -16,7 +17,6 @@ import org.carbondata.scan.result.BatchRawResult;
 import org.carbondata.scan.result.BatchResult;
 import org.carbondata.scan.result.ListBasedResultWrapper;
 import org.carbondata.scan.result.Result;
-import org.carbondata.scan.util.DataTypeUtil;
 import org.carbondata.scan.wrappers.ByteArrayWrapper;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/core/src/main/java/org/carbondata/scan/util/DataTypeUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/scan/util/DataTypeUtil.java b/core/src/main/java/org/carbondata/scan/util/DataTypeUtil.java
deleted file mode 100644
index 86828f0..0000000
--- a/core/src/main/java/org/carbondata/scan/util/DataTypeUtil.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.carbondata.scan.util;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.carbondata.common.logging.LogService;
-import org.carbondata.common.logging.LogServiceFactory;
-import org.carbondata.core.carbon.metadata.datatype.DataType;
-import org.carbondata.core.constants.CarbonCommonConstants;
-import org.carbondata.core.util.CarbonProperties;
-
-import org.apache.spark.unsafe.types.UTF8String;
-
-/**
- * Utility for data type
- */
-public class DataTypeUtil {
-
-  /**
-   * LOGGER
-   */
-  private static final LogService LOGGER =
-      LogServiceFactory.getLogService(DataTypeUtil.class.getName());
-
-  /**
-   * Below method will be used to convert the data passed to its actual data
-   * type
-   *
-   * @param data           data
-   * @param actualDataType actual data type
-   * @return actual data after conversion
-   */
-  public static Object getDataBasedOnDataType(String data, DataType actualDataType) {
-
-    if (null == data || data.isEmpty() || CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(data)) {
-      return null;
-    }
-    try {
-      switch (actualDataType) {
-        case INT:
-          return Integer.parseInt(data);
-        case SHORT:
-          return Short.parseShort(data);
-        case DOUBLE:
-          return Double.parseDouble(data);
-        case LONG:
-          return Long.parseLong(data);
-        case TIMESTAMP:
-          SimpleDateFormat parser = new SimpleDateFormat(CarbonProperties.getInstance()
-              .getProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT,
-                  CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT));
-          Date dateToStr = null;
-          try {
-            dateToStr = parser.parse(data);
-            return dateToStr.getTime() * 1000;
-          } catch (ParseException e) {
-            LOGGER.error("Cannot convert" + data + " to Time/Long type value" + e.getMessage());
-            return null;
-          }
-        case DECIMAL:
-          java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data);
-          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
-          org.apache.spark.sql.types.Decimal decConverter =
-              new org.apache.spark.sql.types.Decimal();
-          return decConverter.set(scalaDecVal);
-        default:
-          return UTF8String.fromString(data);
-      }
-    } catch (NumberFormatException ex) {
-      LOGGER.error("Problem while converting data type" + data);
-      return null;
-    }
-
-  }
-
-  public static Object getMeasureDataBasedOnDataType(Object data, DataType dataType) {
-
-    if (null == data) {
-      return null;
-    }
-    try {
-      switch (dataType) {
-        case DOUBLE:
-
-          return (Double) data;
-        case LONG:
-
-          return (Long) data;
-
-        case DECIMAL:
-
-          java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data.toString());
-          scala.math.BigDecimal scalaDecVal = new scala.math.BigDecimal(javaDecVal);
-          org.apache.spark.sql.types.Decimal decConverter =
-              new org.apache.spark.sql.types.Decimal();
-          return decConverter.set(scalaDecVal);
-        default:
-
-          return data;
-      }
-    } catch (NumberFormatException ex) {
-      LOGGER.error("Problem while converting data type" + data);
-      return null;
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputFormat_FT.java
----------------------------------------------------------------------
diff --git a/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputFormat_FT.java b/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputFormat_FT.java
index bf5624b..b4bfddf 100644
--- a/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputFormat_FT.java
+++ b/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputFormat_FT.java
@@ -23,9 +23,9 @@ import java.util.List;
 import java.util.UUID;
 
 import org.carbondata.core.carbon.CarbonTableIdentifier;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.hadoop.CarbonInputFormat;
 import org.carbondata.scan.expression.ColumnExpression;
-import org.carbondata.scan.expression.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.LiteralExpression;
 import org.carbondata.scan.expression.conditional.EqualToExpression;
@@ -70,8 +70,8 @@ public class CarbonInputFormat_FT extends TestCase {
     FileInputFormat.addInputPath(job, new Path("/opt/carbonstore/"));
     carbonInputFormat.setTableToAccess(job.getConfiguration(), tableIdentifier);
     job.getConfiguration().set(CarbonInputFormat.INPUT_SEGMENT_NUMBERS, "1,2");
-    Expression expression = new EqualToExpression(new ColumnExpression("c1", DataType.StringType),
-        new LiteralExpression("a", DataType.StringType));
+    Expression expression = new EqualToExpression(new ColumnExpression("c1", DataType.STRING),
+        new LiteralExpression("a", DataType.STRING));
     CarbonInputFormat.setFilterPredicates(job.getConfiguration(), expression);
     List splits = carbonInputFormat.getSplits(job);
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/b7c285b7/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputMapperTest.java
----------------------------------------------------------------------
diff --git a/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputMapperTest.java b/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputMapperTest.java
index 9d6db54..89fe2ab 100644
--- a/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputMapperTest.java
+++ b/hadoop/src/test/java/org/carbondata/hadoop/ft/CarbonInputMapperTest.java
@@ -8,12 +8,12 @@ import java.io.FileWriter;
 import java.io.IOException;
 
 import org.carbondata.core.carbon.AbsoluteTableIdentifier;
+import org.carbondata.core.carbon.metadata.datatype.DataType;
 import org.carbondata.core.util.CarbonUtil;
 import org.carbondata.hadoop.CarbonInputFormat;
 import org.carbondata.hadoop.CarbonProjection;
 import org.carbondata.hadoop.test.util.StoreCreator;
 import org.carbondata.scan.expression.ColumnExpression;
-import org.carbondata.scan.expression.DataType;
 import org.carbondata.scan.expression.Expression;
 import org.carbondata.scan.expression.LiteralExpression;
 import org.carbondata.scan.expression.conditional.EqualToExpression;
@@ -75,8 +75,8 @@ public class CarbonInputMapperTest extends TestCase {
       carbonProjection.addColumn("country");
       carbonProjection.addColumn("salary");
       Expression expression =
-          new EqualToExpression(new ColumnExpression("country", DataType.StringType),
-              new LiteralExpression("france", DataType.StringType));
+          new EqualToExpression(new ColumnExpression("country", DataType.STRING),
+              new LiteralExpression("france", DataType.STRING));
       runJob(outPath, carbonProjection, expression);
       Assert.assertTrue("Count lines are not matching", countTheLines(outPath) == 101);
       Assert.assertTrue("Column count are not matching", countTheColumns(outPath) == 3);



Mime
View raw message