carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject carbondata git commit: [CARBONDATA-1326] Fixed normal/low priority findbug issues
Date Wed, 16 Aug 2017 12:23:01 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master f089287ce -> d25fee225


[CARBONDATA-1326] Fixed normal/low priority findbug issues

This closes #1204


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

Branch: refs/heads/master
Commit: d25fee225567bc96f65fab85c0859cfba7957da3
Parents: f089287
Author: dhatchayani <dhatcha.official@gmail.com>
Authored: Fri Jul 28 11:34:12 2017 +0530
Committer: Ravindra Pesala <ravi.pesala@gmail.com>
Committed: Wed Aug 16 17:52:28 2017 +0530

----------------------------------------------------------------------
 .../core/constants/CarbonCommonConstants.java   | 32 +++++++++-----------
 .../core/keygenerator/KeyGenerator.java         |  9 ------
 .../mdkey/AbstractKeyGenerator.java             |  4 ---
 .../mdkey/MultiDimKeyVarLengthGenerator.java    | 10 ------
 .../core/locks/CarbonLockFactory.java           |  7 +++--
 .../core/metadata/CarbonTableIdentifier.java    |  2 ++
 .../core/metadata/ValueEncoderMeta.java         |  2 ++
 .../core/metadata/schema/BucketingInfo.java     |  2 ++
 .../core/metadata/schema/PartitionInfo.java     |  2 ++
 .../core/metadata/schema/table/TableInfo.java   | 14 +++------
 .../core/scan/expression/ExpressionResult.java  |  7 +++--
 .../expression/RangeExpressionEvaluator.java    | 16 +++++-----
 .../scan/filter/FilterExpressionProcessor.java  |  5 ---
 .../carbondata/core/scan/filter/FilterUtil.java | 15 ++++++---
 .../carbondata/core/util/CarbonProperties.java  |  9 +++---
 .../carbondata/core/util/CarbonSessionInfo.java |  1 +
 .../MultiDimKeyVarLengthGeneratorUnitTest.java  | 17 -----------
 17 files changed, 59 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
index f06eb83..14258f8 100644
--- a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
+++ b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
@@ -187,10 +187,6 @@ public final class CarbonCommonConstants {
       MEMBER_DEFAULT_VAL.getBytes(Charset.forName(DEFAULT_CHARSET));
 
   /**
-   * Bytes for string 0, it is used in codegen in case of null values.
-   */
-  public static final byte[] ZERO_BYTE_ARRAY = "0".getBytes();
-  /**
    * FILE STATUS IN-PROGRESS
    */
   public static final String FILE_INPROGRESS_STATUS = ".inprogress";
@@ -963,12 +959,12 @@ public final class CarbonCommonConstants {
   /**
    * If the level 2 compaction is done in minor then new compacted segment will end with
.2
    */
-  public static String LEVEL2_COMPACTION_INDEX = ".2";
+  public static final String LEVEL2_COMPACTION_INDEX = ".2";
 
   /**
    * Indicates compaction
    */
-  public static String COMPACTION_KEY_WORD = "COMPACTION";
+  public static final String COMPACTION_KEY_WORD = "COMPACTION";
 
   /**
    * hdfs temporary directory key
@@ -985,30 +981,30 @@ public final class CarbonCommonConstants {
   /**
    * File created in case of minor compaction request
    */
-  public static String minorCompactionRequiredFile = "compactionRequired_minor";
+  public static final String minorCompactionRequiredFile = "compactionRequired_minor";
 
   /**
    * File created in case of major compaction request
    */
-  public static String majorCompactionRequiredFile = "compactionRequired_major";
+  public static final String majorCompactionRequiredFile = "compactionRequired_major";
 
   /**
    * @Deprecated : This property has been deprecated.
    * Property for enabling system level compaction lock.1 compaction can run at once.
    */
   @CarbonProperty
-  public static String ENABLE_CONCURRENT_COMPACTION = "carbon.concurrent.compaction";
+  public static final String ENABLE_CONCURRENT_COMPACTION = "carbon.concurrent.compaction";
 
   /**
    * Default value of Property for enabling system level compaction lock.1 compaction can
run
    * at once.
    */
-  public static String DEFAULT_ENABLE_CONCURRENT_COMPACTION = "true";
+  public static final String DEFAULT_ENABLE_CONCURRENT_COMPACTION = "true";
 
   /**
    * Compaction system level lock folder.
    */
-  public static String SYSTEM_LEVEL_COMPACTION_LOCK_FOLDER = "SystemCompactionLock";
+  public static final String SYSTEM_LEVEL_COMPACTION_LOCK_FOLDER = "SystemCompactionLock";
 
   /**
    * This batch size is used to send rows from load step to another step in batches.
@@ -1048,34 +1044,34 @@ public final class CarbonCommonConstants {
   /**
    * columns which gets updated in update will have header ends with this extension.
    */
-  public static String UPDATED_COL_EXTENSION = "-updatedColumn";
+  public static final String UPDATED_COL_EXTENSION = "-updatedColumn";
 
   /**
    * appending the key to differentiate the update flow with insert flow.
    */
-  public static String RDDUTIL_UPDATE_KEY = "UPDATE_";
+  public static final String RDDUTIL_UPDATE_KEY = "UPDATE_";
 
   /**
    * to determine to use the rdd persist or not.
    */
   @CarbonProperty
-  public static String isPersistEnabled = "carbon.update.persist.enable";
+  public static final String isPersistEnabled = "carbon.update.persist.enable";
 
   /**
    * for enabling or disabling Horizontal Compaction.
    */
   @CarbonProperty
-  public static String isHorizontalCompactionEnabled = "carbon.horizontal.compaction.enable";
+  public static final String isHorizontalCompactionEnabled = "carbon.horizontal.compaction.enable";
 
   /**
    * Default value for HorizontalCompaction is true.
    */
-  public static String defaultIsHorizontalCompactionEnabled = "true";
+  public static final String defaultIsHorizontalCompactionEnabled = "true";
 
   /**
    * by default rdd will be persisted in the update case.
    */
-  public static String defaultValueIsPersistEnabled = "true";
+  public static final String defaultValueIsPersistEnabled = "true";
 
   /**
    * current data file version
@@ -1089,7 +1085,7 @@ public final class CarbonCommonConstants {
   /**
    * Maximum no of column supported
    */
-  public static int DEFAULT_MAX_NUMBER_OF_COLUMNS = 20000;
+  public static final int DEFAULT_MAX_NUMBER_OF_COLUMNS = 20000;
 
   /**
    * Maximum waiting time (in seconds) for a query for requested executors to be started

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/keygenerator/KeyGenerator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/keygenerator/KeyGenerator.java
b/core/src/main/java/org/apache/carbondata/core/keygenerator/KeyGenerator.java
index 09ce7a7..09e162c 100644
--- a/core/src/main/java/org/apache/carbondata/core/keygenerator/KeyGenerator.java
+++ b/core/src/main/java/org/apache/carbondata/core/keygenerator/KeyGenerator.java
@@ -89,15 +89,6 @@ public interface KeyGenerator extends Serializable, Comparator<byte[]>
{
    */
   int getKeySizeInBytes();
 
-  /**
-   * It gets the specified index and size from the single key aka byte aray
-   *
-   * @param key
-   * @param index
-   * @param size
-   * @return
-   */
-  long[] getSubKeyArray(byte[] key, int index, int size);
 
   /**
    * returns key bytes offset

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/AbstractKeyGenerator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/AbstractKeyGenerator.java
b/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/AbstractKeyGenerator.java
index d4033bf..a480595 100644
--- a/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/AbstractKeyGenerator.java
+++ b/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/AbstractKeyGenerator.java
@@ -66,10 +66,6 @@ public abstract class AbstractKeyGenerator implements KeyGenerator {
     return 0;
   }
 
-  @Override public int[] getKeyByteOffsets(int index) {
-    return null;
-  }
-
   @Override public int getDimCount() {
     return 0;
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGenerator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGenerator.java
b/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGenerator.java
index 909ac60..1aa91f9 100644
--- a/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGenerator.java
+++ b/core/src/main/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGenerator.java
@@ -66,16 +66,6 @@ public class MultiDimKeyVarLengthGenerator extends AbstractKeyGenerator
{
     return bits.getByteSize();
   }
 
-  @Override public long[] getSubKeyArray(byte[] key, int index, int size) {
-    if (index < 0 || size == 0) {
-      return null;
-    }
-    long[] keys = bits.getKeyArray(key, 0);
-    long[] rtn = new long[size];
-    System.arraycopy(keys, index, rtn, 0, size);
-    return rtn;
-  }
-
   @Override public int[] getKeyByteOffsets(int index) {
     return byteRangesForKeys[index];
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java b/core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java
index f9520ab..7480208 100644
--- a/core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java
+++ b/core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java
@@ -52,7 +52,7 @@ public class CarbonLockFactory {
    */
   public static ICarbonLock getCarbonLockObj(CarbonTableIdentifier tableIdentifier,
       String lockFile) {
-    switch (lockTypeConfigured.toUpperCase()) {
+    switch (lockTypeConfigured) {
       case CarbonCommonConstants.CARBON_LOCK_TYPE_LOCAL:
         return new LocalFileLock(tableIdentifier, lockFile);
 
@@ -74,7 +74,7 @@ public class CarbonLockFactory {
    * @return carbon lock
    */
   public static ICarbonLock getCarbonLockObj(String locFileLocation, String lockFile) {
-    switch (lockTypeConfigured.toUpperCase()) {
+    switch (lockTypeConfigured) {
       case CarbonCommonConstants.CARBON_LOCK_TYPE_LOCAL:
         return new LocalFileLock(locFileLocation, lockFile);
 
@@ -94,7 +94,8 @@ public class CarbonLockFactory {
    */
   private static void getLockTypeConfigured() {
     lockTypeConfigured = CarbonProperties.getInstance()
-        .getProperty(CarbonCommonConstants.LOCK_TYPE, CarbonCommonConstants.LOCK_TYPE_DEFAULT);
+        .getProperty(CarbonCommonConstants.LOCK_TYPE, CarbonCommonConstants.LOCK_TYPE_DEFAULT)
+        .toUpperCase();
     LOGGER.info("Configured lock type is: " + lockTypeConfigured);
   }
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/metadata/CarbonTableIdentifier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/CarbonTableIdentifier.java
b/core/src/main/java/org/apache/carbondata/core/metadata/CarbonTableIdentifier.java
index cc65d9b..b0b325a 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/CarbonTableIdentifier.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/CarbonTableIdentifier.java
@@ -25,6 +25,8 @@ import java.io.Serializable;
  */
 public class CarbonTableIdentifier implements Serializable {
 
+  private static final long serialVersionUID = -0L;
+
   /**
    * database name
    */

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/metadata/ValueEncoderMeta.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/ValueEncoderMeta.java
b/core/src/main/java/org/apache/carbondata/core/metadata/ValueEncoderMeta.java
index 741b999..a7383ea 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/ValueEncoderMeta.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/ValueEncoderMeta.java
@@ -29,6 +29,8 @@ import org.apache.carbondata.core.metadata.datatype.DataType;
  */
 public class ValueEncoderMeta implements Serializable {
 
+  private static final long serialVersionUID = -0L;
+
   /**
    * maxValue
    */

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
index b5080fe..8434601 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
@@ -27,6 +27,8 @@ import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
  */
 public class BucketingInfo implements Serializable {
 
+  private static final long serialVersionUID = -0L;
+
   private List<ColumnSchema> listOfColumns;
 
   private int numberOfBuckets;

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
index 0d03998..39d7f3f 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
@@ -29,6 +29,8 @@ import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
  */
 public class PartitionInfo implements Serializable {
 
+  private static final long serialVersionUID = -0L;
+
   private List<ColumnSchema> columnSchemaList;
 
   private PartitionType partitionType;

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
index 78cd97b..2bd3198 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
@@ -185,18 +185,14 @@ public class TableInfo implements Serializable, Writable {
       return false;
     }
     TableInfo other = (TableInfo) obj;
-    if (databaseName == null) {
-      if (other.databaseName != null) {
-        return false;
-      }
-    } else if (!tableUniqueName.equals(other.tableUniqueName)) {
+    if ((databaseName == null && other.databaseName != null) || (databaseName !=
null
+        && other.databaseName == null)) {
       return false;
     }
 
-    if (tableUniqueName == null) {
-      if (other.tableUniqueName != null) {
-        return false;
-      }
+    if ((tableUniqueName == null && other.tableUniqueName != null) || (tableUniqueName
!= null
+        && other.tableUniqueName == null)) {
+      return false;
     } else if (!tableUniqueName.equals(other.tableUniqueName)) {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
b/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
index 2f8c907..74e666b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/ExpressionResult.java
@@ -187,7 +187,7 @@ public class ExpressionResult implements Comparable<ExpressionResult>
{
             }
             return parser.format(new Timestamp((long) value));
           } else if (value instanceof Integer) {
-            return parser.format(new java.sql.Date((int)value));
+            return parser.format(new java.sql.Date((long)value));
           }
           return value.toString();
         default:
@@ -308,7 +308,6 @@ public class ExpressionResult implements Comparable<ExpressionResult>
{
         case LONG:
           return new BigDecimal((long) value);
         case DOUBLE:
-          return new BigDecimal(value.toString());
         case DECIMAL:
           return new BigDecimal(value.toString());
         case DATE:
@@ -546,7 +545,9 @@ public class ExpressionResult implements Comparable<ExpressionResult>
{
         default:
           return this.getString().compareTo(o.getString());
       }
-    } catch (Exception e) {
+    } catch (ParseException e) {
+      return -1;
+    } catch (FilterIllegalMemberException e) {
       return -1;
     }
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/scan/expression/RangeExpressionEvaluator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/RangeExpressionEvaluator.java
b/core/src/main/java/org/apache/carbondata/core/scan/expression/RangeExpressionEvaluator.java
index d857fd8..4433e86 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/expression/RangeExpressionEvaluator.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/RangeExpressionEvaluator.java
@@ -120,8 +120,8 @@ public class RangeExpressionEvaluator {
 
         for (FilterModificationNode exp : filterExp) {
           if ((exp.getExpType() == GREATERTHAN) || (exp.getExpType() == GREATERTHAN_EQUALTO))
{
-            if ((null == endMax) || ((null != endMax) && (checkLiteralValue(exp.getCurrentExp(),
-                endMax.getCurrentExp())))) {
+            if ((null == endMax) || checkLiteralValue(exp.getCurrentExp(),
+                endMax.getCurrentExp())) {
               if (null == startMin) {
                 startMin = exp;
               } else {
@@ -141,8 +141,8 @@ public class RangeExpressionEvaluator {
             }
           }
           if ((exp.getExpType() == LESSTHAN) || (exp.getExpType() == LESSTHAN_EQUALTO)) {
-            if ((null == startMin) || ((null != startMin) && (checkLiteralValue(exp.getCurrentExp(),
-                startMin.getCurrentExp())))) {
+            if ((null == startMin) || checkLiteralValue(exp.getCurrentExp(),
+                startMin.getCurrentExp())) {
               if (null == endMax) {
                 endMax = exp;
               } else {
@@ -411,10 +411,10 @@ public class RangeExpressionEvaluator {
       ExpressionType srcExpType = getExpressionType(this.getSrcNode());
       ExpressionType tarExpType = getExpressionType(currentNode);
 
-      if ((null != srcColumnName) && (null != tarColumnName) && (srcColumnName
== tarColumnName)
-          && (srcExpType != ExpressionType.FALSE) && (tarExpType != ExpressionType.FALSE)
&& (
-          (matchExpType(srcExpType, tarExpType)) && checkLiteralValue(this.getSrcNode(),
-              currentNode))) {
+      if ((null != srcColumnName) && (null != tarColumnName) && (srcColumnName
+          .equals(tarColumnName)) && (srcExpType != ExpressionType.FALSE) &&
(tarExpType
+          != ExpressionType.FALSE) && ((matchExpType(srcExpType, tarExpType)) &&
checkLiteralValue(
+          this.getSrcNode(), currentNode))) {
         this.setTarNode(currentNode);
         this.setTarParentNode(parentNode);
         return parentNode;

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterExpressionProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterExpressionProcessor.java
b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterExpressionProcessor.java
index 104ef56..3a19e1b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterExpressionProcessor.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterExpressionProcessor.java
@@ -357,11 +357,6 @@ public class FilterExpressionProcessor implements FilterProcessor {
     BinaryExpression currentExpression = null;
     switch (filterExpressionType) {
       case OR:
-        currentExpression = (BinaryExpression) expressionTree;
-        return new LogicalFilterResolverImpl(
-            createFilterResolverTree(currentExpression.getLeft(), tableIdentifier),
-            createFilterResolverTree(currentExpression.getRight(), tableIdentifier),
-            currentExpression);
       case AND:
         currentExpression = (BinaryExpression) expressionTree;
         return new LogicalFilterResolverImpl(

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
index 9752e1c..2ead304 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -322,7 +323,8 @@ public final class FilterUtil {
    * @return
    */
   public static boolean checkIfDataTypeNotTimeStamp(Expression expression) {
-    if (expression.getFilterExpressionType() == ExpressionType.LITERAL) {
+    if (expression.getFilterExpressionType() == ExpressionType.LITERAL
+        && expression instanceof LiteralExpression) {
       DataType dataType = ((LiteralExpression) expression).getLiteralExpDataType();
       if (!(dataType == DataType.TIMESTAMP || dataType == DataType.DATE)) {
         return true;
@@ -1288,7 +1290,9 @@ public final class FilterUtil {
         default:
           return -1;
       }
-    } catch (Exception e) {
+    } catch (ParseException e) {
+      return -1;
+    } catch (NumberFormatException e) {
       return -1;
     }
   }
@@ -1361,8 +1365,7 @@ public final class FilterUtil {
     if (segmentProperties.getNumberOfNoDictSortColumns() == 0) {
       listOfStartKeyByteArray = new ArrayList<byte[]>();
       listOfEndKeyByteArray = new ArrayList<byte[]>();
-    } else if (segmentProperties.getNumberOfNoDictSortColumns() < listOfStartKeyByteArray
-        .size()) {
+    } else {
       while (segmentProperties.getNumberOfNoDictSortColumns() < listOfStartKeyByteArray.size())
{
         listOfStartKeyByteArray.remove(listOfStartKeyByteArray.size() - 1);
         listOfEndKeyByteArray.remove(listOfEndKeyByteArray.size() - 1);
@@ -1428,7 +1431,9 @@ public final class FilterUtil {
         default:
           return filterMember1.compareTo(filterMember2);
       }
-    } catch (Exception e) {
+    } catch (ParseException e) {
+      return -1;
+    } catch (NumberFormatException e) {
       return -1;
     }
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java b/core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
index 2620ecb..2755990 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
@@ -139,7 +139,8 @@ public final class CarbonProperties {
   private void validateLockType() {
     String lockTypeConfigured = carbonProperties.getProperty(CarbonCommonConstants.LOCK_TYPE);
     if (null != lockTypeConfigured) {
-      switch (lockTypeConfigured.toUpperCase()) {
+      lockTypeConfigured = lockTypeConfigured.toUpperCase();
+      switch (lockTypeConfigured) {
         // if user is setting the lock type as CARBON_LOCK_TYPE_ZOOKEEPER then no need to
validate
         // else validate based on the file system type for LOCAL file system lock will be
         // CARBON_LOCK_TYPE_LOCAL and for the distributed one CARBON_LOCK_TYPE_HDFS
@@ -660,7 +661,7 @@ public final class CarbonProperties {
         CarbonCommonConstants.DEFAULT_SEGMENT_LEVEL_THRESHOLD);
     int[] compactionSize = getIntArray(commaSeparatedLevels);
 
-    if (null == compactionSize) {
+    if (0 == compactionSize.length) {
       compactionSize = getIntArray(CarbonCommonConstants.DEFAULT_SEGMENT_LEVEL_THRESHOLD);
     }
 
@@ -680,7 +681,7 @@ public final class CarbonProperties {
         int size = Integer.parseInt(levelSize.trim());
         if (validate(size, 100, 0, -1) < 0) {
           // if given size is out of boundary then take default value for all levels.
-          return null;
+          return new int[0];
         }
         compactionSize[i++] = size;
       } catch (NumberFormatException e) {
@@ -688,7 +689,7 @@ public final class CarbonProperties {
             "Given value for property" + CarbonCommonConstants.COMPACTION_SEGMENT_LEVEL_THRESHOLD
                 + " is not proper. Taking the default value "
                 + CarbonCommonConstants.DEFAULT_SEGMENT_LEVEL_THRESHOLD);
-        return null;
+        return new int[0];
       }
     }
     return compactionSize;

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/main/java/org/apache/carbondata/core/util/CarbonSessionInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/CarbonSessionInfo.java b/core/src/main/java/org/apache/carbondata/core/util/CarbonSessionInfo.java
index 1a82f1d..fb778bc 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/CarbonSessionInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/CarbonSessionInfo.java
@@ -24,6 +24,7 @@ import java.io.Serializable;
  */
 public class CarbonSessionInfo implements Serializable {
 
+  private static final long serialVersionUID = 7738818814501121256L;
   // contains carbon session param details
   private SessionParams sessionParams;
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/d25fee22/core/src/test/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGeneratorUnitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGeneratorUnitTest.java
b/core/src/test/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGeneratorUnitTest.java
index f9fa393..bc35093 100644
--- a/core/src/test/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGeneratorUnitTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/keygenerator/mdkey/MultiDimKeyVarLengthGeneratorUnitTest.java
@@ -34,23 +34,6 @@ public class MultiDimKeyVarLengthGeneratorUnitTest {
     multiDimKeyVarLengthGenerator = new MultiDimKeyVarLengthGenerator(lens);
   }
 
-  @Test public void testGetSubKeyArray() throws Exception {
-    byte[] key = new byte[] { 1, 102, 20 };
-    int index = 1;
-    int size = 2;
-    long[] expected = new long[] { 0, 1 };
-    long[] result = multiDimKeyVarLengthGenerator.getSubKeyArray(key, index, size);
-    assertThat(result, is(equalTo(expected)));
-  }
-
-  @Test public void testGetSubKeyArrayWithIndexIsLessThanZeroAndSizeIsZero() throws Exception
{
-    byte[] key = new byte[] { 1, 102, 20 };
-    int index = -1;
-    int size = 0;
-    long[] result = multiDimKeyVarLengthGenerator.getSubKeyArray(key, index, size);
-    assertNull(result);
-  }
-
   @Test public void testEqualsWithSameInstance() throws Exception {
     int[] lens = new int[] { 1, 2, 3 };
     MultiDimKeyVarLengthGenerator multiDimKeyVarLengthGenerator1 =


Mime
View raw message