carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From man...@apache.org
Subject [carbondata] branch master updated: [CARBONDATA-3889] Cleanup code in carbondata-core module
Date Thu, 30 Jul 2020 12:33:58 GMT
This is an automated email from the ASF dual-hosted git repository.

manhua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new 8770c90  [CARBONDATA-3889] Cleanup code in carbondata-core module
8770c90 is described below

commit 8770c9099bfe05aeb01acf5886cd7480686dffe5
Author: QiangCai <qiangcai@qq.com>
AuthorDate: Tue Jul 28 23:07:59 2020 +0800

    [CARBONDATA-3889] Cleanup code in carbondata-core module
    
    Why is this PR needed?
    1.Redundant 'if' statement
    2.Array access many times in for loop
    3.Repeated switch branch
    4.Use StringBuffer
    
    What changes were proposed in this PR?
    1.Change redundant 'if' statement
    2.Use enhanced for loop
    3.Merge switch branch
    4.Use StringBuilder instead of StringBuffer
    
    Does this PR introduce any user interface change?
    No
    Yes. (please explain the change and update document)
    
    Is any new testcase added?
    No
    Yes
    
    This closes #3868
---
 .../carbondata/core/cache/CacheProvider.java       |   2 +-
 .../carbondata/core/cache/CarbonLRUCache.java      |   5 +-
 .../core/constants/CarbonCommonConstants.java      |   7 +-
 .../carbondata/core/datastore/TableSpec.java       |  10 +-
 .../core/datastore/block/SegmentProperties.java    |  12 +--
 .../block/SegmentPropertiesAndSchemaHolder.java    |  30 ------
 .../chunk/impl/AbstractDimensionColumnPage.java    |   2 +-
 .../dimension/v3/DimensionChunkPageReaderV3.java   |   6 +-
 .../chunk/store/DimensionChunkStoreFactory.java    |   2 +-
 .../core/datastore/columnar/UnBlockIndexer.java    |   4 +-
 .../core/datastore/compression/GzipCompressor.java |   2 +-
 .../exception/CarbonDataWriterException.java       |   8 --
 .../datastore/exception/IndexBuilderException.java |   8 --
 .../core/datastore/filesystem/LocalCarbonFile.java |   3 +-
 .../datastore/impl/DefaultFileTypeProvider.java    |   3 +-
 .../core/datastore/impl/FileFactory.java           |   4 +-
 .../core/datastore/impl/FileTypeInterface.java     |   4 +-
 .../core/datastore/page/ComplexColumnPage.java     |  26 ++---
 .../datastore/page/SafeFixLengthColumnPage.java    |   4 +-
 .../datastore/page/SafeVarLengthColumnPage.java    |   5 +-
 .../datastore/page/UnsafeDecimalColumnPage.java    |   4 +-
 .../datastore/page/UnsafeVarLengthColumnPage.java  |   2 +-
 .../datastore/page/VarLengthColumnPageBase.java    |   9 +-
 .../page/encoding/adaptive/AdaptiveCodec.java      |   4 +-
 .../adaptive/AdaptiveDeltaIntegralCodec.java       |   6 +-
 .../encoding/adaptive/AdaptiveFloatingCodec.java   |   2 +-
 .../encoding/adaptive/AdaptiveIntegralCodec.java   |  12 +--
 .../encoding/compress/DirectCompressCodec.java     |   4 +-
 .../exception/ConcurrentOperationException.java    |   5 -
 .../apache/carbondata/core/index/IndexChooser.java |   3 +-
 .../apache/carbondata/core/index/IndexLevel.java   |   2 +-
 .../apache/carbondata/core/index/IndexMeta.java    |  13 +--
 .../carbondata/core/index/IndexStoreManager.java   |   7 +-
 .../apache/carbondata/core/index/IndexUtil.java    |   3 +-
 .../apache/carbondata/core/index/TableIndex.java   |   7 +-
 .../core/index/dev/BlockletSerializer.java         |   6 +-
 .../carbondata/core/index/dev/IndexWriter.java     |   3 +-
 .../core/index/dev/expr/AndIndexExprWrapper.java   |   4 +-
 .../core/index/dev/expr/OrIndexExprWrapper.java    |   4 +-
 .../core/index/dev/fgindex/FineGrainBlocklet.java  |   4 +-
 .../carbondata/core/indexstore/Blocklet.java       |  18 ++--
 .../core/indexstore/ExtendedBlockletWrapper.java   |   5 +-
 .../ExtendedBlockletWrapperContainer.java          |   6 +-
 .../core/indexstore/UnsafeMemoryDMStore.java       |  26 +++--
 .../core/indexstore/blockletindex/BlockIndex.java  |  13 +--
 .../blockletindex/BlockletDataRefNode.java         |   8 +-
 .../blockletindex/BlockletIndexFactory.java        |   2 +-
 .../blockletindex/SegmentIndexFileStore.java       |  98 ++++++++----------
 .../core/indexstore/schema/SchemaGenerator.java    |  60 +++++------
 .../DictionaryThresholdReachedException.java       |   8 --
 .../carbondata/core/locks/AlluxioFileLock.java     |  16 ---
 .../carbondata/core/locks/LocalFileLock.java       |   6 +-
 .../apache/carbondata/core/memory/MemoryType.java  |   3 +-
 .../carbondata/core/metadata/SegmentFileStore.java |  10 +-
 .../ThriftWrapperSchemaConverterImpl.java          |   9 +-
 .../carbondata/core/metadata/datatype/Field.java   |  15 +--
 .../core/metadata/schema/SchemaReader.java         |   3 +-
 .../metadata/schema/indextable/IndexMetadata.java  |   3 +-
 .../metadata/schema/indextable/IndexTableInfo.java |  13 ++-
 .../core/metadata/schema/table/CarbonTable.java    |  19 ++--
 .../metadata/schema/table/CarbonTableBuilder.java  |   3 -
 .../core/metadata/schema/table/TableInfo.java      |   3 +-
 .../metadata/schema/table/TableSchemaBuilder.java  |  16 +--
 .../carbondata/core/mutate/CarbonUpdateUtil.java   |  14 +--
 .../core/mutate/DeleteDeltaBlockDetails.java       |   6 +-
 .../carbondata/core/mutate/DeleteDeltaVo.java      |   6 +-
 .../apache/carbondata/core/mutate/UpdateVO.java    |  14 +--
 .../LatestFilesReadCommittedScope.java             |  36 +++----
 .../reader/CarbonDeleteDeltaFileReaderImpl.java    |  19 ++--
 .../carbondata/core/reader/CarbonFooterReader.java |  10 +-
 .../core/reader/CarbonFooterReaderV3.java          |  10 +-
 .../carbondata/core/reader/CarbonHeaderReader.java |   8 +-
 .../core/reader/CarbonIndexFileReader.java         |  15 +--
 .../impl/AbstractScannedResultCollector.java       |   3 +-
 .../impl/DictionaryBasedResultCollector.java       |  20 ++--
 .../impl/RestructureBasedRawResultCollector.java   |   2 +-
 .../core/scan/complextypes/StructQueryType.java    |   9 +-
 .../scan/executor/infos/BlockExecutionInfo.java    |   2 +-
 .../core/scan/executor/util/QueryUtil.java         |  26 ++---
 .../core/scan/executor/util/RestructureUtil.java   |   4 +-
 .../expression/conditional/ListExpression.java     |   4 +-
 .../logical/BinaryLogicalExpression.java           |   6 +-
 .../carbondata/core/scan/filter/FilterUtil.java    |  30 ++----
 .../filter/executer/ExcludeFilterExecutorImpl.java |  33 +++---
 .../scan/filter/executer/FalseFilterExecutor.java  |   3 +-
 .../filter/executer/IncludeFilterExecutorImpl.java |  54 +++++-----
 .../executer/MeasureColumnExecutorFilterInfo.java  |   6 +-
 ...velRangeGreaterThanEqualFilterExecutorImpl.java |   6 +-
 ...RowLevelRangeGreaterThanFilterExecutorImpl.java |  41 ++++----
 ...wLevelRangeLessThanEqualFilterExecutorImpl.java |  27 +++--
 .../RowLevelRangeLessThanFilterExecutorImpl.java   |  39 ++++----
 .../resolver/RowLevelRangeFilterResolverImpl.java  |  13 +--
 .../core/scan/model/QueryModelBuilder.java         |   5 +-
 .../core/scan/result/BlockletScannedResult.java    |  14 +--
 .../scan/result/impl/FilterQueryScannedResult.java |   3 +-
 .../AbstractDetailQueryResultIterator.java         |   5 +-
 .../iterator/ColumnDriftRawResultIterator.java     |   7 +-
 .../scan/result/iterator/RawResultIterator.java    |   8 +-
 .../scan/scanner/impl/BlockletFilterScanner.java   |   4 +-
 .../scan/scanner/impl/BlockletFullScanner.java     |   6 +-
 .../core/segmentmeta/SegmentMetaDataInfoStats.java |   4 +-
 .../carbondata/core/stats/TaskStatistics.java      |   6 +-
 .../core/statusmanager/SegmentStatusManager.java   |   6 +-
 .../statusmanager/SegmentUpdateStatusManager.java  |  56 ++++-------
 .../carbondata/core/stream/StreamPruner.java       |   6 +-
 .../apache/carbondata/core/util/BitSetGroup.java   |   4 +-
 .../carbondata/core/util/BlockletIndexUtil.java    |  37 +++----
 .../org/apache/carbondata/core/util/ByteUtil.java  |   6 +-
 .../carbondata/core/util/CarbonProperties.java     |   7 +-
 .../apache/carbondata/core/util/CarbonUtil.java    | 111 ++++++++-------------
 .../core/util/DataTypeConverterImpl.java           |   3 +-
 .../apache/carbondata/core/util/DataTypeUtil.java  |  38 ++++---
 .../apache/carbondata/core/util/SessionParams.java |   8 +-
 .../comparator/BooleanSerializableComparator.java  |   8 +-
 .../util/comparator/IntSerializableComparator.java |   8 +-
 .../comparator/LongSerializableComparator.java     |   8 +-
 .../comparator/ShortSerializableComparator.java    |   8 +-
 .../carbondata/core/util/path/CarbonTablePath.java |   2 +-
 .../core/writer/CarbonIndexFileMergeWriter.java    |   5 +-
 .../carbondata/core/writer/ThriftWriter.java       |   5 +-
 .../apache/carbondata/hadoop/CarbonInputSplit.java |   5 +-
 121 files changed, 525 insertions(+), 948 deletions(-)

diff --git a/core/src/main/java/org/apache/carbondata/core/cache/CacheProvider.java b/core/src/main/java/org/apache/carbondata/core/cache/CacheProvider.java
index 652e417..a9cf59e 100644
--- a/core/src/main/java/org/apache/carbondata/core/cache/CacheProvider.java
+++ b/core/src/main/java/org/apache/carbondata/core/cache/CacheProvider.java
@@ -130,7 +130,7 @@ public class CacheProvider {
    */
   private void createBlockletIndexCache(CacheType cacheType) {
     Cache cacheObject = null;
-    if (cacheType.equals(cacheType.DRIVER_BLOCKLET_INDEX)) {
+    if (cacheType.equals(CacheType.DRIVER_BLOCKLET_INDEX)) {
       cacheObject = new BlockletIndexStore(carbonLRUCache);
     }
     cacheTypeToCacheMap.put(cacheType, cacheObject);
diff --git a/core/src/main/java/org/apache/carbondata/core/cache/CarbonLRUCache.java b/core/src/main/java/org/apache/carbondata/core/cache/CarbonLRUCache.java
index 0759798..7b35f3f 100644
--- a/core/src/main/java/org/apache/carbondata/core/cache/CarbonLRUCache.java
+++ b/core/src/main/java/org/apache/carbondata/core/cache/CarbonLRUCache.java
@@ -151,10 +151,7 @@ public final class CarbonLRUCache {
    * @return
    */
   private boolean canBeRemoved(Cacheable cacheInfo) {
-    if (cacheInfo.getAccessCount() > 0) {
-      return false;
-    }
-    return true;
+    return cacheInfo.getAccessCount() <= 0;
   }
 
   /**
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 52bea59..8f68bf2 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
@@ -1190,10 +1190,10 @@ public final class CarbonCommonConstants {
 
   public static final String CARBON_ENABLE_RANGE_COMPACTION_DEFAULT = "true";
 
-  @CarbonProperty
   /**
    * size based threshold for local dictionary in mb.
    */
+  @CarbonProperty
   public static final String CARBON_LOCAL_DICTIONARY_SIZE_THRESHOLD_IN_MB =
       "carbon.local.dictionary.size.threshold.inmb";
 
@@ -2279,14 +2279,13 @@ public final class CarbonCommonConstants {
   public static final String CARBON_INDEX_SERVER_JOBNAME_LENGTH =
           "carbon.index.server.max.jobname.length";
 
-  public static final String CARBON_INDEX_SERVER_JOBNAME_LENGTH_DEFAULT =
-          "50";
+  public static final String CARBON_INDEX_SERVER_JOBNAME_LENGTH_DEFAULT = "50";
 
-  @CarbonProperty
   /**
    * Max in memory serialization size after reaching threshold data will
    * be written to file
    */
+  @CarbonProperty
   public static final String CARBON_INDEX_SERVER_SERIALIZATION_THRESHOLD =
       "carbon.index.server.inmemory.serialization.threshold.inKB";
 
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java b/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
index fe98e96..6cbf07c 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/TableSpec.java
@@ -198,11 +198,11 @@ public class TableSpec {
    */
   public DimensionSpec[] getNoDictAndComplexDimensions() {
     List<DimensionSpec> noDictAndComplexDimensions = new ArrayList<>();
-    for (int i = 0; i < dimensionSpec.length; i++) {
-      if (dimensionSpec[i].getColumnType() == ColumnType.PLAIN_VALUE
-          || dimensionSpec[i].getColumnType() == ColumnType.COMPLEX_PRIMITIVE
-          || dimensionSpec[i].getColumnType() == ColumnType.COMPLEX) {
-        noDictAndComplexDimensions.add(dimensionSpec[i]);
+    for (DimensionSpec spec : dimensionSpec) {
+      if (spec.getColumnType() == ColumnType.PLAIN_VALUE
+          || spec.getColumnType() == ColumnType.COMPLEX_PRIMITIVE
+          || spec.getColumnType() == ColumnType.COMPLEX) {
+        noDictAndComplexDimensions.add(spec);
       }
     }
     return noDictAndComplexDimensions.toArray(new DimensionSpec[noDictAndComplexDimensions.size()]);
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentProperties.java b/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentProperties.java
index 2b8a049..ea27d48 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentProperties.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentProperties.java
@@ -20,7 +20,6 @@ package org.apache.carbondata.core.datastore.block;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -33,6 +32,7 @@ import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.metadata.datatype.DataType;
 import org.apache.carbondata.core.metadata.datatype.DataTypes;
 import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure;
 import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
@@ -174,9 +174,7 @@ public class SegmentProperties {
 
   private void fillBlockToDimensionOrdinalMapping() {
     Set<Entry<Integer, Integer>> blocks = dimensionOrdinalToChunkMapping.entrySet();
-    Iterator<Entry<Integer, Integer>> blockItr = blocks.iterator();
-    while (blockItr.hasNext()) {
-      Entry<Integer, Integer> block = blockItr.next();
+    for (Entry<Integer, Integer> block : blocks) {
       Set<Integer> dimensionOrdinals = blockToDimensionOrdinalMapping.get(block.getValue());
       if (dimensionOrdinals == null) {
         dimensionOrdinals = new HashSet<Integer>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
@@ -257,11 +255,11 @@ public class SegmentProperties {
   protected long getFingerPrinter() {
     if (this.fingerPrinter == Long.MAX_VALUE) {
       long dimensionsFingerPrinter = getFingerPrinter(this.dimensions.stream()
-              .map(t -> t.getColumnSchema()).collect(Collectors.toList()));
+              .map(CarbonColumn::getColumnSchema).collect(Collectors.toList()));
       long measuresFingerPrinter = getFingerPrinter(this.measures.stream()
-              .map(t -> t.getColumnSchema()).collect(Collectors.toList()));
+              .map(CarbonColumn::getColumnSchema).collect(Collectors.toList()));
       long complexFingerPrinter = getFingerPrinter(this.complexDimensions.stream()
-              .map(t -> t.getColumnSchema()).collect(Collectors.toList()));
+              .map(CarbonColumn::getColumnSchema).collect(Collectors.toList()));
       this.fingerPrinter = (dimensionsFingerPrinter >> DIMENSIONS_FINGER_PRINTER_SHIFT)
               ^ (measuresFingerPrinter >> MEASURES_FINGER_PRINTER_SHIFT)
               ^ (complexFingerPrinter >> COMPLEX_FINGER_PRINTER_SHIFT);
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java b/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java
index 032eb0f..8cc42dc 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/block/SegmentPropertiesAndSchemaHolder.java
@@ -18,8 +18,6 @@
 package org.apache.carbondata.core.datastore.block;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -251,25 +249,6 @@ public class SegmentPropertiesAndSchemaHolder {
   }
 
   /**
-   * add segmentId at given segmentPropertyIndex
-   * Note: This method is getting used in extension with other features. Please do not remove
-   *
-   * @param segmentPropertiesIndex
-   * @param segmentId
-   */
-  public void addSegmentId(int segmentPropertiesIndex, String segmentId) {
-    SegmentPropertiesWrapper segmentPropertiesWrapper =
-        indexToSegmentPropertiesWrapperMapping.get(segmentPropertiesIndex);
-    if (null != segmentPropertiesWrapper) {
-      SegmentIdAndSegmentPropertiesIndexWrapper segmentIdAndSegmentPropertiesIndexWrapper =
-          segmentPropWrapperToSegmentSetMap.get(segmentPropertiesWrapper);
-      synchronized (getOrCreateTableLock(segmentPropertiesWrapper.getTableIdentifier())) {
-        segmentIdAndSegmentPropertiesIndexWrapper.addSegmentId(segmentId);
-      }
-    }
-  }
-
-  /**
    * This class wraps tableIdentifier, columnsInTable and columnCardinality as a key to determine
    * whether the SegmentProperties object can be reused.
    */
@@ -358,15 +337,6 @@ public class SegmentPropertiesAndSchemaHolder {
       return exists;
     }
 
-    private void sortList(List<ColumnSchema> columnSchemas) {
-      Collections.sort(columnSchemas, new Comparator<ColumnSchema>() {
-        @Override
-        public int compare(ColumnSchema o1, ColumnSchema o2) {
-          return o1.getColumnUniqueId().compareTo(o2.getColumnUniqueId());
-        }
-      });
-    }
-
     @Override
     public int hashCode() {
       int allColumnsHashCode = 0;
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/impl/AbstractDimensionColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/impl/AbstractDimensionColumnPage.java
index baee982..abd89c0 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/impl/AbstractDimensionColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/impl/AbstractDimensionColumnPage.java
@@ -36,7 +36,7 @@ public abstract class AbstractDimensionColumnPage implements DimensionColumnPage
    * @return whether data is explicitly sorted or not
    */
   protected boolean isExplicitSorted(int[] invertedIndex) {
-    return (null == invertedIndex || 0 == invertedIndex.length) ? false : true;
+    return null != invertedIndex && 0 != invertedIndex.length;
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/dimension/v3/DimensionChunkPageReaderV3.java b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/dimension/v3/DimensionChunkPageReaderV3.java
index deafe48..15996c5 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/dimension/v3/DimensionChunkPageReaderV3.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/dimension/v3/DimensionChunkPageReaderV3.java
@@ -95,11 +95,9 @@ public class DimensionChunkPageReaderV3 extends DimensionChunkReaderV3 {
     }
     // get the data chunk which will have all the details about the data pages
     DataChunk3 dataChunk = CarbonUtil.readDataChunk3(new ByteArrayInputStream(buffer.array()));
-    DimensionRawColumnChunk rawColumnChunk =
-        getDimensionRawColumnChunk(fileReader, blockletColumnIndex, currentDimensionOffset, length,
-            null, dataChunk);
 
-    return rawColumnChunk;
+    return getDimensionRawColumnChunk(fileReader, blockletColumnIndex, currentDimensionOffset,
+        length, null, dataChunk);
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/DimensionChunkStoreFactory.java b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/DimensionChunkStoreFactory.java
index 849a1ee..f129bba 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/DimensionChunkStoreFactory.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/DimensionChunkStoreFactory.java
@@ -109,6 +109,6 @@ public class DimensionChunkStoreFactory {
    * dimension store type enum
    */
   public enum DimensionStoreType {
-    FIXED_LENGTH, VARIABLE_SHORT_LENGTH, VARIABLE_INT_LENGTH, LOCAL_DICT;
+    FIXED_LENGTH, VARIABLE_SHORT_LENGTH, VARIABLE_INT_LENGTH, LOCAL_DICT
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/columnar/UnBlockIndexer.java b/core/src/main/java/org/apache/carbondata/core/datastore/columnar/UnBlockIndexer.java
index d57dfad..fee96b8 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/columnar/UnBlockIndexer.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/columnar/UnBlockIndexer.java
@@ -31,8 +31,8 @@ public final class UnBlockIndexer {
     if (indexMap.length == 0) {
       return indexData;
     }
-    for (int i = 0; i < mapLength; i++) {
-      actualSize += indexData[indexMap[i] + 1] - indexData[indexMap[i]] - 1;
+    for (int value : indexMap) {
+      actualSize += indexData[value + 1] - indexData[value] - 1;
     }
     int[] indexes = new int[actualSize];
     int k = 0;
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/compression/GzipCompressor.java b/core/src/main/java/org/apache/carbondata/core/datastore/compression/GzipCompressor.java
index 102786b..8ec3611 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/compression/GzipCompressor.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/compression/GzipCompressor.java
@@ -97,7 +97,7 @@ public class GzipCompressor extends AbstractCompressor {
       int initialSize = (data.length * 2) < Integer.MAX_VALUE ? (data.length * 2) : data.length;
       byte[] buffer = new byte[initialSize];
       int len;
-      /**
+      /*
        * Reads the next byte of the data from the input stream and stores them into buffer
        * Data is then read from the buffer and put into byteOutputStream from a offset.
        */
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/exception/CarbonDataWriterException.java b/core/src/main/java/org/apache/carbondata/core/datastore/exception/CarbonDataWriterException.java
index 6dc4f31..ac0ff03 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/exception/CarbonDataWriterException.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/exception/CarbonDataWriterException.java
@@ -72,14 +72,6 @@ public class CarbonDataWriterException extends RuntimeException {
   }
 
   /**
-   * getLocalizedMessage
-   */
-  @Override
-  public String getLocalizedMessage() {
-    return super.getLocalizedMessage();
-  }
-
-  /**
    * getMessage
    */
   public String getMessage() {
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/exception/IndexBuilderException.java b/core/src/main/java/org/apache/carbondata/core/datastore/exception/IndexBuilderException.java
index 7296b8c..0c94799 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/exception/IndexBuilderException.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/exception/IndexBuilderException.java
@@ -76,14 +76,6 @@ public class IndexBuilderException extends IOException {
   }
 
   /**
-   * getLocalizedMessage
-   */
-  @Override
-  public String getLocalizedMessage() {
-    return super.getLocalizedMessage();
-  }
-
-  /**
    * getMessage
    */
   public String getMessage() {
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
index 1cc7242..81b34db 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
@@ -163,8 +163,7 @@ public class LocalCarbonFile implements CarbonFile {
   }
 
   @Override
-  public CarbonFile[] listFiles(boolean recursive, int maxCount)
-      throws IOException {
+  public CarbonFile[] listFiles(boolean recursive, int maxCount) {
     // ignore the maxCount for local filesystem
     return listFiles();
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/impl/DefaultFileTypeProvider.java b/core/src/main/java/org/apache/carbondata/core/datastore/impl/DefaultFileTypeProvider.java
index 6ce9020..adb727e 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/impl/DefaultFileTypeProvider.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/impl/DefaultFileTypeProvider.java
@@ -100,8 +100,6 @@ public class DefaultFileTypeProvider implements FileTypeInterface {
 
     FileFactory.FileType fileType = FileFactory.getFileType(path);
     switch (fileType) {
-      case LOCAL:
-        return new LocalCarbonFile(FileFactory.getUpdatedFilePath(path));
       case HDFS:
       case HDFS_LOCAL:
         return new HDFSCarbonFile(path, conf);
@@ -111,6 +109,7 @@ public class DefaultFileTypeProvider implements FileTypeInterface {
         return new AlluxioCarbonFile(path);
       case VIEWFS:
         return new ViewFSCarbonFile(path);
+      case LOCAL:
       default:
         return new LocalCarbonFile(FileFactory.getUpdatedFilePath(path));
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
index 1e520b9..6d1874b 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
@@ -95,14 +95,13 @@ public final class FileFactory {
   public static FileReader getFileHolder(FileFactory.FileType fileType,
       Configuration configuration) {
     switch (fileType) {
-      case LOCAL:
-        return new FileReaderImpl();
       case HDFS:
       case ALLUXIO:
       case VIEWFS:
       case S3:
       case HDFS_LOCAL:
         return new DFSFileReaderImpl(configuration);
+      case LOCAL:
       default:
         return new FileReaderImpl();
     }
@@ -401,7 +400,6 @@ public final class FileFactory {
             fileChannel.close();
           }
         }
-        return;
     }
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileTypeInterface.java b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileTypeInterface.java
index 8127f26..c056f09 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileTypeInterface.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileTypeInterface.java
@@ -33,7 +33,7 @@ public interface FileTypeInterface {
    * @param configuration configuration
    * @return CarbonFile instance
    */
-  public CarbonFile getCarbonFile(String path, Configuration configuration);
+  CarbonFile getCarbonFile(String path, Configuration configuration);
 
   /**
    * Check if the FileSystem mapped with the given path is supported or not.
@@ -41,6 +41,6 @@ public interface FileTypeInterface {
    * @param path path of the file
    * @return true if supported, false if not supported
    */
-  public boolean isPathSupported(String path);
+  boolean isPathSupported(String path);
 }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
index 45a5658..1905318 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/ComplexColumnPage.java
@@ -113,21 +113,17 @@ public class ComplexColumnPage {
 
   private boolean isColumnPageBasedOnDataType(int columnPageIndex) {
     DataType dataType = complexColumnInfoList.get(columnPageIndex).getColumnDataTypes();
-    if ((complexColumnInfoList.get(columnPageIndex).isNoDictionary() &&
-        !((DataTypes.isStructType(dataType) ||
-            DataTypes.isArrayType(dataType) ||
-            DataTypes.isMapType(dataType) ||
-            (dataType == DataTypes.STRING) ||
-            (dataType == DataTypes.VARCHAR) ||
-            (dataType == DataTypes.BINARY) ||
-            (dataType == DataTypes.DATE) ||
-            DataTypes.isDecimal(dataType))))) {
-      // For all these above condition the ColumnPage should be Taken as BYTE_ARRAY
-      // for all other cases make Column Page Based on each DataType.
-      return true;
-    } else {
-      return false;
-    }
+    // For all these above condition the ColumnPage should be Taken as BYTE_ARRAY
+    // for all other cases make Column Page Based on each DataType.
+    return complexColumnInfoList.get(columnPageIndex).isNoDictionary()
+        && !((DataTypes.isStructType(dataType)
+            || DataTypes.isArrayType(dataType)
+            || DataTypes.isMapType(dataType)
+            || (dataType == DataTypes.STRING)
+            || (dataType == DataTypes.VARCHAR)
+            || (dataType == DataTypes.BINARY)
+            || (dataType == DataTypes.DATE)
+            || DataTypes.isDecimal(dataType)));
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeFixLengthColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeFixLengthColumnPage.java
index d6f5d0d..e1a1baf 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeFixLengthColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeFixLengthColumnPage.java
@@ -283,8 +283,8 @@ public class SafeFixLengthColumnPage extends ColumnPage {
   @Override
   public byte[][] getByteArrayPage() {
     byte[][] data = new byte[arrayElementCount][];
-    for (int i = 0; i < arrayElementCount; i++) {
-      data[i] = fixedLengthData[i];
+    if (arrayElementCount > 0) {
+      System.arraycopy(fixedLengthData, 0, data, 0, arrayElementCount);
     }
     return data;
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeVarLengthColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeVarLengthColumnPage.java
index 0d34b06..9237205 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeVarLengthColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/SafeVarLengthColumnPage.java
@@ -22,6 +22,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.carbondata.core.datastore.page.encoding.ColumnPageEncoderMeta;
@@ -73,9 +74,7 @@ public class SafeVarLengthColumnPage extends VarLengthColumnPageBase {
 
   @Override
   public void setByteArrayPage(byte[][] byteArray) {
-    for (byte[] data : byteArray) {
-      byteArrayData.add(data);
-    }
+    byteArrayData.addAll(Arrays.asList(byteArray));
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeDecimalColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeDecimalColumnPage.java
index c6086d2..ae57970 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeDecimalColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeDecimalColumnPage.java
@@ -51,9 +51,9 @@ public class UnsafeDecimalColumnPage extends DecimalColumnPage {
       int size = pageSize * 3;
       memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, size);
     } else if (DataTypes.isDecimal(columnPageEncoderMeta.getStoreDataType())) {
-      memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, (long) (capacity));
+      memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, capacity);
     } else if (columnPageEncoderMeta.getStoreDataType() == DataTypes.BYTE_ARRAY) {
-      memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, (long) (capacity));
+      memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, capacity);
     } else {
       throw new UnsupportedOperationException(
           "invalid data type: " + columnPageEncoderMeta.getStoreDataType());
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeVarLengthColumnPage.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeVarLengthColumnPage.java
index ddee0a9..bdf7f83 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeVarLengthColumnPage.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/UnsafeVarLengthColumnPage.java
@@ -39,7 +39,7 @@ public class UnsafeVarLengthColumnPage extends UnsafeVarLengthColumnPageBase {
     } else {
       capacity = (int) (pageSize * DEFAULT_ROW_SIZE * FACTOR);
     }
-    memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, (long) (capacity));
+    memoryBlock = UnsafeMemoryManager.allocateMemoryWithRetry(taskId, capacity);
     baseAddress = memoryBlock.getBaseObject();
     baseOffset = memoryBlock.getBaseOffset();
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/VarLengthColumnPageBase.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/VarLengthColumnPageBase.java
index fa1faa6..bd7b55b 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/VarLengthColumnPageBase.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/VarLengthColumnPageBase.java
@@ -244,17 +244,14 @@ public abstract class VarLengthColumnPageBase extends ColumnPage {
       int offset, String compressorName) {
     int lvEncodedOffset;
     int length;
-    int numRows = rowId;
 
     VarLengthColumnPageBase page;
-    int inputDataLength = offset;
     if (unsafe) {
       page = new UnsafeDecimalColumnPage(
-          new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), numRows,
-          inputDataLength);
+          new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), rowId, offset);
     } else {
       page = new SafeDecimalColumnPage(
-          new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), numRows);
+          new ColumnPageEncoderMeta(columnSpec, dataType, compressorName), rowId);
     }
 
     // set total length and rowOffset in page
@@ -264,7 +261,7 @@ public abstract class VarLengthColumnPageBase extends ColumnPage {
 
     // set data in page
     lvEncodedOffset = 0;
-    for (int i = 0; i < numRows; i++) {
+    for (int i = 0; i < rowId; i++) {
       length = rowOffset.getInt(i + 1) - rowOffset.getInt(i);
       page.putBytes(i, lvEncodedBytes, lvEncodedOffset + lvLength, length);
       lvEncodedOffset += lvLength + length;
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveCodec.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveCodec.java
index 72c201e..2accab5 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveCodec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveCodec.java
@@ -172,12 +172,12 @@ public abstract class AdaptiveCodec implements ColumnPageCodec {
       }
       if (indexStorage.getRowIdPageLengthInBytes() > 0) {
         out.writeInt(indexStorage.getRowIdPageLengthInBytes());
-        short[] rowIdPage = (short[]) indexStorage.getRowIdPage();
+        short[] rowIdPage = indexStorage.getRowIdPage();
         for (short rowId : rowIdPage) {
           out.writeShort(rowId);
         }
         if (indexStorage.getRowIdRlePageLengthInBytes() > 0) {
-          short[] rowIdRlePage = (short[]) indexStorage.getRowIdRlePage();
+          short[] rowIdRlePage = indexStorage.getRowIdRlePage();
           for (short rowIdRle : rowIdRlePage) {
             out.writeShort(rowIdRle);
           }
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveDeltaIntegralCodec.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveDeltaIntegralCodec.java
index 67e384a..a7b9e5b 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveDeltaIntegralCodec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveDeltaIntegralCodec.java
@@ -159,10 +159,8 @@ public class AdaptiveDeltaIntegralCodec extends AdaptiveCodec {
         }
         if (DataTypes.isDecimal(meta.getSchemaDataType())) {
           TableSpec.ColumnSpec columnSpec = meta.getColumnSpec();
-          DecimalConverterFactory.DecimalConverter decimalConverter =
-              DecimalConverterFactory.INSTANCE
-                  .getDecimalConverter(columnSpec.getPrecision(), columnSpec.getScale());
-          vectorInfo.decimalConverter = decimalConverter;
+          vectorInfo.decimalConverter = DecimalConverterFactory.INSTANCE
+              .getDecimalConverter(columnSpec.getPrecision(), columnSpec.getScale());
         }
         converter.decodeAndFillVector(unCompressData, vectorInfo, nullBits, meta.getStoreDataType(),
             pageSize);
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java
index a4b83bf..92ea181 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveFloatingCodec.java
@@ -186,7 +186,7 @@ public class AdaptiveFloatingCodec extends AdaptiveCodec {
       } else if (targetDataType == DataTypes.INT) {
         encodedPage.putInt(rowId, (int) Math.round(value * factor));
       } else if (targetDataType == DataTypes.LONG) {
-        encodedPage.putLong(rowId, (long) Math.round(value * factor));
+        encodedPage.putLong(rowId, Math.round(value * factor));
       } else if (targetDataType == DataTypes.DOUBLE) {
         encodedPage.putDouble(rowId, value);
       } else {
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveIntegralCodec.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveIntegralCodec.java
index 40b3331..812793f 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveIntegralCodec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/adaptive/AdaptiveIntegralCodec.java
@@ -136,10 +136,8 @@ public class AdaptiveIntegralCodec extends AdaptiveCodec {
         }
         if (DataTypes.isDecimal(meta.getSchemaDataType())) {
           TableSpec.ColumnSpec columnSpec = meta.getColumnSpec();
-          DecimalConverterFactory.DecimalConverter decimalConverter =
-              DecimalConverterFactory.INSTANCE
-                  .getDecimalConverter(columnSpec.getPrecision(), columnSpec.getScale());
-          vectorInfo.decimalConverter = decimalConverter;
+          vectorInfo.decimalConverter = DecimalConverterFactory.INSTANCE
+              .getDecimalConverter(columnSpec.getPrecision(), columnSpec.getScale());
         }
         converter.decodeAndFillVector(unCompressData, vectorInfo, nullBits, meta.getStoreDataType(),
             pageSize);
@@ -200,7 +198,7 @@ public class AdaptiveIntegralCodec extends AdaptiveCodec {
       } else if (targetDataType == DataTypes.INT) {
         encodedPage.putInt(rowId, (int) value);
       } else if (targetDataType == DataTypes.LONG) {
-        encodedPage.putLong(rowId, (long) value);
+        encodedPage.putLong(rowId, value);
       } else {
         throw new RuntimeException("internal error: " + debugInfo());
       }
@@ -311,11 +309,11 @@ public class AdaptiveIntegralCodec extends AdaptiveCodec {
       if (pageDataType == DataTypes.BOOLEAN || pageDataType == DataTypes.BYTE) {
         if (vectorDataType == DataTypes.SHORT) {
           for (int i = 0; i < pageSize; i++) {
-            vector.putShort(i, (short) pageData[i]);
+            vector.putShort(i, pageData[i]);
           }
         } else if (vectorDataType == DataTypes.INT) {
           for (int i = 0; i < pageSize; i++) {
-            vector.putInt(i, (int) pageData[i]);
+            vector.putInt(i, pageData[i]);
           }
         } else if (vectorDataType == DataTypes.LONG) {
           for (int i = 0; i < pageSize; i++) {
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
index 9d47886..5e78bd3 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/compress/DirectCompressCodec.java
@@ -264,11 +264,11 @@ public class DirectCompressCodec implements ColumnPageCodec {
       if (pageDataType == DataTypes.BOOLEAN || pageDataType == DataTypes.BYTE) {
         if (vectorDataType == DataTypes.SHORT) {
           for (int i = 0; i < pageSize; i++) {
-            vector.putShort(i, (short) pageData[i]);
+            vector.putShort(i, pageData[i]);
           }
         } else if (vectorDataType == DataTypes.INT) {
           for (int i = 0; i < pageSize; i++) {
-            vector.putInt(i, (int) pageData[i]);
+            vector.putInt(i, pageData[i]);
           }
         } else if (vectorDataType == DataTypes.LONG) {
           for (int i = 0; i < pageSize; i++) {
diff --git a/core/src/main/java/org/apache/carbondata/core/exception/ConcurrentOperationException.java b/core/src/main/java/org/apache/carbondata/core/exception/ConcurrentOperationException.java
index 918268c..55ef8e0 100644
--- a/core/src/main/java/org/apache/carbondata/core/exception/ConcurrentOperationException.java
+++ b/core/src/main/java/org/apache/carbondata/core/exception/ConcurrentOperationException.java
@@ -31,10 +31,5 @@ public class ConcurrentOperationException extends MalformedCarbonCommandExceptio
   public ConcurrentOperationException(CarbonTable table, String command1, String command2) {
     this(table.getDatabaseName(), table.getTableName(), command1, command2);
   }
-
-  public String getMessage() {
-    return super.getMessage();
-  }
-
 }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/index/IndexChooser.java b/core/src/main/java/org/apache/carbondata/core/index/IndexChooser.java
index 06cd079..3cc9af5 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/IndexChooser.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/IndexChooser.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 import org.apache.carbondata.common.annotations.InterfaceAudience;
@@ -341,7 +342,7 @@ public class IndexChooser {
       IndexTuple that = (IndexTuple) o;
 
       if (order != that.order) return false;
-      return index != null ? index.equals(that.index) : that.index == null;
+      return Objects.equals(index, that.index);
     }
 
     @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/index/IndexLevel.java b/core/src/main/java/org/apache/carbondata/core/index/IndexLevel.java
index c140a2e..109fdbe 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/IndexLevel.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/IndexLevel.java
@@ -34,5 +34,5 @@ public enum IndexLevel {
   /**
    * Fine Grain Index, index is of row level
    */
-  FG;
+  FG
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/index/IndexMeta.java b/core/src/main/java/org/apache/carbondata/core/index/IndexMeta.java
index 309aed2..03fed1c 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/IndexMeta.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/IndexMeta.java
@@ -75,12 +75,13 @@ public class IndexMeta {
 
   @Override
   public String toString() {
-    return new StringBuilder("IndexMeta{")
-        .append("indexName='").append(indexName).append('\'')
-        .append(", indexedColumns=[")
-        .append(StringUtils.join(getIndexedColumnNames(), ", ")).append("]\'")
-        .append(", optimizedOperation=").append(optimizedOperation)
-        .append('}')
+    return new StringBuilder("IndexMeta{indexName='")
+        .append(indexName)
+        .append("', indexedColumns='[")
+        .append(StringUtils.join(getIndexedColumnNames(), ", "))
+        .append("]', optimizedOperation='")
+        .append(optimizedOperation)
+        .append("'}")
         .toString();
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/index/IndexStoreManager.java b/core/src/main/java/org/apache/carbondata/core/index/IndexStoreManager.java
index 2a69e17..8cb157e 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/IndexStoreManager.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/IndexStoreManager.java
@@ -20,7 +20,6 @@ package org.apache.carbondata.core.index;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -573,11 +572,9 @@ public final class IndexStoreManager {
     List<TableIndex> indexes = getAllCGAndFGIndexes(carbonTable);
     List<TableIndex> remainingIndexes = new ArrayList<>();
     if (StringUtils.isNotEmpty(indexToClear)) {
-      Iterator<TableIndex> indexIterator = indexes.iterator();
-      while (indexIterator.hasNext()) {
-        TableIndex tableIndex = indexIterator.next();
+      for (TableIndex tableIndex : indexes) {
         if (indexToClear.equalsIgnoreCase(tableIndex.getIndexSchema().getIndexName())) {
-          for (String segment: segmentNos) {
+          for (String segment : segmentNos) {
             tableIndex.deleteSegmentIndexData(segment);
           }
           tableIndex.clear();
diff --git a/core/src/main/java/org/apache/carbondata/core/index/IndexUtil.java b/core/src/main/java/org/apache/carbondata/core/index/IndexUtil.java
index bae52a3..473377c 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/IndexUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/IndexUtil.java
@@ -186,10 +186,9 @@ public class IndexUtil {
    @param carbonTable
    @param indexExprWrapper
    @param validSegments
-   @throws IOException
    */
   public static void loadIndexes(CarbonTable carbonTable, IndexExprWrapper indexExprWrapper,
-      List<Segment> validSegments) throws IOException {
+      List<Segment> validSegments) {
     if (!CarbonProperties.getInstance()
         .isDistributedPruningEnabled(carbonTable.getDatabaseName(), carbonTable.getTableName())
         && BlockletIndexUtil.loadIndexesParallel(carbonTable)) {
diff --git a/core/src/main/java/org/apache/carbondata/core/index/TableIndex.java b/core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
index 0da8f79..c4c600a 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/TableIndex.java
@@ -165,9 +165,7 @@ public final class TableIndex extends OperationEventListener {
       return pruneWithFilter(segments, filter, partitionLocations, blocklets, indexes);
     }
     // handle by multi-thread
-    List<ExtendedBlocklet> extendedBlocklets = pruneMultiThread(
-        segments, filter, blocklets, indexes, totalFiles);
-    return extendedBlocklets;
+    return pruneMultiThread(segments, filter, blocklets, indexes, totalFiles);
   }
 
   private List<Segment> getCarbonSegments(List<Segment> allSegments) {
@@ -476,8 +474,7 @@ public final class TableIndex extends OperationEventListener {
     return distributableList;
   }
 
-  public IndexInputSplitWrapper toDistributableSegment(Segment segment, String uniqueId)
-      throws IOException {
+  public IndexInputSplitWrapper toDistributableSegment(Segment segment, String uniqueId) {
     return indexFactory.toDistributableSegment(segment, indexSchema, identifier, uniqueId);
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/index/dev/BlockletSerializer.java b/core/src/main/java/org/apache/carbondata/core/index/dev/BlockletSerializer.java
index ffa0740..e4e80d4 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/dev/BlockletSerializer.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/dev/BlockletSerializer.java
@@ -40,12 +40,8 @@ public class BlockletSerializer {
    */
   public void serializeBlocklet(FineGrainBlocklet grainBlocklet, String writePath)
       throws IOException {
-    DataOutputStream dataOutputStream =
-        FileFactory.getDataOutputStream(writePath);
-    try {
+    try (DataOutputStream dataOutputStream = FileFactory.getDataOutputStream(writePath)) {
       grainBlocklet.write(dataOutputStream);
-    } finally {
-      dataOutputStream.close();
     }
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/index/dev/IndexWriter.java b/core/src/main/java/org/apache/carbondata/core/index/dev/IndexWriter.java
index cb0b04f..17e0474 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/dev/IndexWriter.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/dev/IndexWriter.java
@@ -114,8 +114,7 @@ public abstract class IndexWriter {
           "index file " + indexFile + " is not written in provided directory path "
               + indexPath);
     }
-    String indexFileName =
-        indexFile.substring(indexPath.length(), indexFile.length());
+    String indexFileName = indexFile.substring(indexPath.length());
     String carbonFilePath = indexFileName.substring(0, indexFileName.lastIndexOf("/"));
     String segmentPath = CarbonTablePath.getSegmentPath(tablePath, segmentId);
     if (carbonFilePath.length() > 0) {
diff --git a/core/src/main/java/org/apache/carbondata/core/index/dev/expr/AndIndexExprWrapper.java b/core/src/main/java/org/apache/carbondata/core/index/dev/expr/AndIndexExprWrapper.java
index a3b5167..c987063 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/dev/expr/AndIndexExprWrapper.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/dev/expr/AndIndexExprWrapper.java
@@ -87,10 +87,8 @@ public class AndIndexExprWrapper extends IndexExprWrapper {
     FilterResolverIntf rightExp = right.getFilterResolverIntf(uniqueId);
     if (leftExp != null) {
       return leftExp;
-    } else if (rightExp != null) {
-      return rightExp;
     }
-    return null;
+    return rightExp;
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/index/dev/expr/OrIndexExprWrapper.java b/core/src/main/java/org/apache/carbondata/core/index/dev/expr/OrIndexExprWrapper.java
index ec714de..f7bd9ba 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/dev/expr/OrIndexExprWrapper.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/dev/expr/OrIndexExprWrapper.java
@@ -102,10 +102,8 @@ public class OrIndexExprWrapper extends IndexExprWrapper {
     FilterResolverIntf rightExp = right.getFilterResolverIntf(uniqueId);
     if (leftExp != null) {
       return leftExp;
-    } else if (rightExp != null) {
-      return rightExp;
     }
-    return null;
+    return rightExp;
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/index/dev/fgindex/FineGrainBlocklet.java b/core/src/main/java/org/apache/carbondata/core/index/dev/fgindex/FineGrainBlocklet.java
index 7ff93186..e6c3230 100644
--- a/core/src/main/java/org/apache/carbondata/core/index/dev/fgindex/FineGrainBlocklet.java
+++ b/core/src/main/java/org/apache/carbondata/core/index/dev/fgindex/FineGrainBlocklet.java
@@ -102,8 +102,8 @@ public class FineGrainBlocklet extends Blocklet implements Serializable {
 
   public BitSetGroup getBitSetGroup(int numberOfPages) {
     BitSetGroup bitSetGroup = new BitSetGroup(numberOfPages);
-    for (int i = 0; i < pages.size(); i++) {
-      bitSetGroup.setBitSet(pages.get(i).getBitSet(), pages.get(i).pageId);
+    for (Page page : pages) {
+      bitSetGroup.setBitSet(page.getBitSet(), page.pageId);
     }
     return bitSetGroup;
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/Blocklet.java b/core/src/main/java/org/apache/carbondata/core/indexstore/Blocklet.java
index 970b025..4a4e802 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/Blocklet.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/Blocklet.java
@@ -21,6 +21,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.Serializable;
+import java.util.Objects;
 
 import org.apache.hadoop.io.Writable;
 
@@ -105,24 +106,23 @@ public class Blocklet implements Writable, Serializable {
 
     Blocklet blocklet = (Blocklet) o;
 
-    if (filePath != null ? !filePath.equals(blocklet.filePath) : blocklet.filePath != null) {
+    if (!Objects.equals(filePath, blocklet.filePath)) {
       return false;
     }
     if (!compareBlockletIdForObjectMatching) {
       return true;
     }
-    return blockletId != null ?
-        blockletId.equals(blocklet.blockletId) :
-        blocklet.blockletId == null;
+    return Objects.equals(blockletId, blocklet.blockletId);
   }
 
   @Override
   public String toString() {
-    final StringBuffer sb = new StringBuffer("Blocklet{");
-    sb.append("filePath='").append(filePath).append('\'');
-    sb.append(", blockletId='").append(blockletId).append('\'');
-    sb.append('}');
-    return sb.toString();
+    return new StringBuilder("Blocklet{filePath='")
+        .append(filePath)
+        .append("', blockletId='")
+        .append(blockletId)
+        .append("'}")
+        .toString();
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapper.java b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapper.java
index 67d2eb8..c4ca68b 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapper.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapper.java
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -150,9 +149,7 @@ public class ExtendedBlockletWrapper implements Writable, Serializable {
       throws IOException {
     stream.writeInt(extendedBlockletList.size());
     String[] uniqueLoc = new String[uniqueLocation.size()];
-    Iterator<Map.Entry<String, Short>> iterator = uniqueLocation.entrySet().iterator();
-    while (iterator.hasNext()) {
-      final Map.Entry<String, Short> next = iterator.next();
+    for (Map.Entry<String, Short> next : uniqueLocation.entrySet()) {
       uniqueLoc[next.getValue()] = next.getKey();
     }
     stream.writeShort((short) uniqueLoc.length);
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapperContainer.java b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapperContainer.java
index 9816181..7e998af 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapperContainer.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlockletWrapperContainer.java
@@ -83,11 +83,11 @@ public class ExtendedBlockletWrapperContainer implements Writable {
       int start = 0;
       int end = 0;
       List<Future<List<ExtendedBlocklet>>> futures = new ArrayList<>();
-      for (int i = 0; i < split.length; i++) {
-        end += split[i];
+      for (int value : split) {
+        end += value;
         futures.add(executorService.submit(
             new ExtendedBlockletDeserializerThread(start, end, tablePath, queryId, isCountJob)));
-        start += split[i];
+        start += value;
       }
       executorService.shutdown();
       try {
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/UnsafeMemoryDMStore.java b/core/src/main/java/org/apache/carbondata/core/indexstore/UnsafeMemoryDMStore.java
index a8af285..0cc15cf 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/UnsafeMemoryDMStore.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/UnsafeMemoryDMStore.java
@@ -123,21 +123,19 @@ public class UnsafeMemoryDMStore extends AbstractMemoryDMStore {
     ensureSize(rowSize);
     int pointer = runningLength;
     int bytePosition = 0;
-    for (int i = 0; i < schema.length; i++) {
-      switch (schema[i].getSchemaType()) {
-        case STRUCT:
-          CarbonRowSchema[] childSchemas =
-              ((CarbonRowSchema.StructCarbonRowSchema) schema[i]).getChildSchemas();
-          for (int j = 0; j < childSchemas.length; j++) {
-            if (childSchemas[j].getBytePosition() > bytePosition) {
-              bytePosition = childSchemas[j].getBytePosition();
-            }
-          }
-          break;
-        default:
-          if (schema[i].getBytePosition() > bytePosition) {
-            bytePosition = schema[i].getBytePosition();
+    for (CarbonRowSchema carbonRowSchema : schema) {
+      if (carbonRowSchema.getSchemaType() == CarbonRowSchema.IndexSchemaType.STRUCT) {
+        CarbonRowSchema[] childSchemas =
+            ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
+        for (int j = 0; j < childSchemas.length; j++) {
+          if (childSchemas[j].getBytePosition() > bytePosition) {
+            bytePosition = childSchemas[j].getBytePosition();
           }
+        }
+      } else {
+        if (carbonRowSchema.getBytePosition() > bytePosition) {
+          bytePosition = carbonRowSchema.getBytePosition();
+        }
       }
     }
     // byte position of Last offset
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockIndex.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockIndex.java
index 18c37ee..31d2ecb 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockIndex.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockIndex.java
@@ -142,7 +142,7 @@ public class BlockIndex extends CoarseGrainIndex
     } else {
       filePath = new byte[0];
     }
-    byte[] fileName = path.substring(path.lastIndexOf("/") + 1, path.length())
+    byte[] fileName = path.substring(path.lastIndexOf("/") + 1)
         .getBytes(CarbonCommonConstants.DEFAULT_CHARSET);
     byte[] segmentId =
         blockletIndexModel.getSegmentId().getBytes(CarbonCommonConstants.DEFAULT_CHARSET);
@@ -568,10 +568,7 @@ public class BlockIndex extends CoarseGrainIndex
         .isScanRequired(filterExecutor, getMinMaxValue(unsafeRow, TASK_MAX_VALUES_INDEX),
             getMinMaxValue(unsafeRow, TASK_MIN_VALUES_INDEX),
             getMinMaxFlag(unsafeRow, TASK_MIN_MAX_FLAG));
-    if (isScanRequired) {
-      return true;
-    }
-    return false;
+    return isScanRequired;
   }
 
   protected List<CarbonColumn> getMinMaxCacheColumns() {
@@ -815,11 +812,7 @@ public class BlockIndex extends CoarseGrainIndex
     } else {
       bitSet = filterExecutor.isScanRequired(maxValue, minValue, minMaxFlag);
     }
-    if (!bitSet.isEmpty()) {
-      return true;
-    } else {
-      return false;
-    }
+    return !bitSet.isEmpty();
   }
 
   public ExtendedBlocklet getDetailedBlocklet(String blockletId) {
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataRefNode.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataRefNode.java
index 6893876..53e01ff 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataRefNode.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletDataRefNode.java
@@ -150,18 +150,14 @@ public class BlockletDataRefNode implements DataRefNode {
   public MeasureRawColumnChunk[] readMeasureChunks(FileReader fileReader, int[][] columnIndexRange)
       throws IOException {
     MeasureColumnChunkReader measureColumnChunkReader = getMeasureColumnChunkReader(fileReader);
-    MeasureRawColumnChunk[] measureRawColumnChunks =
-        measureColumnChunkReader.readRawMeasureChunks(fileReader, columnIndexRange);
-    return measureRawColumnChunks;
+    return measureColumnChunkReader.readRawMeasureChunks(fileReader, columnIndexRange);
   }
 
   @Override
   public MeasureRawColumnChunk readMeasureChunk(FileReader fileReader, int columnIndex)
       throws IOException {
     MeasureColumnChunkReader measureColumnChunkReader = getMeasureColumnChunkReader(fileReader);
-    MeasureRawColumnChunk measureRawColumnChunk =
-        measureColumnChunkReader.readRawMeasureChunk(fileReader, columnIndex);
-    return measureRawColumnChunk;
+    return measureColumnChunkReader.readRawMeasureChunk(fileReader, columnIndex);
   }
 
   private DimensionColumnChunkReader getDimensionColumnChunkReader(FileReader fileReader) {
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletIndexFactory.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletIndexFactory.java
index f26f654..7989b99 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletIndexFactory.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/BlockletIndexFactory.java
@@ -596,7 +596,7 @@ public class BlockletIndexFactory extends CoarseGrainIndexFactory
     List<TableBlockIndexUniqueIdentifierWrapper> identifiersWrapper = new ArrayList<>();
     String parent = indexFilePath.substring(0, indexFilePath.lastIndexOf("/"));
     String name =
-        indexFilePath.substring(indexFilePath.lastIndexOf("/") + 1, indexFilePath.length());
+        indexFilePath.substring(indexFilePath.lastIndexOf("/") + 1);
     if (indexFilePath.endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
       identifiersWrapper.add(new TableBlockIndexUniqueIdentifierWrapper(
           new TableBlockIndexUniqueIdentifier(parent, name, null, segmentId),
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java
index 8fbc7f6..39b6048 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/blockletindex/SegmentIndexFileStore.java
@@ -52,7 +52,6 @@ import org.apache.carbondata.format.MergedBlockIndexHeader;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.log4j.Logger;
-import org.apache.thrift.TBase;
 
 /**
  * This class manages reading of index files with in the segment. The files it read can be
@@ -104,11 +103,11 @@ public class SegmentIndexFileStore {
    */
   public void readAllIIndexOfSegment(String segmentPath) throws IOException {
     CarbonFile[] carbonIndexFiles = getCarbonIndexFiles(segmentPath, configuration);
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
-        readMergeFile(carbonIndexFiles[i].getCanonicalPath());
-      } else if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        readIndexFile(carbonIndexFiles[i]);
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+        readMergeFile(carbonIndexFile.getCanonicalPath());
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        readIndexFile(carbonIndexFile);
       }
     }
   }
@@ -153,11 +152,11 @@ public class SegmentIndexFileStore {
         }
       }
     }
-    for (int i = 0; i < carbonIndexFiles.size(); i++) {
-      if (carbonIndexFiles.get(i).getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
-        readMergeFile(carbonIndexFiles.get(i).getCanonicalPath());
-      } else if (carbonIndexFiles.get(i).getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        readIndexFile(carbonIndexFiles.get(i));
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+        readMergeFile(carbonIndexFile.getCanonicalPath());
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        readIndexFile(carbonIndexFile);
       }
     }
   }
@@ -171,11 +170,11 @@ public class SegmentIndexFileStore {
   public void readAllIndexAndFillBlockletInfo(String segmentPath) throws IOException {
     CarbonFile[] carbonIndexFiles =
         getCarbonIndexFiles(segmentPath, FileFactory.getConfiguration());
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
-        readMergeFile(carbonIndexFiles[i].getCanonicalPath());
-      } else if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        readIndexAndFillBlockletInfo(carbonIndexFiles[i]);
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+        readMergeFile(carbonIndexFile.getCanonicalPath());
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        readIndexAndFillBlockletInfo(carbonIndexFile);
       }
     }
   }
@@ -188,11 +187,11 @@ public class SegmentIndexFileStore {
    */
   public void readAllIIndexOfSegment(CarbonFile[] carbonFiles) throws IOException {
     CarbonFile[] carbonIndexFiles = getCarbonIndexFiles(carbonFiles);
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
-        readMergeFile(carbonIndexFiles[i].getCanonicalPath());
-      } else if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        readIndexFile(carbonIndexFiles[i]);
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+        readMergeFile(carbonIndexFile.getCanonicalPath());
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        readIndexFile(carbonIndexFile);
       }
     }
   }
@@ -208,16 +207,16 @@ public class SegmentIndexFileStore {
     CarbonFile[] carbonIndexFiles =
         getCarbonIndexFiles(segmentPath, FileFactory.getConfiguration());
     Map<String, String> indexFiles = new HashMap<>();
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
         List<String> indexFilesFromMergeFile =
-            getIndexFilesFromMergeFile(carbonIndexFiles[i].getCanonicalPath());
-        for (String file: indexFilesFromMergeFile) {
-          indexFiles.put(carbonIndexFiles[i].getParentFile().getAbsolutePath()
-              + CarbonCommonConstants.FILE_SEPARATOR + file, carbonIndexFiles[i].getName());
+            getIndexFilesFromMergeFile(carbonIndexFile.getCanonicalPath());
+        for (String file : indexFilesFromMergeFile) {
+          indexFiles.put(carbonIndexFile.getParentFile().getAbsolutePath()
+              + CarbonCommonConstants.FILE_SEPARATOR + file, carbonIndexFile.getName());
         }
-      } else if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        indexFiles.put(carbonIndexFiles[i].getAbsolutePath(), null);
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        indexFiles.put(carbonIndexFile.getAbsolutePath(), null);
       }
     }
     return indexFiles;
@@ -233,12 +232,11 @@ public class SegmentIndexFileStore {
     CarbonFile[] carbonIndexFiles =
         getCarbonIndexFiles(segmentPath, FileFactory.getConfiguration());
     Map<String, String> indexFiles = new HashMap<>();
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
-        indexFiles
-            .put(carbonIndexFiles[i].getAbsolutePath(), carbonIndexFiles[i].getAbsolutePath());
-      } else if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
-        indexFiles.put(carbonIndexFiles[i].getAbsolutePath(), null);
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+        indexFiles.put(carbonIndexFile.getAbsolutePath(), carbonIndexFile.getAbsolutePath());
+      } else if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
+        indexFiles.put(carbonIndexFile.getAbsolutePath(), null);
       }
     }
     return indexFiles;
@@ -297,35 +295,22 @@ public class SegmentIndexFileStore {
    */
   public void readIndexFile(CarbonFile indexFile) throws IOException {
     String indexFilePath = indexFile.getCanonicalPath();
-    DataInputStream dataInputStream = FileFactory
-        .getDataInputStream(indexFilePath, configuration);
-    byte[] bytes = new byte[(int) indexFile.getSize()];
-    try {
+    try (DataInputStream dataInputStream =
+        FileFactory.getDataInputStream(indexFilePath, configuration)) {
+      byte[] bytes = new byte[(int) indexFile.getSize()];
       dataInputStream.readFully(bytes);
       carbonIndexMap.put(indexFile.getName(), bytes);
       carbonIndexMapWithFullPath.put(indexFile.getAbsolutePath(), bytes);
-    } finally {
-      dataInputStream.close();
     }
   }
 
   private MergedBlockIndexHeader readMergeBlockIndexHeader(ThriftReader thriftReader)
       throws IOException {
-    return (MergedBlockIndexHeader) thriftReader.read(new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new MergedBlockIndexHeader();
-      }
-    });
+    return (MergedBlockIndexHeader) thriftReader.read(MergedBlockIndexHeader::new);
   }
 
   private MergedBlockIndex readMergeBlockIndex(ThriftReader thriftReader) throws IOException {
-    return (MergedBlockIndex) thriftReader.read(new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new MergedBlockIndex();
-      }
-    });
+    return (MergedBlockIndex) thriftReader.read(MergedBlockIndex::new);
   }
 
   /**
@@ -462,13 +447,12 @@ public class SegmentIndexFileStore {
         // the current code, the number of entries in the index file is equal to the total number
         // of blocklets in all part files for 1 task. So to make it compatible with new structure,
         // the same entry with different blocklet info need to be repeated
-        for (int i = 0; i < blockletInfoList.size(); i++) {
+        for (BlockletInfo info : blockletInfoList) {
           BlockIndex blockIndexReplica = blockIndex.deepCopy();
-          BlockletInfo blockletInfo = blockletInfoList.get(i);
+          BlockletInfo blockletInfo = info;
           blockIndexReplica
               .setBlock_index(CarbonMetadataUtil.getBlockletIndex(blockletInfo.getBlockletIndex()));
-          blockIndexReplica
-              .setBlocklet_info(CarbonMetadataUtil.getBlockletInfo3(blockletInfo));
+          blockIndexReplica.setBlocklet_info(CarbonMetadataUtil.getBlockletInfo3(blockletInfo));
           blockIndexThrift.add(blockIndexReplica);
         }
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/indexstore/schema/SchemaGenerator.java b/core/src/main/java/org/apache/carbondata/core/indexstore/schema/SchemaGenerator.java
index f092982..7b51c59 100644
--- a/core/src/main/java/org/apache/carbondata/core/indexstore/schema/SchemaGenerator.java
+++ b/core/src/main/java/org/apache/carbondata/core/indexstore/schema/SchemaGenerator.java
@@ -90,47 +90,41 @@ public class SchemaGenerator {
     int currentSize;
     int bytePosition = 0;
     // First assign byte position to all the fixed length schema
-    for (int i = 0; i < schema.length; i++) {
-      switch (schema[i].getSchemaType()) {
-        case STRUCT:
-          CarbonRowSchema[] childSchemas =
-              ((CarbonRowSchema.StructCarbonRowSchema) schema[i]).getChildSchemas();
-          for (int j = 0; j < childSchemas.length; j++) {
-            currentSize = getSchemaSize(childSchemas[j]);
-            if (currentSize != -1) {
-              childSchemas[j].setBytePosition(bytePosition);
-              bytePosition += currentSize;
-            }
-          }
-          break;
-        default:
-          currentSize = getSchemaSize(schema[i]);
+    for (CarbonRowSchema carbonRowSchema : schema) {
+      if (carbonRowSchema.getSchemaType() == CarbonRowSchema.IndexSchemaType.STRUCT) {
+        CarbonRowSchema[] childSchemas =
+            ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
+        for (CarbonRowSchema childSchema : childSchemas) {
+          currentSize = getSchemaSize(childSchema);
           if (currentSize != -1) {
-            schema[i].setBytePosition(bytePosition);
+            childSchema.setBytePosition(bytePosition);
             bytePosition += currentSize;
           }
-          break;
+        }
+      } else {
+        currentSize = getSchemaSize(carbonRowSchema);
+        if (currentSize != -1) {
+          carbonRowSchema.setBytePosition(bytePosition);
+          bytePosition += currentSize;
+        }
       }
     }
     // adding byte position for storing offset in case of variable length columns
-    for (int i = 0; i < schema.length; i++) {
-      switch (schema[i].getSchemaType()) {
-        case STRUCT:
-          CarbonRowSchema[] childSchemas =
-              ((CarbonRowSchema.StructCarbonRowSchema) schema[i]).getChildSchemas();
-          for (int j = 0; j < childSchemas.length; j++) {
-            if (childSchemas[j].getBytePosition() == -1) {
-              childSchemas[j].setBytePosition(bytePosition);
-              bytePosition += CarbonCommonConstants.INT_SIZE_IN_BYTE;
-            }
-          }
-          break;
-        default:
-          if (schema[i].getBytePosition() == -1) {
-            schema[i].setBytePosition(bytePosition);
+    for (CarbonRowSchema carbonRowSchema : schema) {
+      if (carbonRowSchema.getSchemaType() == CarbonRowSchema.IndexSchemaType.STRUCT) {
+        CarbonRowSchema[] childSchemas =
+            ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
+        for (CarbonRowSchema childSchema : childSchemas) {
+          if (childSchema.getBytePosition() == -1) {
+            childSchema.setBytePosition(bytePosition);
             bytePosition += CarbonCommonConstants.INT_SIZE_IN_BYTE;
           }
-          break;
+        }
+      } else {
+        if (carbonRowSchema.getBytePosition() == -1) {
+          carbonRowSchema.setBytePosition(bytePosition);
+          bytePosition += CarbonCommonConstants.INT_SIZE_IN_BYTE;
+        }
       }
     }
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/localdictionary/exception/DictionaryThresholdReachedException.java b/core/src/main/java/org/apache/carbondata/core/localdictionary/exception/DictionaryThresholdReachedException.java
index 68eb49e..43a3262 100644
--- a/core/src/main/java/org/apache/carbondata/core/localdictionary/exception/DictionaryThresholdReachedException.java
+++ b/core/src/main/java/org/apache/carbondata/core/localdictionary/exception/DictionaryThresholdReachedException.java
@@ -72,14 +72,6 @@ public class DictionaryThresholdReachedException extends Exception {
   }
 
   /**
-   * getLocalizedMessage
-   */
-  @Override
-  public String getLocalizedMessage() {
-    return super.getLocalizedMessage();
-  }
-
-  /**
    * getMessage
    */
   public String getMessage() {
diff --git a/core/src/main/java/org/apache/carbondata/core/locks/AlluxioFileLock.java b/core/src/main/java/org/apache/carbondata/core/locks/AlluxioFileLock.java
index a20c302..84a55bc 100644
--- a/core/src/main/java/org/apache/carbondata/core/locks/AlluxioFileLock.java
+++ b/core/src/main/java/org/apache/carbondata/core/locks/AlluxioFileLock.java
@@ -62,20 +62,4 @@ public class AlluxioFileLock extends HdfsFileLock {
   public AlluxioFileLock(String lockFileLocation, String lockFile) {
     super(lockFileLocation, lockFile);
   }
-
-  /* (non-Javadoc)
-   * @see org.apache.carbondata.core.locks.ICarbonLock#unlock()
-   */
-  @Override
-  public boolean unlock() {
-    return super.unlock();
-  }
-
-  /* (non-Javadoc)
-   * @see org.apache.carbondata.core.locks.ICarbonLock#lock()
-   */
-  @Override
-  public boolean lock() {
-    return super.lock();
-  }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/locks/LocalFileLock.java b/core/src/main/java/org/apache/carbondata/core/locks/LocalFileLock.java
index 0720c97..0d909d5 100644
--- a/core/src/main/java/org/apache/carbondata/core/locks/LocalFileLock.java
+++ b/core/src/main/java/org/apache/carbondata/core/locks/LocalFileLock.java
@@ -89,11 +89,7 @@ public class LocalFileLock extends AbstractCarbonLock {
       } catch (OverlappingFileLockException e) {
         return false;
       }
-      if (null != fileLock) {
-        return true;
-      } else {
-        return false;
-      }
+      return null != fileLock;
     } catch (IOException e) {
       LOGGER.info(e.getMessage());
       return false;
diff --git a/core/src/main/java/org/apache/carbondata/core/memory/MemoryType.java b/core/src/main/java/org/apache/carbondata/core/memory/MemoryType.java
index 63e20d6..ce1ee7f 100644
--- a/core/src/main/java/org/apache/carbondata/core/memory/MemoryType.java
+++ b/core/src/main/java/org/apache/carbondata/core/memory/MemoryType.java
@@ -18,6 +18,5 @@
 package org.apache.carbondata.core.memory;
 
 public enum MemoryType {
-
-  OFFHEAP, ONHEAP;
+  OFFHEAP, ONHEAP
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java b/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
index 917d68a..d6dc89e 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
@@ -189,7 +189,7 @@ public class SegmentFileStore {
       if (carbonFiles != null && carbonFiles.length > 0) {
         boolean isRelative = false;
         if (location.startsWith(tablePath)) {
-          location = location.substring(tablePath.length(), location.length());
+          location = location.substring(tablePath.length());
           isRelative = true;
         }
         SegmentFile segmentFile = new SegmentFile();
@@ -278,14 +278,13 @@ public class SegmentFileStore {
    */
   public static CarbonFile[] getListOfCarbonIndexFiles(String segmentPath) {
     CarbonFile segmentFolder = FileFactory.getCarbonFile(segmentPath);
-    CarbonFile[] indexFiles = segmentFolder.listFiles(new CarbonFileFilter() {
+    return segmentFolder.listFiles(new CarbonFileFilter() {
       @Override
       public boolean accept(CarbonFile file) {
         return (file.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT) ||
             file.getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT));
       }
     });
-    return indexFiles;
   }
 
   /**
@@ -687,7 +686,7 @@ public class SegmentFileStore {
       if (listFiles != null && listFiles.length > 0) {
         boolean isRelative = false;
         if (location.startsWith(tablePath)) {
-          location = location.substring(tablePath.length(), location.length());
+          location = location.substring(tablePath.length());
           isRelative = true;
         }
         SegmentFile localSegmentFile = new SegmentFile();
@@ -814,8 +813,7 @@ public class SegmentFileStore {
       for (Map.Entry<String, List<String>> mergeFile : indexFileStore
           .getCarbonMergeFileToIndexFilesMap().entrySet()) {
         if (mergeFile.getValue().contains(entry.getKey()
-            .substring(entry.getKey().lastIndexOf(CarbonCommonConstants.FILE_SEPARATOR) + 1,
-                entry.getKey().length()))) {
+            .substring(entry.getKey().lastIndexOf(CarbonCommonConstants.FILE_SEPARATOR) + 1))) {
           indexOrMergeFiles.add(mergeFile.getKey());
           added = true;
           break;
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
index 6c8e0ed..80fb2e1 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
@@ -105,8 +105,6 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
     }
 
     switch (encoder) {
-      case DICTIONARY:
-        return org.apache.carbondata.format.Encoding.DICTIONARY;
       case DELTA:
         return org.apache.carbondata.format.Encoding.DELTA;
       case RLE:
@@ -121,6 +119,7 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
         return org.apache.carbondata.format.Encoding.DIRECT_DICTIONARY;
       case INT_LENGTH_COMPLEX_CHILD_BYTE_ARRAY:
         return org.apache.carbondata.format.Encoding.INT_LENGTH_COMPLEX_CHILD_BYTE_ARRAY;
+      case DICTIONARY:
       default:
         return org.apache.carbondata.format.Encoding.DICTIONARY;
     }
@@ -412,8 +411,6 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
       return null;
     }
     switch (encoder) {
-      case DICTIONARY:
-        return Encoding.DICTIONARY;
       case DELTA:
         return Encoding.DELTA;
       case RLE:
@@ -428,6 +425,7 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
         return Encoding.INT_LENGTH_COMPLEX_CHILD_BYTE_ARRAY;
       case DIRECT_DICTIONARY:
         return Encoding.DIRECT_DICTIONARY;
+      case DICTIONARY:
       default:
         return Encoding.DICTIONARY;
     }
@@ -447,8 +445,6 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
     switch (dataType) {
       case BOOLEAN:
         return DataTypes.BOOLEAN;
-      case STRING:
-        return DataTypes.STRING;
       case INT:
         return DataTypes.INT;
       case SHORT:
@@ -477,6 +473,7 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
         return DataTypes.FLOAT;
       case BYTE:
         return DataTypes.BYTE;
+      case STRING:
       default:
         return DataTypes.STRING;
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/datatype/Field.java b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/Field.java
index 7eea083..88b8f32 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/datatype/Field.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/Field.java
@@ -38,7 +38,6 @@ public class Field {
   private DataType type;
   private List<StructField> children;
   private String parent;
-  private String storeType = "columnar";
   private int schemaOrdinal = -1;
   private int precision = 0;
   private int scale = 0;
@@ -192,10 +191,6 @@ public class Field {
     this.parent = parent;
   }
 
-  public String getStoreType() {
-    return storeType;
-  }
-
   public int getSchemaOrdinal() {
     return schemaOrdinal;
   }
@@ -313,15 +308,11 @@ public class Field {
   public boolean equals(Object obj) {
     if (obj instanceof Field) {
       Field field = (Field) obj;
-      if ((!this.getDataType().equals(field.getDataType()))
-          || (!this.getFieldName().equals(field.getFieldName()))
-          || (!(this.getSchemaOrdinal() == (field.getSchemaOrdinal())))
-          ) {
-        return false;
-      }
+      return (this.getDataType().equals(field.getDataType()))
+          && (this.getFieldName().equals(field.getFieldName()))
+          && (this.getSchemaOrdinal() == (field.getSchemaOrdinal()));
     } else {
       return false;
     }
-    return true;
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaReader.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaReader.java
index d4e9c65..d519f02 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaReader.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaReader.java
@@ -86,12 +86,11 @@ public class SchemaReader {
 
       org.apache.carbondata.format.TableInfo tableInfo = CarbonUtil.readSchemaFile(schemaFilePath);
       SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
-      TableInfo wrapperTableInfo = schemaConverter.fromExternalToWrapperTableInfo(
+      return schemaConverter.fromExternalToWrapperTableInfo(
           tableInfo,
           "dummy",
           tableName,
           "dummy");
-      return wrapperTableInfo;
     } else {
       throw new IOException("File does not exist: " + schemaFilePath);
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexMetadata.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexMetadata.java
index dc5cbcb..066cd8d 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexMetadata.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexMetadata.java
@@ -149,8 +149,7 @@ public class IndexMetadata implements Serializable {
   }
 
   public String serialize() throws IOException {
-    String serializedIndexMeta = ObjectSerializationUtil.convertObjectToString(this);
-    return serializedIndexMeta;
+    return ObjectSerializationUtil.convertObjectToString(this);
   }
 
   public static IndexMetadata deserialize(String serializedIndexMeta) throws IOException {
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexTableInfo.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexTableInfo.java
index 5da81af..c3c7302 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexTableInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/indextable/IndexTableInfo.java
@@ -140,20 +140,19 @@ public class IndexTableInfo implements Serializable {
     if (null == indexTableInfos) {
       indexTableInfos = new IndexTableInfo[0];
     }
-    for (int i = 0; i < indexTableInfos.length; i++) {
+    for (IndexTableInfo indexTableInfo : indexTableInfos) {
       List<String> newColumnList = new ArrayList<>();
-      for (String indexColumn : indexTableInfos[i].getIndexCols()) {
+      for (String indexColumn : indexTableInfo.getIndexCols()) {
         if (indexColumn.equalsIgnoreCase(columnToBeUpdated)) {
           newColumnList.add(newColumnName);
         } else {
           newColumnList.add(indexColumn);
         }
       }
-      indexTableInfos[i].setIndexCols(newColumnList);
-      Map<String, String> indexProperties = indexTableInfos[i].getIndexProperties();
-      indexProperties
-          .put(CarbonCommonConstants.INDEX_COLUMNS, String.join(",", newColumnList));
-      indexTableInfos[i].setIndexProperties(indexProperties);
+      indexTableInfo.setIndexCols(newColumnList);
+      Map<String, String> indexProperties = indexTableInfo.getIndexProperties();
+      indexProperties.put(CarbonCommonConstants.INDEX_COLUMNS, String.join(",", newColumnList));
+      indexTableInfo.setIndexProperties(indexProperties);
     }
     return toGson(indexTableInfos);
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
index a8cc9e9..81ce39a 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
@@ -22,7 +22,6 @@ import java.io.DataOutput;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -306,7 +305,7 @@ public class CarbonTable implements Serializable, Writable {
       }
     }
     columns.addAll(visibleMeasures);
-    Collections.sort(columns, new Comparator<CarbonColumn>() {
+    columns.sort(new Comparator<CarbonColumn>() {
 
       @Override
       public int compare(CarbonColumn o1, CarbonColumn o2) {
@@ -638,9 +637,7 @@ public class CarbonTable implements Serializable, Writable {
    */
   public CarbonColumn getColumnByName(String columnName) {
     List<CarbonColumn> columns = createOrderColumn;
-    Iterator<CarbonColumn> colItr = columns.iterator();
-    while (colItr.hasNext()) {
-      CarbonColumn col = colItr.next();
+    for (CarbonColumn col : columns) {
       if (col.getColName().equalsIgnoreCase(columnName)) {
         return col;
       }
@@ -722,15 +719,11 @@ public class CarbonTable implements Serializable, Writable {
   public String getBucketHashMethod() {
     String configuredMethod = tableInfo.getFactTable().getTableProperties()
         .get(CarbonCommonConstants.BUCKET_HASH_METHOD);
-    if (configuredMethod == null) {
-      return CarbonCommonConstants.BUCKET_HASH_METHOD_DEFAULT;
-    } else {
-      if (CarbonCommonConstants.BUCKET_HASH_METHOD_NATIVE.equals(configuredMethod)) {
-        return CarbonCommonConstants.BUCKET_HASH_METHOD_NATIVE;
-      }
-      // by default we use spark_hash_expression hash method
-      return CarbonCommonConstants.BUCKET_HASH_METHOD_DEFAULT;
+    if (CarbonCommonConstants.BUCKET_HASH_METHOD_NATIVE.equals(configuredMethod)) {
+      return CarbonCommonConstants.BUCKET_HASH_METHOD_NATIVE;
     }
+    // by default we use spark_hash_expression hash method
+    return CarbonCommonConstants.BUCKET_HASH_METHOD_DEFAULT;
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTableBuilder.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTableBuilder.java
index ea6a3eb..729dcae 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTableBuilder.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTableBuilder.java
@@ -47,7 +47,6 @@ public class CarbonTableBuilder {
   }
 
   public CarbonTableBuilder isTransactionalTable(boolean isTransactionalTable) {
-    Objects.requireNonNull(isTransactionalTable, "Transactional Table should not be null");
     this.isTransactionalTable = isTransactionalTable;
     return this;
   }
@@ -61,8 +60,6 @@ public class CarbonTableBuilder {
   public CarbonTable build() {
     Objects.requireNonNull(tablePath, "tablePath should not be null");
     Objects.requireNonNull(tableSchema, "tableSchema should not be null");
-    Objects.requireNonNull(isTransactionalTable, "Transactional Table should not be null");
-
 
     TableInfo tableInfo = new TableInfo();
     tableInfo.setDatabaseName(databaseName);
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 a2be5e6..1ce7230 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
@@ -123,8 +123,7 @@ public class TableInfo implements Serializable, Writable {
       // which has added the new schema entry in the schema evolution list.
       // Currently apart from create table schema evolution entries
       // are getting added only in the alter operations.
-      isSchemaModified =
-          factTable.getSchemaEvolution().getSchemaEvolutionEntryList().size() > 1 ? true : false;
+      isSchemaModified = factTable.getSchemaEvolution().getSchemaEvolutionEntryList().size() > 1;
     }
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchemaBuilder.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchemaBuilder.java
index 28c4388..d04ceb5 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchemaBuilder.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchemaBuilder.java
@@ -177,18 +177,10 @@ public class TableSchemaBuilder {
       newColumn.setColumnName(field.getFieldName());
     }
     newColumn.setDataType(field.getDataType());
-    if (isSortColumn ||
-        field.getDataType() == DataTypes.STRING ||
-        field.getDataType() == DataTypes.VARCHAR ||
-        field.getDataType() == DataTypes.DATE ||
-        field.getDataType() == DataTypes.TIMESTAMP ||
-        field.getDataType() == DataTypes.BINARY ||
-        field.getDataType().isComplexType() ||
-        (isComplexChild))  {
-      newColumn.setDimensionColumn(true);
-    } else {
-      newColumn.setDimensionColumn(false);
-    }
+    newColumn.setDimensionColumn(isSortColumn || field.getDataType() == DataTypes.STRING
+        || field.getDataType() == DataTypes.VARCHAR || field.getDataType() == DataTypes.DATE
+        || field.getDataType() == DataTypes.TIMESTAMP || field.getDataType() == DataTypes.BINARY
+        || field.getDataType().isComplexType() || (isComplexChild));
     if (!isComplexChild) {
       newColumn.setSchemaOrdinal(ordinal++);
     } else {
diff --git a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
index 4610377..ec7894d 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
@@ -364,9 +364,7 @@ public class CarbonUpdateUtil {
       // deleting the files of a segment.
       try {
         CarbonUtil.deleteFoldersAndFilesSilent(toBeDeleted);
-      } catch (IOException e) {
-        LOGGER.error("Exception in deleting the delta files." + e);
-      } catch (InterruptedException e) {
+      } catch (IOException | InterruptedException e) {
         LOGGER.error("Exception in deleting the delta files." + e);
       }
     }
@@ -449,11 +447,7 @@ public class CarbonUpdateUtil {
       CarbonFile[] carbonDataFiles = segmentDir.listFiles(new CarbonFileFilter() {
         @Override
         public boolean accept(CarbonFile file) {
-
-          if (file.getName().endsWith(CarbonCommonConstants.FACT_FILE_EXT)) {
-            return true;
-          }
-          return false;
+          return file.getName().endsWith(CarbonCommonConstants.FACT_FILE_EXT);
         }
       });
       for (CarbonFile carbonDataFile : carbonDataFiles) {
@@ -710,9 +704,7 @@ public class CarbonUpdateUtil {
           try {
             LOGGER.info("Deleting the invalid file : " + file.getName());
             CarbonUtil.deleteFoldersAndFiles(file);
-          } catch (IOException e) {
-            LOGGER.error("Error in clean up of merged files." + e.getMessage(), e);
-          } catch (InterruptedException e) {
+          } catch (IOException | InterruptedException e) {
             LOGGER.error("Error in clean up of merged files." + e.getMessage(), e);
           }
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaBlockDetails.java b/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaBlockDetails.java
index 7362b16..2af966a 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaBlockDetails.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaBlockDetails.java
@@ -19,7 +19,6 @@ package org.apache.carbondata.core.mutate;
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -71,9 +70,8 @@ public class DeleteDeltaBlockDetails implements Serializable {
     if (null != blockletDetailsMap) {
       Set<Map.Entry<String, DeleteDeltaBlockletDetails>> entries = blockletDetailsMap.entrySet();
       if (null != entries && !entries.isEmpty()) {
-        Iterator<Map.Entry<String, DeleteDeltaBlockletDetails>> iterator = entries.iterator();
-        while (iterator.hasNext()) {
-          deleteDeltaBlockletDetailsList.add(iterator.next().getValue());
+        for (Map.Entry<String, DeleteDeltaBlockletDetails> entry : entries) {
+          deleteDeltaBlockletDetailsList.add(entry.getValue());
         }
       }
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaVo.java b/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaVo.java
index 7d5dc5a..1aad13e 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaVo.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/DeleteDeltaVo.java
@@ -18,7 +18,6 @@
 package org.apache.carbondata.core.mutate;
 
 import java.util.BitSet;
-import java.util.Iterator;
 import java.util.Set;
 
 /**
@@ -43,9 +42,8 @@ public class DeleteDeltaVo {
    * @param data
    */
   public void insertData(Set<Integer> data) {
-    Iterator<Integer> iterator = data.iterator();
-    while (iterator.hasNext()) {
-      bitSet.set(iterator.next());
+    for (Integer datum : data) {
+      bitSet.set(datum);
     }
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/mutate/UpdateVO.java b/core/src/main/java/org/apache/carbondata/core/mutate/UpdateVO.java
index 1c5027f..5cf14a1 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/UpdateVO.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/UpdateVO.java
@@ -18,6 +18,7 @@
 package org.apache.carbondata.core.mutate;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 /**
  * VO class for storing details related to Update operation.
@@ -62,20 +63,13 @@ public class UpdateVO implements Serializable {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     UpdateVO updateVO = (UpdateVO) o;
-    if (factTimestamp != null ?
-        !factTimestamp.equals(updateVO.factTimestamp) :
-        updateVO.factTimestamp != null) {
+    if (!Objects.equals(factTimestamp, updateVO.factTimestamp)) {
       return false;
     }
-    if (updateDeltaStartTimestamp != null ?
-        !updateDeltaStartTimestamp.equals(updateVO.updateDeltaStartTimestamp) :
-        updateVO.updateDeltaStartTimestamp != null) {
+    if (!Objects.equals(updateDeltaStartTimestamp, updateVO.updateDeltaStartTimestamp)) {
       return false;
     }
-    return latestUpdateTimestamp != null ?
-        latestUpdateTimestamp.equals(updateVO.latestUpdateTimestamp) :
-        updateVO.latestUpdateTimestamp == null;
-
+    return Objects.equals(latestUpdateTimestamp, updateVO.latestUpdateTimestamp);
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/readcommitter/LatestFilesReadCommittedScope.java b/core/src/main/java/org/apache/carbondata/core/readcommitter/LatestFilesReadCommittedScope.java
index 2b74ee3..c4f948a 100644
--- a/core/src/main/java/org/apache/carbondata/core/readcommitter/LatestFilesReadCommittedScope.java
+++ b/core/src/main/java/org/apache/carbondata/core/readcommitter/LatestFilesReadCommittedScope.java
@@ -159,22 +159,18 @@ public class LatestFilesReadCommittedScope implements ReadCommittedScope {
     } else {
       segName = segment.getSegmentFileName();
     }
-    SegmentRefreshInfo segmentRefreshInfo = snapShot.get(segName);
-    return segmentRefreshInfo;
+    return snapShot.get(segName);
   }
 
-  private String getSegmentID(String carbonIndexFileName, String indexFilePath) {
+  private String getSegmentID(String indexFileName, String indexFilePath) {
     if (indexFilePath.contains("/Fact/Part0/Segment_")) {
       // This is CarbonFile case where the Index files are present inside the Segment Folder
       // So the Segment has to be extracted from the path not from the CarbonIndex file.
       String segString = indexFilePath.substring(0, indexFilePath.lastIndexOf("/") + 1);
-      String segName =
-          segString.substring(segString.lastIndexOf("_") + 1, segString.lastIndexOf("/"));
-      return segName;
+      return segString.substring(segString.lastIndexOf("_") + 1, segString.lastIndexOf("/"));
     } else {
-      String fileName = carbonIndexFileName;
-      String segId = fileName.substring(fileName.lastIndexOf("-") + 1, fileName.lastIndexOf("."));
-      return segId;
+      return indexFileName.substring(indexFileName.lastIndexOf("-") + 1,
+          indexFileName.lastIndexOf("."));
     }
   }
 
@@ -206,21 +202,19 @@ public class LatestFilesReadCommittedScope implements ReadCommittedScope {
   private void takeCarbonIndexFileSnapShot(CarbonFile[] carbonIndexFiles) {
     Map<String, List<String>> indexFileStore = new HashMap<>();
     Map<String, SegmentRefreshInfo> segmentTimestampUpdaterMap = new HashMap<>();
-    for (int i = 0; i < carbonIndexFiles.length; i++) {
+    for (CarbonFile carbonIndexFile : carbonIndexFiles) {
       // TODO. Nested File Paths.
-      if (carbonIndexFiles[i].getName().endsWith(CarbonTablePath.INDEX_FILE_EXT)
-          || carbonIndexFiles[i].getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
+      if (carbonIndexFile.getName().endsWith(CarbonTablePath.INDEX_FILE_EXT) || carbonIndexFile
+          .getName().endsWith(CarbonTablePath.MERGE_INDEX_FILE_EXT)) {
         // Get Segment Name from the IndexFile.
-        String indexFilePath =
-            FileFactory.getUpdatedFilePath(carbonIndexFiles[i].getAbsolutePath());
-        String timestamp = getSegmentID(carbonIndexFiles[i].getName(), indexFilePath);
+        String indexFilePath = FileFactory.getUpdatedFilePath(carbonIndexFile.getAbsolutePath());
+        String timestamp = getSegmentID(carbonIndexFile.getName(), indexFilePath);
         // TODO. During Partition table handling, place Segment File Name.
         List<String> indexList;
         SegmentRefreshInfo segmentRefreshInfo;
         if (indexFileStore.get(timestamp) == null) {
           indexList = new ArrayList<>(1);
-          segmentRefreshInfo =
-              new SegmentRefreshInfo(carbonIndexFiles[i].getLastModifiedTime(), 0, 0L);
+          segmentRefreshInfo = new SegmentRefreshInfo(carbonIndexFile.getLastModifiedTime(), 0, 0L);
           segmentTimestampUpdaterMap.put(timestamp, segmentRefreshInfo);
         } else {
           // Entry is already present.
@@ -228,18 +222,16 @@ public class LatestFilesReadCommittedScope implements ReadCommittedScope {
           segmentRefreshInfo = segmentTimestampUpdaterMap.get(timestamp);
         }
         indexList.add(indexFilePath);
-        if (segmentRefreshInfo.getSegmentUpdatedTimestamp() < carbonIndexFiles[i]
+        if (segmentRefreshInfo.getSegmentUpdatedTimestamp() < carbonIndexFile
             .getLastModifiedTime()) {
-          segmentRefreshInfo
-              .setSegmentUpdatedTimestamp(carbonIndexFiles[i].getLastModifiedTime());
+          segmentRefreshInfo.setSegmentUpdatedTimestamp(carbonIndexFile.getLastModifiedTime());
         }
         indexFileStore.put(timestamp, indexList);
         segmentRefreshInfo.setCountOfFileInSegment(indexList.size());
       }
     }
-    ReadCommittedIndexFileSnapShot readCommittedIndexFileSnapShot =
+    this.readCommittedIndexFileSnapShot =
         new ReadCommittedIndexFileSnapShot(indexFileStore, segmentTimestampUpdaterMap);
-    this.readCommittedIndexFileSnapShot = readCommittedIndexFileSnapShot;
     prepareLoadMetadata();
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/reader/CarbonDeleteDeltaFileReaderImpl.java b/core/src/main/java/org/apache/carbondata/core/reader/CarbonDeleteDeltaFileReaderImpl.java
index 3186b46..a325161 100644
--- a/core/src/main/java/org/apache/carbondata/core/reader/CarbonDeleteDeltaFileReaderImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/reader/CarbonDeleteDeltaFileReaderImpl.java
@@ -39,10 +39,6 @@ public class CarbonDeleteDeltaFileReaderImpl implements CarbonDeleteDeltaFileRea
 
   private String filePath;
 
-  private DataInputStream dataInputStream = null;
-
-  private InputStreamReader inputStream = null;
-
   private static final int DEFAULT_BUFFER_SIZE = 258;
 
   /**
@@ -66,14 +62,15 @@ public class CarbonDeleteDeltaFileReaderImpl implements CarbonDeleteDeltaFileRea
     // Configure Buffer based on our requirement
     char[] buffer = new char[DEFAULT_BUFFER_SIZE];
     StringWriter sw = new StringWriter();
-    dataInputStream = FileFactory.getDataInputStream(filePath);
-    inputStream = new InputStreamReader(dataInputStream,
-        CarbonCommonConstants.DEFAULT_CHARSET);
-    int n = 0;
-    while (-1 != (n = inputStream.read(buffer))) {
-      sw.write(buffer, 0, n);
+    try (DataInputStream dataInputStream = FileFactory.getDataInputStream(filePath);
+        InputStreamReader inputStream = new InputStreamReader(dataInputStream,
+            CarbonCommonConstants.DEFAULT_CHARSET)) {
+      int n = 0;
+      while (-1 != (n = inputStream.read(buffer))) {
+        sw.write(buffer, 0, n);
+      }
+      return sw.toString();
     }
-    return sw.toString();
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReader.java b/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReader.java
index 579ca97..41b6119 100644
--- a/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReader.java
+++ b/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReader.java
@@ -21,8 +21,6 @@ import java.io.IOException;
 
 import org.apache.carbondata.format.FileFooter;
 
-import org.apache.thrift.TBase;
-
 /**
  * Reads the metadata from fact file in org.apache.carbondata.format.FileFooter thrift object
  */
@@ -64,13 +62,7 @@ public class CarbonFooterReader {
    * @throws IOException
    */
   private ThriftReader openThriftReader(String filePath) {
-
-    return new ThriftReader(filePath, new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new FileFooter();
-      }
-    });
+    return new ThriftReader(filePath, FileFooter::new);
   }
 
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReaderV3.java b/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReaderV3.java
index 2fbcd6c..fd7fccd 100644
--- a/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReaderV3.java
+++ b/core/src/main/java/org/apache/carbondata/core/reader/CarbonFooterReaderV3.java
@@ -21,8 +21,6 @@ import java.io.IOException;
 
 import org.apache.carbondata.format.FileFooter3;
 
-import org.apache.thrift.TBase;
-
 /**
  * Below class to read file footer of version3
  * carbon data file
@@ -65,13 +63,7 @@ public class CarbonFooterReaderV3 {
    * @throws IOException
    */
   private ThriftReader openThriftReader(String filePath) {
-
-    return new ThriftReader(filePath, new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new FileFooter3();
-      }
-    });
+    return new ThriftReader(filePath, FileFooter3::new);
   }
 
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/reader/CarbonHeaderReader.java b/core/src/main/java/org/apache/carbondata/core/reader/CarbonHeaderReader.java
index 5f4a381..f40b49d 100644
--- a/core/src/main/java/org/apache/carbondata/core/reader/CarbonHeaderReader.java
+++ b/core/src/main/java/org/apache/carbondata/core/reader/CarbonHeaderReader.java
@@ -28,7 +28,6 @@ import org.apache.carbondata.format.FileHeader;
 import static org.apache.carbondata.core.util.CarbonUtil.thriftColumnSchemaToWrapperColumnSchema;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.thrift.TBase;
 
 /**
  * Below class to read file header of version3
@@ -73,12 +72,7 @@ public class CarbonHeaderReader {
    */
   private ThriftReader openThriftReader(String filePath) {
     Configuration conf = configuration != null ? configuration : FileFactory.getConfiguration();
-    return new ThriftReader(filePath, new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new FileHeader();
-      }
-    }, conf);
+    return new ThriftReader(filePath, FileHeader::new, conf);
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/reader/CarbonIndexFileReader.java b/core/src/main/java/org/apache/carbondata/core/reader/CarbonIndexFileReader.java
index 02a512c..b99b13b 100644
--- a/core/src/main/java/org/apache/carbondata/core/reader/CarbonIndexFileReader.java
+++ b/core/src/main/java/org/apache/carbondata/core/reader/CarbonIndexFileReader.java
@@ -23,7 +23,6 @@ import org.apache.carbondata.format.BlockIndex;
 import org.apache.carbondata.format.IndexHeader;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.thrift.TBase;
 
 /**
  * Reader class which will be used to read the index file
@@ -52,12 +51,7 @@ public class CarbonIndexFileReader {
    * @throws IOException if any problem  while reader the header
    */
   public IndexHeader readIndexHeader() throws IOException {
-    return (IndexHeader) thriftReader.read(new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new IndexHeader();
-      }
-    });
+    return (IndexHeader) thriftReader.read(IndexHeader::new);
   }
 
   /**
@@ -74,12 +68,7 @@ public class CarbonIndexFileReader {
    * @throws IOException if problem while reading the block index
    */
   public BlockIndex readBlockIndexInfo() throws IOException {
-    return (BlockIndex) thriftReader.read(new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new BlockIndex();
-      }
-    });
+    return (BlockIndex) thriftReader.read(BlockIndex::new);
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java
index d9bd3c7..bbfd91f 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/AbstractScannedResultCollector.java
@@ -125,8 +125,7 @@ public abstract class AbstractScannedResultCollector implements ScannedResultCol
           defaultValue =
               DataTypeUtil.getDataTypeConverter().convertFromBigDecimalToDecimal(defaultValue);
         }
-        for (short j = 0; j < rows.size(); j++) {
-          Object[] rowValues = rows.get(j);
+        for (Object[] rowValues : rows) {
           rowValues[i + offset] = defaultValue;
         }
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
index 947a561..11850d4 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
@@ -350,9 +350,9 @@ public class DictionaryBasedResultCollector extends AbstractScannedResultCollect
 
   void initDimensionAndMeasureIndexesForFillingData() {
     List<Integer> dictionaryIndexes = new ArrayList<Integer>();
-    for (int i = 0; i < queryDimensions.length; i++) {
-      if (queryDimensions[i].getDimension().getDataType() == DataTypes.DATE) {
-        dictionaryIndexes.add(queryDimensions[i].getDimension().getOrdinal());
+    for (ProjectionDimension queryDimension : queryDimensions) {
+      if (queryDimension.getDimension().getDataType() == DataTypes.DATE) {
+        dictionaryIndexes.add(queryDimension.getDimension().getOrdinal());
       }
     }
     int[] primitive =
@@ -366,25 +366,25 @@ public class DictionaryBasedResultCollector extends AbstractScannedResultCollect
 
     parentToChildColumnsMap.clear();
     queryDimensionToComplexParentOrdinal.clear();
-    for (int i = 0; i < queryDimensions.length; i++) {
-      if (queryDimensions[i].getDimension().getDataType() == DataTypes.DATE) {
+    for (ProjectionDimension queryDimension : queryDimensions) {
+      if (queryDimension.getDimension().getDataType() == DataTypes.DATE) {
         actualIndexInSurrogateKey[index++] =
-            Arrays.binarySearch(primitive, queryDimensions[i].getDimension().getOrdinal());
+            Arrays.binarySearch(primitive, queryDimension.getDimension().getOrdinal());
       }
-      if (null != queryDimensions[i].getDimension().getComplexParentDimension()) {
+      if (null != queryDimension.getDimension().getComplexParentDimension()) {
         // Add the parent and the child ordinal to the parentToChildColumnsMap
         int complexParentOrdinal =
-            queryDimensions[i].getDimension().getComplexParentDimension().getOrdinal();
+            queryDimension.getDimension().getComplexParentDimension().getOrdinal();
         queryDimensionToComplexParentOrdinal.add(complexParentOrdinal);
         if (parentToChildColumnsMap.get(complexParentOrdinal) == null) {
           // Add the parent and child ordinal in the map
           List<Integer> childOrdinals = new ArrayList<>();
-          childOrdinals.add(queryDimensions[i].getDimension().getOrdinal());
+          childOrdinals.add(queryDimension.getDimension().getOrdinal());
           parentToChildColumnsMap.put(complexParentOrdinal, childOrdinals);
 
         } else {
           List<Integer> childOrdinals = parentToChildColumnsMap.get(complexParentOrdinal);
-          childOrdinals.add(queryDimensions[i].getDimension().getOrdinal());
+          childOrdinals.add(queryDimension.getDimension().getOrdinal());
           parentToChildColumnsMap.put(complexParentOrdinal, childOrdinals);
         }
       } else {
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/RestructureBasedRawResultCollector.java b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/RestructureBasedRawResultCollector.java
index a77f794..b2f5c07 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/RestructureBasedRawResultCollector.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/RestructureBasedRawResultCollector.java
@@ -99,7 +99,7 @@ public class RestructureBasedRawResultCollector extends RawBasedResultCollector
             if (null != defaultValue) {
               defaultValueAsLong = ((Integer) defaultValue).longValue();
             } else {
-              defaultValueAsLong = (long) CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY;
+              defaultValueAsLong = CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY;
             }
             keyArrayWithNewAddedColumns[newKeyArrayIndex++] = defaultValueAsLong;
           }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/complextypes/StructQueryType.java b/core/src/main/java/org/apache/carbondata/core/scan/complextypes/StructQueryType.java
index 1a05622..5f0b8ce 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/complextypes/StructQueryType.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/complextypes/StructQueryType.java
@@ -139,8 +139,7 @@ public class StructQueryType extends ComplexQueryType implements GenericQueryTyp
       return null;
     } else {
       //      childLength = dataBuffer.getShort();
-      Object field = getDataBasedOnDataType(dataBuffer);
-      return field;
+      return getDataBasedOnDataType(dataBuffer);
     }
   }
 
@@ -153,13 +152,11 @@ public class StructQueryType extends ComplexQueryType implements GenericQueryTyp
       if (presentColumn.getNumberOfChild() > 0) {
         // This is complex Column. And all its child will be present in the corresponding data
         // buffer.
-        Object field = getDataBasedOnDataType(childBuffer.get(presentColumn));
-        return field;
+        return getDataBasedOnDataType(childBuffer.get(presentColumn));
       } else {
         // This is a child column with with primitive data type.
-        Object field = children.get(0)
+        return children.get(0)
             .getDataBasedOnColumn(childBuffer.get(presentColumn), presentColumn, presentColumn);
-        return field;
       }
     } else {
       int childLength;
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/executor/infos/BlockExecutionInfo.java b/core/src/main/java/org/apache/carbondata/core/scan/executor/infos/BlockExecutionInfo.java
index 9755761..e34d2f4 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/executor/infos/BlockExecutionInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/executor/infos/BlockExecutionInfo.java
@@ -270,7 +270,7 @@ public class BlockExecutionInfo {
   }
 
   /**
-   * @param allSelectedDimensionColumnIndexRange the allSelectedDimensionColumnIndexRange to set
+   * @param selectedDimensionColumnIndexRange the allSelectedDimensionColumnIndexRange to set
    */
   public void setAllSelectedDimensionColumnIndexRange(int[][] selectedDimensionColumnIndexRange) {
     this.allSelectedDimensionColumnIndexRange = selectedDimensionColumnIndexRange;
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
index 1b10817..de28738 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
@@ -17,7 +17,6 @@
 
 package org.apache.carbondata.core.scan.executor.util;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
 import java.util.HashMap;
@@ -75,23 +74,22 @@ public class QueryUtil {
     Set<Integer> dimensionChunkIndex = new HashSet<Integer>();
     Set<Integer> filterDimensionOrdinal = getFilterDimensionOrdinal(filterDimensions);
     int chunkIndex = 0;
-    for (int i = 0; i < queryDimensions.size(); i++) {
-      if (queryDimensions.get(i).getDimension().hasEncoding(Encoding.IMPLICIT)) {
+    for (ProjectionDimension queryDimension : queryDimensions) {
+      if (queryDimension.getDimension().hasEncoding(Encoding.IMPLICIT)) {
         continue;
       }
 
-      Integer dimensionOrdinal = queryDimensions.get(i).getDimension().getOrdinal();
+      Integer dimensionOrdinal = queryDimension.getDimension().getOrdinal();
       allProjectionListDimensionIndexes.add(dimensionOrdinalToChunkMapping.get(dimensionOrdinal));
-      if (queryDimensions.get(i).getDimension().getNumberOfChild() > 0) {
-        addChildrenBlockIndex(allProjectionListDimensionIndexes,
-            queryDimensions.get(i).getDimension());
+      if (queryDimension.getDimension().getNumberOfChild() > 0) {
+        addChildrenBlockIndex(allProjectionListDimensionIndexes, queryDimension.getDimension());
       }
 
       if (!filterDimensionOrdinal.contains(dimensionOrdinal)) {
         chunkIndex = dimensionOrdinalToChunkMapping.get(dimensionOrdinal);
         dimensionChunkIndex.add(chunkIndex);
-        if (queryDimensions.get(i).getDimension().getNumberOfChild() > 0) {
-          addChildrenBlockIndex(dimensionChunkIndex, queryDimensions.get(i).getDimension());
+        if (queryDimension.getDimension().getNumberOfChild() > 0) {
+          addChildrenBlockIndex(dimensionChunkIndex, queryDimension.getDimension());
         }
       }
     }
@@ -341,14 +339,8 @@ public class QueryUtil {
     if (null == filterResolverTree) {
       return;
     }
-    List<ColumnExpression> dimensionResolvedInfos = new ArrayList<ColumnExpression>();
     Expression filterExpression = filterResolverTree.getFilterExpression();
     addColumnDimensions(filterExpression, filterDimensions, filterMeasure);
-    for (ColumnExpression info : dimensionResolvedInfos) {
-      if (info.isDimension() && info.getDimension().getNumberOfChild() > 0) {
-        filterDimensions.add(info.getDimension());
-      }
-    }
   }
 
   /**
@@ -364,7 +356,6 @@ public class QueryUtil {
       } else {
         filterMeasure.add((CarbonMeasure) ((ColumnExpression) expression).getCarbonColumn());
       }
-      return;
     } else if (null != expression) {
       for (Expression child : expression.getChildren()) {
         addColumnDimensions(child, filterDimensions, filterMeasure);
@@ -431,8 +422,7 @@ public class QueryUtil {
       // In case of complex types only add the name after removing parent names.
       int index = columnSchema.getColumnName().lastIndexOf(".");
       if (index >= 0) {
-        columnSchema.setColumnUniqueId(columnSchema.getColumnName()
-            .substring(index + 1, columnSchema.getColumnName().length()));
+        columnSchema.setColumnUniqueId(columnSchema.getColumnName().substring(index + 1));
       } else {
         columnSchema.setColumnUniqueId(columnSchema.getColumnName());
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java
index f90ba32..d08ff1b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/RestructureUtil.java
@@ -337,7 +337,7 @@ public class RestructureUtil {
         measureDefaultValue = decimal;
       } else {
         value = new String(defaultValue, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
-        Double parsedValue = Double.valueOf(value);
+        double parsedValue = Double.parseDouble(value);
         if (!Double.isInfinite(parsedValue) && !Double.isNaN(parsedValue)) {
           measureDefaultValue = parsedValue;
         }
@@ -379,7 +379,7 @@ public class RestructureUtil {
         measureDefaultValue = decimal;
       } else {
         value = new String(defaultValue, Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
-        Double parsedValue = Double.valueOf(value);
+        double parsedValue = Double.parseDouble(value);
         if (!Double.isInfinite(parsedValue) && !Double.isNaN(parsedValue)) {
           measureDefaultValue = parsedValue;
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java
index 32b5028..c14b11e 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/conditional/ListExpression.java
@@ -55,7 +55,7 @@ public class ListExpression extends Expression {
 
   @Override
   public String getString() {
-    StringBuffer value = new StringBuffer();
+    StringBuilder value = new StringBuilder();
     value.append("ListExpression(");
     for (Expression expr : children) {
       value.append(expr.getString()).append(";");
@@ -67,7 +67,7 @@ public class ListExpression extends Expression {
 
   @Override
   public String getStatement() {
-    StringBuffer value = new StringBuffer();
+    StringBuilder value = new StringBuilder();
     value.append("(");
     for (Expression expr : children) {
       value.append(expr.getString()).append(";");
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
index 06d8150..63de800 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/expression/logical/BinaryLogicalExpression.java
@@ -84,10 +84,8 @@ public abstract class BinaryLogicalExpression extends BinaryExpression {
     List<ColumnExpression> listOfExp =
         new ArrayList<ColumnExpression>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
     getColumnList(this, listOfExp);
-    if (listOfExp.size() == 1 && (listOfExp.get(0).isDimension() || listOfExp.get(0).isMeasure())) {
-      return true;
-    }
-    return false;
+    return listOfExp.size() == 1 && (listOfExp.get(0).isDimension() || listOfExp.get(0)
+        .isMeasure());
 
   }
 
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 c6c3563..af8866b 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
@@ -23,7 +23,6 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -567,16 +566,10 @@ public final class FilterUtil {
       throw new FilterUnsupportedException("Unsupported Filter condition: " + result, ex);
     }
 
-    java.util.Comparator<byte[]> filterNoDictValueComparator = new java.util.Comparator<byte[]>() {
-
-      @Override
-      public int compare(byte[] filterMember1, byte[] filterMember2) {
-        // TODO Auto-generated method stub
-        return ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterMember1, filterMember2);
-      }
-
-    };
-    Collections.sort(filterValuesList, filterNoDictValueComparator);
+    // TODO Auto-generated method stub
+    java.util.Comparator<byte[]> filterNoDictValueComparator =
+        ByteUtil.UnsafeComparer.INSTANCE::compareTo;
+    filterValuesList.sort(filterNoDictValueComparator);
     ColumnFilterInfo columnFilterInfo = null;
     if (filterValuesList.size() > 0) {
       columnFilterInfo = new ColumnFilterInfo();
@@ -620,7 +613,7 @@ public final class FilterUtil {
 
     SerializableComparator filterMeasureComparator =
         Comparator.getComparatorByDataTypeForMeasure(dataType);
-    Collections.sort(filterValuesList, filterMeasureComparator);
+    filterValuesList.sort(filterMeasureComparator);
     ColumnFilterInfo columnFilterInfo = null;
     if (filterValuesList.size() > 0) {
       columnFilterInfo = new ColumnFilterInfo();
@@ -835,9 +828,6 @@ public final class FilterUtil {
         return Double.compare((Double.parseDouble(dictionaryVal)), (Double.parseDouble(memberVal)));
       } else if (dataType == DataTypes.LONG) {
         return Long.compare((Long.parseLong(dictionaryVal)), (Long.parseLong(memberVal)));
-      } else if (dataType == DataTypes.BOOLEAN) {
-        return Boolean.compare(
-            (Boolean.parseBoolean(dictionaryVal)), (Boolean.parseBoolean(memberVal)));
       } else if (dataType == DataTypes.DATE || dataType == DataTypes.TIMESTAMP) {
         String format = CarbonUtil.getFormatFromProperty(dataType);
         SimpleDateFormat parser = new SimpleDateFormat(format);
@@ -1130,13 +1120,9 @@ public final class FilterUtil {
    * @return sorted encoded filter values
    */
   private static byte[][] getSortedEncodedFilters(List<byte[]> encodedFilters) {
-    java.util.Comparator<byte[]> filterNoDictValueComparator = new java.util.Comparator<byte[]>() {
-      @Override
-      public int compare(byte[] filterMember1, byte[] filterMember2) {
-        return ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterMember1, filterMember2);
-      }
-    };
-    Collections.sort(encodedFilters, filterNoDictValueComparator);
+    java.util.Comparator<byte[]> filterNoDictValueComparator =
+        ByteUtil.UnsafeComparer.INSTANCE::compareTo;
+    encodedFilters.sort(filterNoDictValueComparator);
     return encodedFilters.toArray(new byte[encodedFilters.size()][]);
   }
 
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/ExcludeFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/ExcludeFilterExecutorImpl.java
index 2675042..a1b0454 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/ExcludeFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/ExcludeFilterExecutorImpl.java
@@ -166,23 +166,23 @@ public class ExcludeFilterExecutorImpl implements FilterExecutor {
     if (isDimensionPresentInCurrentBlock) {
       byte[][] filterValues = dimColumnExecutorInfo.getExcludeFilterKeys();
       byte[] col = (byte[])value.getVal(dimColEvaluatorInfo.getDimension().getOrdinal());
-      for (int i = 0; i < filterValues.length; i++) {
-        if (0 == ByteUtil.UnsafeComparer.INSTANCE.compareTo(col, 0, col.length,
-            filterValues[i], 0, filterValues[i].length)) {
+      for (byte[] filterValue : filterValues) {
+        if (0 == ByteUtil.UnsafeComparer.INSTANCE.compareTo(
+            col, 0, col.length, filterValue, 0, filterValue.length)) {
           return false;
         }
       }
     } else if (isMeasurePresentInCurrentBlock) {
       Object[] filterValues = msrColumnExecutorInfo.getFilterKeys();
       Object col = value.getVal(msrColumnEvaluatorInfo.getMeasure().getOrdinal() + dimOrdinalMax);
-      for (int i = 0; i < filterValues.length; i++) {
-        if (filterValues[i] == null) {
+      for (Object filterValue : filterValues) {
+        if (filterValue == null) {
           if (null == col) {
             return false;
           }
           continue;
         }
-        if (comparator.compare(col, filterValues[i]) == 0) {
+        if (comparator.compare(col, filterValue) == 0) {
           return false;
         }
       }
@@ -240,8 +240,8 @@ public class ExcludeFilterExecutorImpl implements FilterExecutor {
     BitSet nullBitSet = measureColumnPage.getNullBits();
     BitSet prvPageBitSet = prvBitSetGroup.getBitSet(pageNumber);
     SerializableComparator comparator = Comparator.getComparatorByDataTypeForMeasure(msrDataType);
-    for (int i = 0; i < filterValues.length; i++) {
-      if (filterValues[i] == null) {
+    for (Object filterValue : filterValues) {
+      if (filterValue == null) {
         for (int j = nullBitSet.nextSetBit(0); j >= 0; j = nullBitSet.nextSetBit(j + 1)) {
           bitSet.flip(j);
         }
@@ -251,11 +251,10 @@ public class ExcludeFilterExecutorImpl implements FilterExecutor {
            index >= 0; index = prvPageBitSet.nextSetBit(index + 1)) {
         if (!nullBitSet.get(index)) {
           // Check if filterValue[i] matches with measure Values.
-          Object msrValue = DataTypeUtil
-              .getMeasureObjectBasedOnDataType(measureColumnPage, index,
-                  msrDataType, msrColumnEvaluatorInfo.getMeasure());
+          Object msrValue = DataTypeUtil.getMeasureObjectBasedOnDataType(measureColumnPage, index,
+              msrDataType, msrColumnEvaluatorInfo.getMeasure());
 
-          if (comparator.compare(msrValue, filterValues[i]) == 0) {
+          if (comparator.compare(msrValue, filterValue) == 0) {
             // This is a match.
             bitSet.flip(index);
           }
@@ -355,9 +354,8 @@ public class ExcludeFilterExecutorImpl implements FilterExecutor {
       if (startIndex >= numberOfRows) {
         break;
       }
-      int[] rangeIndex = CarbonUtil
-          .getRangeIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-              filterValues[i]);
+      int[] rangeIndex = CarbonUtil.getRangeIndexUsingBinarySearch(dimensionColumnPage,
+          startIndex, numberOfRows - 1, filterValues[i]);
       for (int j = rangeIndex[0]; j <= rangeIndex[1]; j++) {
         bitSet.flip(dimensionColumnPage.getInvertedIndex(j));
       }
@@ -383,9 +381,8 @@ public class ExcludeFilterExecutorImpl implements FilterExecutor {
         if (startIndex >= numberOfRows) {
           break;
         }
-        int[] rangeIndex = CarbonUtil
-            .getRangeIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-                filterValues[i]);
+        int[] rangeIndex = CarbonUtil.getRangeIndexUsingBinarySearch(dimensionColumnPage,
+            startIndex, numberOfRows - 1, filterValues[i]);
         for (int j = rangeIndex[0]; j <= rangeIndex[1]; j++) {
           bitSet.flip(j);
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/FalseFilterExecutor.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/FalseFilterExecutor.java
index 383deff..f1b0a79 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/FalseFilterExecutor.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/FalseFilterExecutor.java
@@ -39,8 +39,7 @@ public class FalseFilterExecutor implements FilterExecutor {
   @Override
   public BitSet prunePages(RawBlockletColumnChunks rawChunks) {
     int numberOfPages = rawChunks.getDataBlock().numberOfPages();
-    BitSet set = new BitSet(numberOfPages);
-    return set;
+    return new BitSet(numberOfPages);
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecutorImpl.java
index 96517dc..97cdb25 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecutorImpl.java
@@ -250,23 +250,23 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
     if (isDimensionPresentInCurrentBlock) {
       byte[][] filterValues = dimColumnExecutorInfo.getFilterKeys();
       byte[] col = (byte[])value.getVal(dimColumnEvaluatorInfo.getDimension().getOrdinal());
-      for (int i = 0; i < filterValues.length; i++) {
-        if (0 == ByteUtil.UnsafeComparer.INSTANCE.compareTo(col, 0, col.length,
-            filterValues[i], 0, filterValues[i].length)) {
+      for (byte[] filterValue : filterValues) {
+        if (0 == ByteUtil.UnsafeComparer.INSTANCE.compareTo(
+            col, 0, col.length, filterValue, 0, filterValue.length)) {
           return true;
         }
       }
     } else if (isMeasurePresentInCurrentBlock) {
       Object[] filterValues = msrColumnExecutorInfo.getFilterKeys();
       Object col = value.getVal(msrColumnEvaluatorInfo.getMeasure().getOrdinal() + dimOrdinalMax);
-      for (int i = 0; i < filterValues.length; i++) {
-        if (filterValues[i] == null) {
+      for (Object filterValue : filterValues) {
+        if (filterValue == null) {
           if (null == col) {
             return true;
           }
           continue;
         }
-        if (comparator.compare(col, filterValues[i]) == 0) {
+        if (comparator.compare(col, filterValue) == 0) {
           return true;
         }
       }
@@ -323,8 +323,8 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
     BitSet nullBitSet = measureColumnPage.getNullBits();
     BitSet prvPageBitSet = prvBitSetGroup.getBitSet(pageNumber);
     SerializableComparator comparator = Comparator.getComparatorByDataTypeForMeasure(msrDataType);
-    for (int i = 0; i < filterValues.length; i++) {
-      if (filterValues[i] == null) {
+    for (Object filterValue : filterValues) {
+      if (filterValue == null) {
         for (int j = nullBitSet.nextSetBit(0); j >= 0; j = nullBitSet.nextSetBit(j + 1)) {
           bitSet.set(j);
         }
@@ -334,11 +334,10 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
            index >= 0; index = prvPageBitSet.nextSetBit(index + 1)) {
         if (!nullBitSet.get(index)) {
           // Check if filterValue[i] matches with measure Values.
-          Object msrValue = DataTypeUtil
-              .getMeasureObjectBasedOnDataType(measureColumnPage, index,
-                  msrDataType, msrColumnEvaluatorInfo.getMeasure());
+          Object msrValue = DataTypeUtil.getMeasureObjectBasedOnDataType(measureColumnPage, index,
+              msrDataType, msrColumnEvaluatorInfo.getMeasure());
 
-          if (comparator.compare(msrValue, filterValues[i]) == 0) {
+          if (comparator.compare(msrValue, filterValue) == 0) {
             // This is a match.
             bitSet.set(index);
           }
@@ -431,9 +430,8 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
       if (startIndex >= numberOfRows) {
         break;
       }
-      int[] rangeIndex = CarbonUtil
-          .getRangeIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-              filterValues[i]);
+      int[] rangeIndex = CarbonUtil.getRangeIndexUsingBinarySearch(dimensionColumnPage,
+          startIndex, numberOfRows - 1, filterValues[i]);
       for (int j = rangeIndex[0]; j <= rangeIndex[1]; j++) {
         bitSet.set(dimensionColumnPage.getInvertedIndex(j));
       }
@@ -458,9 +456,8 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
         if (startIndex >= numberOfRows) {
           break;
         }
-        int[] rangeIndex = CarbonUtil
-            .getRangeIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-                filterValues[i]);
+        int[] rangeIndex = CarbonUtil.getRangeIndexUsingBinarySearch(dimensionColumnPage,
+            startIndex, numberOfRows - 1, filterValues[i]);
         for (int j = rangeIndex[0]; j <= rangeIndex[1]; j++) {
           bitSet.set(j);
         }
@@ -531,15 +528,13 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
       return true;
     }
     boolean isScanRequired = false;
-    for (int k = 0; k < filterValues.length; k++) {
+    for (byte[] filterValue : filterValues) {
       // filter value should be in range of max and min value i.e
       // max>filterValue>min
       // so filter-max should be negative
-      int maxCompare =
-          ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterValues[k], blkMaxVal);
+      int maxCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterValue, blkMaxVal);
       // and filter-min should be positive
-      int minCompare =
-          ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterValues[k], blkMinVal);
+      int minCompare = ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterValue, blkMinVal);
 
       // if any filter value is in range than this block needs to be
       // scanned
@@ -556,16 +551,16 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
     boolean isScanRequired = false;
     Object minValue = DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(blkMinVal, dataType);
     Object maxValue = DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(blkMaxVal, dataType);
-    for (int k = 0; k < filterValues.length; k++) {
+    for (byte[] filterValue : filterValues) {
       if (ByteUtil.UnsafeComparer.INSTANCE
-          .compareTo(filterValues[k], CarbonCommonConstants.EMPTY_BYTE_ARRAY) == 0) {
+          .compareTo(filterValue, CarbonCommonConstants.EMPTY_BYTE_ARRAY) == 0) {
         return true;
       }
       // filter value should be in range of max and min value i.e
       // max>filterValue>min
       // so filter-max should be negative
       Object data =
-          DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(filterValues[k], dataType);
+          DataTypeUtil.getDataBasedOnDataTypeForNoDictionaryColumn(filterValue, dataType);
       SerializableComparator comparator = Comparator.getComparator(dataType);
       int maxCompare = comparator.compare(data, maxValue);
       int minCompare = comparator.compare(data, minValue);
@@ -583,13 +578,12 @@ public class IncludeFilterExecutorImpl implements FilterExecutor {
       DataType dataType) {
     Object maxObject = DataTypeUtil.getMeasureObjectFromDataType(maxValue, dataType);
     Object minObject = DataTypeUtil.getMeasureObjectFromDataType(minValue, dataType);
-    for (int i = 0; i < filterValue.length; i++) {
+    for (Object o : filterValue) {
       // TODO handle min and max for null values.
-      if (filterValue[i] == null) {
+      if (o == null) {
         return true;
       }
-      if (comparator.compare(filterValue[i], maxObject) <= 0
-          && comparator.compare(filterValue[i], minObject) >= 0) {
+      if (comparator.compare(o, maxObject) <= 0 && comparator.compare(o, minObject) >= 0) {
         return true;
       }
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/MeasureColumnExecutorFilterInfo.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/MeasureColumnExecutorFilterInfo.java
index 97be175..1225c63 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/MeasureColumnExecutorFilterInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/MeasureColumnExecutorFilterInfo.java
@@ -68,9 +68,9 @@ public class MeasureColumnExecutorFilterInfo {
     } else {
       throw new IllegalArgumentException("Invalid data type");
     }
-    for (int i = 0; i < filterKeys.length; i++) {
-      if (null != filterKeys[i]) {
-        filterSet.add(filterKeys[i]);
+    for (Object filterKey : filterKeys) {
+      if (null != filterKey) {
+        filterSet.add(filterKey);
       }
     }
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanEqualFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanEqualFilterExecutorImpl.java
index aebcd25..2326334 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanEqualFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanEqualFilterExecutorImpl.java
@@ -200,12 +200,12 @@ public class RowLevelRangeGreaterThanEqualFilterExecutorImpl extends RowLevelFil
   private boolean isScanRequired(byte[] maxValue, Object[] filterValue,
       DataType dataType) {
     Object value = DataTypeUtil.getMeasureObjectFromDataType(maxValue, dataType);
-    for (int i = 0; i < filterValue.length; i++) {
+    for (Object o : filterValue) {
       // TODO handle min and max for null values.
-      if (filterValue[i] == null) {
+      if (o == null) {
         return true;
       }
-      if (comparator.compare(filterValue[i], value) <= 0) {
+      if (comparator.compare(o, value) <= 0) {
         return true;
       }
     }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanFilterExecutorImpl.java
index e06414e..0849e5e 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeGreaterThanFilterExecutorImpl.java
@@ -258,12 +258,12 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
   private boolean isScanRequired(byte[] maxValue, Object[] filterValue,
       DataType dataType) {
     Object value = DataTypeUtil.getMeasureObjectFromDataType(maxValue, dataType);
-    for (int i = 0; i < filterValue.length; i++) {
+    for (Object o : filterValue) {
       // TODO handle min and max for null values.
-      if (filterValue[i] == null) {
+      if (o == null) {
         return true;
       }
-      if (comparator.compare(filterValue[i], value) < 0) {
+      if (comparator.compare(o, value) < 0) {
         return true;
       }
     }
@@ -419,8 +419,8 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
     DataType msrType = msrColEvalutorInfoList.get(0).getType();
     SerializableComparator comparator = Comparator.getComparatorByDataTypeForMeasure(msrType);
     BitSet nullBitSet = columnPage.getNullBits();
-    for (int i = 0; i < filterValues.length; i++) {
-      if (filterValues[i] == null) {
+    for (Object filterValue : filterValues) {
+      if (filterValue == null) {
         for (int j = nullBitSet.nextSetBit(0); j >= 0; j = nullBitSet.nextSetBit(j + 1)) {
           bitSet.set(j);
         }
@@ -428,11 +428,10 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
       }
       for (int startIndex = 0; startIndex < numberOfRows; startIndex++) {
         if (!nullBitSet.get(startIndex)) {
-          Object msrValue = DataTypeUtil
-              .getMeasureObjectBasedOnDataType(columnPage, startIndex,
-                  msrType, msrColEvalutorInfoList.get(0).getMeasure());
+          Object msrValue = DataTypeUtil.getMeasureObjectBasedOnDataType(columnPage, startIndex,
+              msrType, msrColEvalutorInfoList.get(0).getMeasure());
 
-          if (comparator.compare(msrValue, filterValues[i]) > 0) {
+          if (comparator.compare(msrValue, filterValue) > 0) {
             // This is a match.
             bitSet.set(startIndex);
           }
@@ -483,14 +482,13 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
     int last = 0;
     int startIndex = 0;
     byte[][] filterValues = this.filterRangeValues;
-    for (int i = 0; i < filterValues.length; i++) {
+    for (byte[] filterValue : filterValues) {
       start = CarbonUtil
           .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-              filterValues[i], true);
+              filterValue, true);
       if (start >= 0) {
         start = CarbonUtil
-            .nextGreaterValueToTarget(start, dimensionColumnPage, filterValues[i],
-                numberOfRows);
+            .nextGreaterValueToTarget(start, dimensionColumnPage, filterValue, numberOfRows);
       }
       // Logic will handle the case where the range filter member is not present in block
       // in this case the binary search will return the index from where the bit sets will be
@@ -504,9 +502,8 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
         // Method will compare the tentative index value after binary search, this tentative
         // index needs to be compared by the filter member if its > filter then from that
         // index the bitset will be considered for filtering process.
-        if (ByteUtil.compare(filterValues[i],
-            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start)))
-            > 0) {
+        if (ByteUtil.compare(filterValue,
+            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) > 0) {
           start = start + 1;
         }
       }
@@ -544,14 +541,12 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
       int start = 0;
       int last = 0;
       int startIndex = 0;
-      for (int k = 0; k < filterValues.length; k++) {
-        start = CarbonUtil
-            .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
-                numberOfRows - 1, filterValues[k], true);
+      for (byte[] filterValue : filterValues) {
+        start = CarbonUtil.getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
+            numberOfRows - 1, filterValue, true);
         if (start >= 0) {
           start = CarbonUtil
-              .nextGreaterValueToTarget(start, dimensionColumnPage, filterValues[k],
-                  numberOfRows);
+              .nextGreaterValueToTarget(start, dimensionColumnPage, filterValue, numberOfRows);
         }
         if (start < 0) {
           start = -(start + 1);
@@ -561,7 +556,7 @@ public class RowLevelRangeGreaterThanFilterExecutorImpl extends RowLevelFilterEx
           // Method will compare the tentative index value after binary search, this tentative
           // index needs to be compared by the filter member if its > filter then from that
           // index the bitset will be considered for filtering process.
-          if (ByteUtil.compare(filterValues[k], dimensionColumnPage.getChunkData(start)) > 0) {
+          if (ByteUtil.compare(filterValue, dimensionColumnPage.getChunkData(start)) > 0) {
             start = start + 1;
           }
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanEqualFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanEqualFilterExecutorImpl.java
index 5dd50a0..b22a91d 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanEqualFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanEqualFilterExecutorImpl.java
@@ -200,12 +200,12 @@ public class RowLevelRangeLessThanEqualFilterExecutorImpl extends RowLevelFilter
       DataType dataType) {
     Object value =
         DataTypeUtil.getMeasureObjectFromDataType(minValue, dataType);
-    for (int i = 0; i < filterValue.length; i++) {
+    for (Object o : filterValue) {
       // TODO handle min and max for null values.
-      if (filterValue[i] == null) {
+      if (o == null) {
         return true;
       }
-      if (comparator.compare(filterValue[i], value) >= 0) {
+      if (comparator.compare(o, value) >= 0) {
         return true;
       }
     }
@@ -487,10 +487,9 @@ public class RowLevelRangeLessThanEqualFilterExecutorImpl extends RowLevelFilter
       }
       startIndex = skip;
     }
-    for (int i = 0; i < filterValues.length; i++) {
-      start = CarbonUtil
-          .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-              filterValues[i], true);
+    for (byte[] filterValue : filterValues) {
+      start = CarbonUtil.getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
+          numberOfRows - 1, filterValue, true);
       if (start < 0) {
         start = -(start + 1);
         if (start >= numberOfRows) {
@@ -499,9 +498,8 @@ public class RowLevelRangeLessThanEqualFilterExecutorImpl extends RowLevelFilter
         // When negative value of start is returned from getFirstIndexUsingBinarySearch the Start
         // will be pointing to the next consecutive position. So compare it again and point to the
         // previous value returned from getFirstIndexUsingBinarySearch.
-        if (ByteUtil.compare(filterValues[i],
-            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start)))
-            < 0) {
+        if (ByteUtil.compare(filterValue,
+            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) < 0) {
           start = start - 1;
         }
       }
@@ -557,10 +555,9 @@ public class RowLevelRangeLessThanEqualFilterExecutorImpl extends RowLevelFilter
         }
         startIndex = skip;
       }
-      for (int k = 0; k < filterValues.length; k++) {
-        start = CarbonUtil
-            .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
-                numberOfRows - 1, filterValues[k], true);
+      for (byte[] filterValue : filterValues) {
+        start = CarbonUtil.getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
+            numberOfRows - 1, filterValue, true);
         if (start < 0) {
           start = -(start + 1);
           if (start >= numberOfRows) {
@@ -569,7 +566,7 @@ public class RowLevelRangeLessThanEqualFilterExecutorImpl extends RowLevelFilter
           // When negative value of start is returned from getFirstIndexUsingBinarySearch the Start
           // will be pointing to the next consecutive position. So compare it again and point to the
           // previous value returned from getFirstIndexUsingBinarySearch.
-          if (ByteUtil.compare(filterValues[k], dimensionColumnPage.getChunkData(start)) < 0) {
+          if (ByteUtil.compare(filterValue, dimensionColumnPage.getChunkData(start)) < 0) {
             start = start - 1;
           }
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanFilterExecutorImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanFilterExecutorImpl.java
index 0c29675..e2cddca 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanFilterExecutorImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelRangeLessThanFilterExecutorImpl.java
@@ -197,12 +197,12 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
   private boolean isScanRequired(byte[] minValue, Object[] filterValue,
       DataType dataType) {
     Object value = DataTypeUtil.getMeasureObjectFromDataType(minValue, dataType);
-    for (int i = 0; i < filterValue.length; i++) {
+    for (Object o : filterValue) {
       // TODO handle min and max for null values.
-      if (filterValue[i] == null) {
+      if (o == null) {
         return true;
       }
-      if (comparator.compare(filterValue[i], value) > 0) {
+      if (comparator.compare(o, value) > 0) {
         return true;
       }
     }
@@ -395,8 +395,8 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
     DataType msrType = msrColEvalutorInfoList.get(0).getType();
     SerializableComparator comparator = Comparator.getComparatorByDataTypeForMeasure(msrType);
     BitSet nullBitSet = columnPage.getNullBits();
-    for (int i = 0; i < filterValues.length; i++) {
-      if (filterValues[i] == null) {
+    for (Object filterValue : filterValues) {
+      if (filterValue == null) {
         for (int j = nullBitSet.nextSetBit(0); j >= 0; j = nullBitSet.nextSetBit(j + 1)) {
           bitSet.set(j);
         }
@@ -405,10 +405,10 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
       for (int startIndex = 0; startIndex < numberOfRows; startIndex++) {
         if (!nullBitSet.get(startIndex)) {
           Object msrValue = DataTypeUtil
-              .getMeasureObjectBasedOnDataType(columnPage, startIndex,
-                  msrType, msrColEvalutorInfoList.get(0).getMeasure());
+              .getMeasureObjectBasedOnDataType(columnPage, startIndex, msrType,
+                  msrColEvalutorInfoList.get(0).getMeasure());
 
-          if (comparator.compare(msrValue, filterValues[i]) < 0) {
+          if (comparator.compare(msrValue, filterValue) < 0) {
             // This is a match.
             bitSet.set(startIndex);
           }
@@ -484,17 +484,16 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
       startIndex = skip;
     }
 
-    for (int i = 0; i < filterValues.length; i++) {
+    for (byte[] filterValue : filterValues) {
       start = CarbonUtil
           .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
-              filterValues[i], false);
+              filterValue, false);
       if (start >= 0) {
         // Logic will handle the case where the range filter member is not present in block
         // in this case the binary search will return the index from where the bit sets will be
         // set inorder to apply filters. this is Lesser than filter so the range will be taken
         // from the prev element which is Lesser than filter member.
-        start =
-            CarbonUtil.nextLesserValueToTarget(start, dimensionColumnPage, filterValues[i]);
+        start = CarbonUtil.nextLesserValueToTarget(start, dimensionColumnPage, filterValue);
       }
       if (start < 0) {
         start = -(start + 1);
@@ -504,9 +503,8 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
         // When negative value of start is returned from getFirstIndexUsingBinarySearch the Start
         // will be pointing to the next consecutive position. So compare it again and point to the
         // previous value returned from getFirstIndexUsingBinarySearch.
-        if (ByteUtil.compare(filterValues[i],
-            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start)))
-            < 0) {
+        if (ByteUtil.compare(filterValue,
+            dimensionColumnPage.getChunkData(dimensionColumnPage.getInvertedIndex(start))) < 0) {
           start = start - 1;
         }
       }
@@ -561,13 +559,12 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
         }
         startIndex = skip;
       }
-      for (int k = 0; k < filterValues.length; k++) {
+      for (byte[] filterValue : filterValues) {
         start = CarbonUtil
-            .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex,
-                numberOfRows - 1, filterValues[k], false);
+            .getFirstIndexUsingBinarySearch(dimensionColumnPage, startIndex, numberOfRows - 1,
+                filterValue, false);
         if (start >= 0) {
-          start =
-              CarbonUtil.nextLesserValueToTarget(start, dimensionColumnPage, filterValues[k]);
+          start = CarbonUtil.nextLesserValueToTarget(start, dimensionColumnPage, filterValue);
         }
         if (start < 0) {
           start = -(start + 1);
@@ -578,7 +575,7 @@ public class RowLevelRangeLessThanFilterExecutorImpl extends RowLevelFilterExecu
           // When negative value of start is returned from getFirstIndexUsingBinarySearch the Start
           // will be pointing to the next consecutive position. So compare it again and point to the
           // previous value returned from getFirstIndexUsingBinarySearch.
-          if (ByteUtil.compare(filterValues[k], dimensionColumnPage.getChunkData(start)) < 0) {
+          if (ByteUtil.compare(filterValue, dimensionColumnPage.getChunkData(start)) < 0) {
             start = start - 1;
           }
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
index 76bfb33..7cae607 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/resolver/RowLevelRangeFilterResolverImpl.java
@@ -18,7 +18,6 @@
 package org.apache.carbondata.core.scan.filter.resolver;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
@@ -147,14 +146,8 @@ public class RowLevelRangeFilterResolverImpl extends ConditionalFilterResolverIm
         FilterUtil.logError(e, invalidRowsPresent);
       }
     }
-    Comparator<byte[]> filterNoDictValueComparator = new Comparator<byte[]>() {
-      @Override
-      public int compare(byte[] filterMember1, byte[] filterMember2) {
-        return ByteUtil.UnsafeComparer.INSTANCE.compareTo(filterMember1, filterMember2);
-      }
-
-    };
-    Collections.sort(filterValuesList, filterNoDictValueComparator);
+    Comparator<byte[]> filterNoDictValueComparator = ByteUtil.UnsafeComparer.INSTANCE::compareTo;
+    filterValuesList.sort(filterNoDictValueComparator);
     return filterValuesList;
   }
 
@@ -181,7 +174,7 @@ public class RowLevelRangeFilterResolverImpl extends ConditionalFilterResolverIm
         FilterUtil.logError(e, invalidRowsPresent);
       }
     }
-    Collections.sort(filterValuesList, org.apache.carbondata.core.util.comparator.Comparator
+    filterValuesList.sort(org.apache.carbondata.core.util.comparator.Comparator
         .getComparatorByDataTypeForMeasure(carbonMeasure.getDataType()));
     return filterValuesList;
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/model/QueryModelBuilder.java b/core/src/main/java/org/apache/carbondata/core/scan/model/QueryModelBuilder.java
index adbba56..d3ffe8b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/model/QueryModelBuilder.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/model/QueryModelBuilder.java
@@ -233,11 +233,8 @@ public class QueryModelBuilder {
       CarbonDimension childDimension) {
     if (parentDimension.getColName().equals(childDimension.getColName())) {
       return false;
-    } else if (checkForChildColumns(parentDimension, childDimension)) {
-      return true;
-    } else {
-      return false;
     }
+    return checkForChildColumns(parentDimension, childDimension);
   }
 
   private boolean checkForChildColumns(CarbonDimension parentDimension,
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/result/BlockletScannedResult.java b/core/src/main/java/org/apache/carbondata/core/scan/result/BlockletScannedResult.java
index 95e6327..8457244 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/result/BlockletScannedResult.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/result/BlockletScannedResult.java
@@ -266,18 +266,18 @@ public abstract class BlockletScannedResult {
     ReUsableByteArrayDataOutputStream reusableDataOutput =
         new ReUsableByteArrayDataOutputStream(byteStream);
     boolean isExceptionThrown = false;
-    for (int i = 0; i < vectorInfos.length; i++) {
-      int offset = vectorInfos[i].offset;
-      int len = offset + vectorInfos[i].size;
-      int vectorOffset = vectorInfos[i].vectorOffset;
-      CarbonColumnVector vector = vectorInfos[i].vector;
+    for (ColumnVectorInfo vectorInfo : vectorInfos) {
+      int offset = vectorInfo.offset;
+      int len = offset + vectorInfo.size;
+      int vectorOffset = vectorInfo.vectorOffset;
+      CarbonColumnVector vector = vectorInfo.vector;
       for (int j = offset; j < len; j++) {
         try {
-          vectorInfos[i].genericQueryType
+          vectorInfo.genericQueryType
               .parseBlocksAndReturnComplexColumnByteArray(dimRawColumnChunks, dimensionColumnPages,
                   pageFilteredRowId == null ? j : pageFilteredRowId[pageCounter][j], pageCounter,
                   reusableDataOutput);
-          Object data = vectorInfos[i].genericQueryType
+          Object data = vectorInfo.genericQueryType
               .getDataBasedOnDataType(ByteBuffer.wrap(reusableDataOutput.getByteArray()));
           vector.putObject(vectorOffset++, data);
           reusableDataOutput.reset();
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/result/impl/FilterQueryScannedResult.java b/core/src/main/java/org/apache/carbondata/core/scan/result/impl/FilterQueryScannedResult.java
index 0e5ddb9..de96046 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/result/impl/FilterQueryScannedResult.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/result/impl/FilterQueryScannedResult.java
@@ -49,9 +49,8 @@ public class FilterQueryScannedResult extends BlockletScannedResult {
   public void fillValidRowIdsBatchFilling(int rowId, int batchSize) {
     // row id will be different for every batch so clear it before filling
     clearValidRowIdList();
-    int startPosition = rowId;
     int minSize = Math.min(batchSize, pageFilteredRowId[pageCounter].length);
-    for (int j = startPosition; j < startPosition + minSize; ) {
+    for (int j = rowId; j < rowId + minSize; ) {
       int pos = pageFilteredRowId[pageCounter][j];
       if (!containsDeletedRow(pos)) {
         validRowIds.add(pos);
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/AbstractDetailQueryResultIterator.java b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/AbstractDetailQueryResultIterator.java
index c186701..9ce5b0a 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/AbstractDetailQueryResultIterator.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/AbstractDetailQueryResultIterator.java
@@ -201,11 +201,8 @@ public abstract class AbstractDetailQueryResultIterator<E> extends CarbonIterato
   public boolean hasNext() {
     if ((dataBlockIterator != null && dataBlockIterator.hasNext())) {
       return true;
-    } else if (blockExecutionInfos.size() > 0) {
-      return true;
-    } else {
-      return false;
     }
+    return blockExecutionInfos.size() > 0;
   }
 
   void updateDataBlockIterator() {
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ColumnDriftRawResultIterator.java b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ColumnDriftRawResultIterator.java
index 6b3f16c..c5969ca 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ColumnDriftRawResultIterator.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ColumnDriftRawResultIterator.java
@@ -78,12 +78,11 @@ public class ColumnDriftRawResultIterator extends RawResultIterator {
     noDictMap = new int[noDictCount];
     measureDataTypes = new DataType[noDictCount];
     List<CarbonMeasure> sourceMeasures = sourceSegProperties.getMeasures();
-    int tableMeasureCount = sourceMeasures.size();
     for (int i = 0; i < noDictCount; i++) {
-      for (int j = 0; j < tableMeasureCount; j++) {
-        if (RestructureUtil.isColumnMatches(true, noDictDims.get(i), sourceMeasures.get(j))) {
+      for (CarbonMeasure sourceMeasure : sourceMeasures) {
+        if (RestructureUtil.isColumnMatches(true, noDictDims.get(i), sourceMeasure)) {
           isColumnDrift[i] = true;
-          measureDataTypes[i] = sourceMeasures.get(j).getDataType();
+          measureDataTypes[i] = sourceMeasure.getDataType();
           break;
         }
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/RawResultIterator.java b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/RawResultIterator.java
index 21b4ae9..01ddb27 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/RawResultIterator.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/RawResultIterator.java
@@ -106,7 +106,7 @@ public class RawResultIterator extends CarbonIterator<Object[]> {
     }
 
     @Override
-    public Void call() throws Exception {
+    public Void call() {
       if (isBackupFilling) {
         backupBuffer = fetchRows();
         isBackupFilled = true;
@@ -173,11 +173,7 @@ public class RawResultIterator extends CarbonIterator<Object[]> {
   @Override
   public boolean hasNext() {
     fillDataFromPrefetch();
-    if (currentIdxInBuffer < currentBuffer.size()) {
-      return true;
-    }
-
-    return false;
+    return currentIdxInBuffer < currentBuffer.size();
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFilterScanner.java b/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFilterScanner.java
index 8946643..3b69e93 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFilterScanner.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFilterScanner.java
@@ -252,7 +252,7 @@ public class BlockletFilterScanner extends BlockletFullScanner {
           columnIndexRange[1] + 1 - columnIndexRange[0]);
     }
 
-    /**
+    /*
      * Below code is to read the dimension which is not read as part of filter or projection
      * for example in case of or filter if first filter matches all the rows then it will not read
      * second filter column and if it is present as part of projection, so needs to be read
@@ -293,7 +293,7 @@ public class BlockletFilterScanner extends BlockletFullScanner {
       System.arraycopy(projectionListMeasureChunk, columnIndexRange[0], measureRawColumnChunks,
           columnIndexRange[0], columnIndexRange[1] + 1 - columnIndexRange[0]);
     }
-    /**
+    /*
      * Below code is to read the measure which is not read as part of filter or projection
      * for example in case of or filter if first filter matches all the rows then it will not read
      * second filter column and if it is present as part of projection, so needs to be read
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFullScanner.java b/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFullScanner.java
index 0485e9f..583152b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFullScanner.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/scanner/impl/BlockletFullScanner.java
@@ -100,9 +100,9 @@ public class BlockletFullScanner implements BlockletScanner {
     scannedResult.setMsrRawColumnChunks(measureRawColumnChunks);
     int[] numberOfRows = null;
     if (blockExecutionInfo.getAllSelectedDimensionColumnIndexRange().length > 0) {
-      for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
-        if (dimensionRawColumnChunks[i] != null) {
-          numberOfRows = dimensionRawColumnChunks[i].getRowCount();
+      for (DimensionRawColumnChunk dimensionRawColumnChunk : dimensionRawColumnChunks) {
+        if (dimensionRawColumnChunk != null) {
+          numberOfRows = dimensionRawColumnChunk.getRowCount();
           break;
         }
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/segmentmeta/SegmentMetaDataInfoStats.java b/core/src/main/java/org/apache/carbondata/core/segmentmeta/SegmentMetaDataInfoStats.java
index 30da1e3..71828c8 100644
--- a/core/src/main/java/org/apache/carbondata/core/segmentmeta/SegmentMetaDataInfoStats.java
+++ b/core/src/main/java/org/apache/carbondata/core/segmentmeta/SegmentMetaDataInfoStats.java
@@ -38,10 +38,8 @@ public class SegmentMetaDataInfoStats {
   public static synchronized SegmentMetaDataInfoStats getInstance() {
     if (null == segmentMetaDataInfoStats) {
       segmentMetaDataInfoStats = new SegmentMetaDataInfoStats();
-      return segmentMetaDataInfoStats;
-    } else {
-      return segmentMetaDataInfoStats;
     }
+    return segmentMetaDataInfoStats;
   }
 
   private Map<String, Map<String, BlockColumnMetaDataInfo>> tableSegmentMetaDataInfoMap;
diff --git a/core/src/main/java/org/apache/carbondata/core/stats/TaskStatistics.java b/core/src/main/java/org/apache/carbondata/core/stats/TaskStatistics.java
index 2681f23..7fca531 100644
--- a/core/src/main/java/org/apache/carbondata/core/stats/TaskStatistics.java
+++ b/core/src/main/java/org/apache/carbondata/core/stats/TaskStatistics.java
@@ -19,7 +19,7 @@ package org.apache.carbondata.core.stats;
 
 import java.io.Serializable;
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.carbondata.common.annotations.InterfaceAudience;
@@ -97,7 +97,7 @@ public class TaskStatistics implements Serializable {
   @Override
   public String toString() {
     StringBuilder builder = new StringBuilder();
-    printStatisticTable(Arrays.asList(this), builder, "");
+    printStatisticTable(Collections.singletonList(this), builder, "");
     return builder.toString();
   }
 
@@ -126,7 +126,7 @@ public class TaskStatistics implements Serializable {
     valueStrings[0] = queryId;
     for (int i = 1; i < numOfColumns; i++) {
       if (columns[i].isDuration) {
-        valueStrings[i] = String.valueOf(values[i]) + "ms";
+        valueStrings[i] = values[i] + "ms";
       } else {
         valueStrings[i] = String.valueOf(values[i]);
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
index 2d2060e..e6464d5 100755
--- a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
+++ b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
@@ -366,9 +366,9 @@ public class SegmentStatusManager {
    */
   private static int getMaxSegmentId(LoadMetadataDetails[] loadMetadataDetails) {
     int newSegmentId = -1;
-    for (int i = 0; i < loadMetadataDetails.length; i++) {
+    for (LoadMetadataDetails loadMetadataDetail : loadMetadataDetails) {
       try {
-        int loadCount = Integer.parseInt(loadMetadataDetails[i].getLoadName());
+        int loadCount = Integer.parseInt(loadMetadataDetail.getLoadName());
         if (newSegmentId < loadCount) {
           newSegmentId = loadCount;
         }
@@ -379,7 +379,7 @@ public class SegmentStatusManager {
         // out all the compacted folders will be deleted and entry will also be removed from the
         // table status file. In that case also if a new load comes the new segment Id assigned
         // should be 13 and not 0
-        String loadName = loadMetadataDetails[i].getLoadName();
+        String loadName = loadMetadataDetail.getLoadName();
         if (loadName.contains(".")) {
           int loadCount = Integer.parseInt(loadName.split("\\.")[0]);
           if (newSegmentId < loadCount) {
diff --git a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
index f9a3ee7..8e12c2d 100644
--- a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
+++ b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
@@ -252,17 +252,11 @@ public class SegmentUpdateStatusManager {
           String firstPart = fileName.substring(0, fileName.indexOf('.'));
 
           long timestamp = Long.parseLong(firstPart
-              .substring(firstPart.lastIndexOf(CarbonCommonConstants.HYPHEN) + 1,
-                  firstPart.length()));
-          if (Long.compare(timestamp, endTimeStampFinal) <= 0
-              && Long.compare(timestamp, startTimeStampFinal) >= 0) {
+              .substring(firstPart.lastIndexOf(CarbonCommonConstants.HYPHEN) + 1));
+          if (timestamp <= endTimeStampFinal && timestamp >= startTimeStampFinal) {
 
             // if marked for delete then it is invalid.
-            if (!isBlockValid(segmentId, fileName)) {
-              return false;
-            }
-
-            return true;
+            return isBlockValid(segmentId, fileName);
           }
         }
         return false;
@@ -390,10 +384,7 @@ public class SegmentUpdateStatusManager {
         @Override
         public boolean accept(CarbonFile pathName) {
           String fileName = pathName.getName();
-          if (fileName.endsWith(extension) && pathName.getSize() > 0) {
-            return true;
-          }
-          return false;
+          return fileName.endsWith(extension) && pathName.getSize() > 0;
         }
       });
       deltaList = new ArrayList<>(files.length);
@@ -412,8 +403,8 @@ public class SegmentUpdateStatusManager {
       // It compares whether this delta file belongs to this block or not. And also checks that
       // corresponding delta file is valid or not by considering its load start and end time with
       // the file timestamp.
-      if (blockNameFromTuple.equals(blockName) && ((Long.compare(timestamp, deltaEndTimeStamp) <= 0)
-          && (Long.compare(timestamp, deltaStartTimestamp) >= 0))) {
+      if (blockNameFromTuple.equals(blockName) && ((timestamp <= deltaEndTimeStamp)
+          && (timestamp >= deltaStartTimestamp))) {
         if (null == deleteFileList) {
           deleteFileList = new ArrayList<String>();
         }
@@ -453,10 +444,8 @@ public class SegmentUpdateStatusManager {
               String blkName = fileName.substring(0, fileName.lastIndexOf("-"));
               long timestamp =
                   Long.parseLong(CarbonTablePath.DataFileUtil.getTimeStampFromFileName(fileName));
-              if (blockName.equals(blkName) && (Long.compare(timestamp, deltaEndTimeStamp) <= 0)
-                  && (Long.compare(timestamp, deltaStartTimestamp) >= 0)) {
-                return true;
-              }
+              return blockName.equals(blkName) && timestamp <= deltaEndTimeStamp
+                  && timestamp >= deltaStartTimestamp;
             }
             return false;
           }
@@ -508,24 +497,24 @@ public class SegmentUpdateStatusManager {
             Long.parseLong(CarbonTablePath.DataFileUtil.getTimeStampFromFileName(fileName));
 
         if (excludeOriginalFact) {
-          if (Long.compare(factTimeStampFinal, timestamp) == 0) {
+          if (factTimeStampFinal == timestamp) {
             continue;
           }
         }
 
         if (validUpdateFiles) {
-          if (Long.compare(timestamp, endTimeStampFinal) <= 0
-              && Long.compare(timestamp, startTimeStampFinal) >= 0) {
+          if (timestamp <= endTimeStampFinal
+              && timestamp >= startTimeStampFinal) {
             listOfCarbonFiles.add(eachFile);
           }
         } else {
           // invalid cases.
           if (isAbortedFile) {
-            if (Long.compare(timestamp, endTimeStampFinal) > 0) {
+            if (timestamp > endTimeStampFinal) {
               listOfCarbonFiles.add(eachFile);
             }
-          } else if (Long.compare(timestamp, startTimeStampFinal) < 0
-              || Long.compare(timestamp, endTimeStampFinal) > 0) {
+          } else if (timestamp < startTimeStampFinal
+              || timestamp > endTimeStampFinal) {
             listOfCarbonFiles.add(eachFile);
           }
         }
@@ -583,18 +572,17 @@ public class SegmentUpdateStatusManager {
         String firstPart = fileName.substring(0, fileName.indexOf('.'));
 
         long timestamp = Long.parseLong(firstPart
-            .substring(firstPart.lastIndexOf(CarbonCommonConstants.HYPHEN) + 1,
-                firstPart.length()));
+            .substring(firstPart.lastIndexOf(CarbonCommonConstants.HYPHEN) + 1));
 
         if (excludeOriginalFact) {
-          if (Long.compare(factTimeStampFinal, timestamp) == 0) {
+          if (factTimeStampFinal == timestamp) {
             continue;
           }
         }
 
         if (validUpdateFiles) {
-          if (Long.compare(timestamp, endTimeStampFinal) <= 0
-              && Long.compare(timestamp, startTimeStampFinal) >= 0) {
+          if (timestamp <= endTimeStampFinal
+              && timestamp >= startTimeStampFinal) {
 
             boolean validBlock = true;
 
@@ -612,7 +600,7 @@ public class SegmentUpdateStatusManager {
           }
         } else {
           // invalid cases.
-          if (Long.compare(timestamp, startTimeStampFinal) < 0) {
+          if (timestamp < startTimeStampFinal) {
             listOfCarbonFiles.add(eachFile);
           }
         }
@@ -837,11 +825,11 @@ public class SegmentUpdateStatusManager {
         if (block.getBlockName().equalsIgnoreCase(blkName)) {
 
           if (isAbortedFile) {
-            if (Long.compare(timestamp, deltaEndTimestamp) > 0) {
+            if (timestamp > deltaEndTimestamp) {
               files.add(eachFile);
             }
-          } else if (Long.compare(timestamp, deltaStartTimestamp) < 0
-              || Long.compare(timestamp, deltaEndTimestamp) > 0) {
+          } else if (timestamp < deltaStartTimestamp
+              || timestamp > deltaEndTimestamp) {
             files.add(eachFile);
           }
         }
diff --git a/core/src/main/java/org/apache/carbondata/core/stream/StreamPruner.java b/core/src/main/java/org/apache/carbondata/core/stream/StreamPruner.java
index f8ee3b8..ec48130 100644
--- a/core/src/main/java/org/apache/carbondata/core/stream/StreamPruner.java
+++ b/core/src/main/java/org/apache/carbondata/core/stream/StreamPruner.java
@@ -97,11 +97,7 @@ public class StreamPruner {
     byte[][] minValue = streamFile.getMinMaxIndex().getMinValues();
     BitSet bitSet = filterExecutor
         .isScanRequired(maxValue, minValue, streamFile.getMinMaxIndex().getIsMinMaxSet());
-    if (!bitSet.isEmpty()) {
-      return true;
-    } else {
-      return false;
-    }
+    return !bitSet.isEmpty();
   }
 
   // TODO optimize and move the code to StreamSegment , but it's in the streaming module.
diff --git a/core/src/main/java/org/apache/carbondata/core/util/BitSetGroup.java b/core/src/main/java/org/apache/carbondata/core/util/BitSetGroup.java
index 20ab509..842de2d 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/BitSetGroup.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/BitSetGroup.java
@@ -87,8 +87,8 @@ public class BitSetGroup {
    */
   public int getValidPages() {
     int numberOfPages = 0;
-    for (int i = 0; i < bitSets.length; i++) {
-      numberOfPages += (bitSets[i] != null && !bitSets[i].isEmpty()) ? 1 : 0;
+    for (BitSet bitSet : bitSets) {
+      numberOfPages += (bitSet != null && !bitSet.isEmpty()) ? 1 : 0;
     }
     return numberOfPages;
   }
diff --git a/core/src/main/java/org/apache/carbondata/core/util/BlockletIndexUtil.java b/core/src/main/java/org/apache/carbondata/core/util/BlockletIndexUtil.java
index 32dfb4c..6f42768 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/BlockletIndexUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/BlockletIndexUtil.java
@@ -71,8 +71,7 @@ public class BlockletIndexUtil {
   private static final Logger LOG =
       LogServiceFactory.getLogService(BlockletIndexUtil.class.getName());
 
-  public static Set<TableBlockIndexUniqueIdentifier> getSegmentUniqueIdentifiers(Segment segment)
-      throws IOException {
+  public static Set<TableBlockIndexUniqueIdentifier> getSegmentUniqueIdentifiers(Segment segment) {
     Set<TableBlockIndexUniqueIdentifier> set = new HashSet<>();
     set.add(new TableBlockIndexUniqueIdentifier(segment.getSegmentNo()));
     return set;
@@ -265,10 +264,7 @@ public class BlockletIndexUtil {
   public static boolean isCacheLevelBlock(CarbonTable carbonTable) {
     String cacheLevel = carbonTable.getTableInfo().getFactTable().getTableProperties()
         .get(CarbonCommonConstants.CACHE_LEVEL);
-    if (BlockletIndexFactory.CACHE_LEVEL_BLOCKLET.equals(cacheLevel)) {
-      return false;
-    }
-    return true;
+    return !BlockletIndexFactory.CACHE_LEVEL_BLOCKLET.equals(cacheLevel);
   }
 
   /**
@@ -278,23 +274,20 @@ public class BlockletIndexUtil {
   public static boolean isSameColumnAndDifferentDatatypeInSchema(
       List<ColumnSchema> indexFileColumnList, List<ColumnSchema> tableColumnList)
       throws IOException {
-    for (int i = 0; i < tableColumnList.size(); i++) {
-      for (int j = 0; j < indexFileColumnList.size(); j++) {
-        if (indexFileColumnList.get(j).getColumnName()
-            .equalsIgnoreCase(tableColumnList.get(i).getColumnName()) && !indexFileColumnList.get(j)
-            .getDataType().getName()
-            .equalsIgnoreCase(tableColumnList.get(i).getDataType().getName())) {
-          if ("varchar".equalsIgnoreCase(indexFileColumnList.get(j).getDataType().getName()) &&
-              "string".equalsIgnoreCase(tableColumnList.get(i).getDataType().getName())) {
-            throw new IOException("Datatype of the Column "
-                + indexFileColumnList.get(j).getDataType().getName()
-                + " present in index file, is varchar and not same as datatype of the column " +
-                "with same name present in table, " +
-                "because carbon convert varchar of carbon to string of spark, " +
-                "please set long_string_columns for varchar column: "
-                + tableColumnList.get(i).getColumnName());
+    for (ColumnSchema columnSchema : tableColumnList) {
+      for (ColumnSchema schema : indexFileColumnList) {
+        if (schema.getColumnName().equalsIgnoreCase(columnSchema.getColumnName()) && !schema
+            .getDataType().getName().equalsIgnoreCase(columnSchema.getDataType().getName())) {
+          if ("varchar".equalsIgnoreCase(schema.getDataType().getName()) && "string"
+              .equalsIgnoreCase(columnSchema.getDataType().getName())) {
+            throw new IOException("Datatype of the Column " + schema.getDataType().getName()
+                + " present in index file, is varchar and not same as datatype of the column "
+                + "with same name present in table, "
+                + "because carbon convert varchar of carbon to string of spark, "
+                + "please set long_string_columns for varchar column: " + columnSchema
+                .getColumnName());
           }
-          LOG.error("Datatype of the Column " + indexFileColumnList.get(j).getColumnName()
+          LOG.error("Datatype of the Column " + schema.getColumnName()
               + " present in index file, is not same as datatype of the column with same name"
               + "present in table");
           return false;
diff --git a/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java b/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
index cbfe82e..3165dde 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
@@ -667,9 +667,9 @@ public final class ByteUtil {
     }
     byte[] flattenedData = new byte[totalSize];
     int pos = 0;
-    for (int i = 0; i < input.length; i++) {
-      System.arraycopy(input[i], 0, flattenedData, pos, input[i].length);
-      pos += input[i].length;
+    for (byte[] bytes : input) {
+      System.arraycopy(bytes, 0, flattenedData, pos, bytes.length);
+      pos += bytes.length;
     }
     return flattenedData;
   }
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 fc2ed77..1cd181d 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
@@ -163,6 +163,7 @@ public final class CarbonProperties {
         validateCarbonCSVReadBufferSizeByte();
         break;
       case HANDOFF_SIZE:
+      case ENABLE_AUTO_HANDOFF:
         validateHandoffSize();
         break;
       case CARBON_TASK_DISTRIBUTION:
@@ -185,9 +186,6 @@ public final class CarbonProperties {
       case SORT_INTERMEDIATE_FILES_LIMIT:
         validateSortIntermediateFilesLimit();
         break;
-      case ENABLE_AUTO_HANDOFF:
-        validateHandoffSize();
-        break;
       case CARBON_SCHEDULER_MIN_REGISTERED_RESOURCES_RATIO:
         validateSchedulerMinRegisteredRatio();
         break;
@@ -1193,7 +1191,7 @@ public final class CarbonProperties {
   }
 
   public long getHandoffSize() {
-    Long handoffSize;
+    long handoffSize;
     try {
       handoffSize = Long.parseLong(
           CarbonProperties.getInstance().getProperty(
@@ -1743,7 +1741,6 @@ public final class CarbonProperties {
     } else {
       switch (provider.toUpperCase()) {
         case CarbonCommonConstants.CARBON_INDEX_SCHEMA_STORAGE_DISK:
-          break;
         case  CarbonCommonConstants.CARBON_INDEX_SCHEMA_STORAGE_DATABASE:
           break;
         default:
diff --git a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
index 4de25bf..fa77fc4 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
@@ -330,11 +330,11 @@ public final class CarbonUtil {
 
       @Override
       public Void run() throws Exception {
-        for (int i = 0; i < file.length; i++) {
-          if (file[i].exists()) {
-            boolean delete = file[i].delete();
+        for (CarbonFile carbonFile : file) {
+          if (carbonFile.exists()) {
+            boolean delete = carbonFile.delete();
             if (!delete) {
-              throw new IOException("Error while deleting file: " + file[i].getAbsolutePath());
+              throw new IOException("Error while deleting file: " + carbonFile.getAbsolutePath());
             }
           }
         }
@@ -349,11 +349,11 @@ public final class CarbonUtil {
 
       @Override
       public Void run() {
-        for (int i = 0; i < file.length; i++) {
-          if (file[i].exists()) {
-            boolean delete = file[i].delete();
+        for (CarbonFile carbonFile : file) {
+          if (carbonFile.exists()) {
+            boolean delete = carbonFile.delete();
             if (!delete) {
-              LOGGER.warn("Unable to delete file: " + file[i].getCanonicalPath());
+              LOGGER.warn("Unable to delete file: " + carbonFile.getCanonicalPath());
             }
           }
         }
@@ -363,9 +363,9 @@ public final class CarbonUtil {
   }
 
   public static void deleteFiles(File[] intermediateFiles) throws IOException {
-    for (int i = 0; i < intermediateFiles.length; i++) {
+    for (File intermediateFile : intermediateFiles) {
       // ignore deleting for index file since it is inside merged file.
-      if (!intermediateFiles[i].delete() && !intermediateFiles[i].getName()
+      if (!intermediateFile.delete() && !intermediateFile.getName()
           .endsWith(CarbonTablePath.INDEX_FILE_EXT)) {
         throw new IOException("Problem while deleting intermediate file");
       }
@@ -701,7 +701,7 @@ public final class CarbonUtil {
     if (lowerPath.startsWith(CarbonCommonConstants.S3N_PREFIX) ||
         lowerPath.startsWith(CarbonCommonConstants.S3A_PREFIX) ||
         lowerPath.startsWith(CarbonCommonConstants.S3_PREFIX)) {
-      int prefixLength = filePath.indexOf(":", 0) + 3;
+      int prefixLength = filePath.indexOf(":") + 3;
       int pathOffset = filePath.indexOf("@");
       if (pathOffset > 0) {
         return filePath.substring(0, prefixLength) + filePath.substring(pathOffset + 1);
@@ -794,8 +794,8 @@ public final class CarbonUtil {
   public static int[] getDimensionBitLength(int[] dimCardinality, int[] dimPartitioner) {
     int[] bitLength = new int[dimCardinality.length];
     int dimCounter = 0;
-    for (int i = 0; i < dimPartitioner.length; i++) {
-      if (dimPartitioner[i] == 1) {
+    for (int value : dimPartitioner) {
+      if (value == 1) {
         // for columnar store
         // fully filled bits means complete byte or number of bits
         // assigned will be in
@@ -805,7 +805,7 @@ public final class CarbonUtil {
       } else {
         // for row store
         int totalSize = 0;
-        for (int j = 0; j < dimPartitioner[i]; j++) {
+        for (int j = 0; j < value; j++) {
           bitLength[dimCounter] = getIncrementedCardinality(dimCardinality[dimCounter]);
           totalSize += bitLength[dimCounter];
           dimCounter++;
@@ -1014,11 +1014,7 @@ public final class CarbonUtil {
       if (null != children && children.size() > 0) {
         break;
       }
-      if (carbonDimension.getDataType() == DataTypes.DATE) {
-        isDictionaryDimensions.add(true);
-      } else {
-        isDictionaryDimensions.add(false);
-      }
+      isDictionaryDimensions.add(carbonDimension.getDataType() == DataTypes.DATE);
     }
     return ArrayUtils
         .toPrimitive(isDictionaryDimensions.toArray(new Boolean[isDictionaryDimensions.size()]));
@@ -1382,32 +1378,17 @@ public final class CarbonUtil {
   }
 
   public static BlockletHeader readBlockletHeader(byte[] data) throws IOException {
-    return (BlockletHeader) read(data, new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new BlockletHeader();
-      }
-    }, 0, data.length);
+    return (BlockletHeader) read(data, BlockletHeader::new, 0, data.length);
   }
 
   public static DataChunk3 readDataChunk3(ByteBuffer dataChunkBuffer, int offset, int length)
       throws IOException {
     byte[] data = dataChunkBuffer.array();
-    return (DataChunk3) read(data, new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new DataChunk3();
-      }
-    }, offset, length);
+    return (DataChunk3) read(data, DataChunk3::new, offset, length);
   }
 
   public static DataChunk3 readDataChunk3(InputStream stream) throws IOException {
-    TBaseCreator creator = new ThriftReader.TBaseCreator() {
-      @Override
-      public TBase create() {
-        return new DataChunk3();
-      }
-    };
+    TBaseCreator creator = DataChunk3::new;
     TProtocol binaryIn = new TCompactProtocol(new TIOStreamTransport(stream));
     TBase t = creator.create();
     try {
@@ -1571,16 +1552,16 @@ public final class CarbonUtil {
   public static void freeMemory(DimensionRawColumnChunk[] dimensionRawColumnChunks,
       MeasureRawColumnChunk[] measureRawColumnChunks) {
     if (null != measureRawColumnChunks) {
-      for (int i = 0; i < measureRawColumnChunks.length; i++) {
-        if (null != measureRawColumnChunks[i]) {
-          measureRawColumnChunks[i].freeMemory();
+      for (MeasureRawColumnChunk measureRawColumnChunk : measureRawColumnChunks) {
+        if (null != measureRawColumnChunk) {
+          measureRawColumnChunk.freeMemory();
         }
       }
     }
     if (null != dimensionRawColumnChunks) {
-      for (int i = 0; i < dimensionRawColumnChunks.length; i++) {
-        if (null != dimensionRawColumnChunks[i]) {
-          dimensionRawColumnChunks[i].freeMemory();
+      for (DimensionRawColumnChunk dimensionRawColumnChunk : dimensionRawColumnChunks) {
+        if (null != dimensionRawColumnChunk) {
+          dimensionRawColumnChunk.freeMemory();
         }
       }
     }
@@ -1828,7 +1809,7 @@ public final class CarbonUtil {
         }
       }
       builder.append(quote).append("carbonSchema").append(i).append(quote).append(separator);
-      builder.append("'").append(schemaString.substring(runningLen, runningLen + endLen))
+      builder.append("'").append(schemaString, runningLen, runningLen + endLen)
           .append("'");
       if (i < parts - 1) {
         builder.append(",");
@@ -1952,12 +1933,7 @@ public final class CarbonUtil {
   public static org.apache.carbondata.format.TableInfo readSchemaFile(String schemaFilePath,
       Configuration conf)
       throws IOException {
-    TBaseCreator createTBase = new ThriftReader.TBaseCreator() {
-      public org.apache.thrift.TBase<org.apache.carbondata.format.TableInfo,
-          org.apache.carbondata.format.TableInfo._Fields> create() {
-        return new org.apache.carbondata.format.TableInfo();
-      }
-    };
+    TBaseCreator createTBase = org.apache.carbondata.format.TableInfo::new;
     ThriftReader thriftReader = new ThriftReader(schemaFilePath, createTBase, conf);
     thriftReader.open();
     org.apache.carbondata.format.TableInfo tableInfo =
@@ -2149,10 +2125,8 @@ public final class CarbonUtil {
         new ThriftWrapperSchemaConverterImpl();
     org.apache.carbondata.format.TableSchema thriftFactTable =
         thriftWrapperSchemaConverter.fromWrapperToExternalTableSchema(tableSchema);
-    org.apache.carbondata.format.TableInfo tableInfo =
-        new org.apache.carbondata.format.TableInfo(thriftFactTable,
-            new ArrayList<org.apache.carbondata.format.TableSchema>());
-    return tableInfo;
+    return new org.apache.carbondata.format.TableInfo(thriftFactTable,
+        new ArrayList<org.apache.carbondata.format.TableSchema>());
   }
 
   /**
@@ -2209,11 +2183,9 @@ public final class CarbonUtil {
           new ThriftWrapperSchemaConverterImpl();
       org.apache.carbondata.format.TableSchema thriftFactTable =
           thriftWrapperSchemaConverter.fromWrapperToExternalTableSchema(tableSchema);
-      org.apache.carbondata.format.TableInfo tableInfo =
-          new org.apache.carbondata.format.TableInfo(thriftFactTable,
-              new ArrayList<org.apache.carbondata.format.TableSchema>());
 
-      return tableInfo;
+      return new org.apache.carbondata.format.TableInfo(thriftFactTable,
+          new ArrayList<org.apache.carbondata.format.TableSchema>());
     } finally {
       indexFileReader.closeThriftReader();
     }
@@ -2303,7 +2275,7 @@ public final class CarbonUtil {
       for (String value : values) {
         if (!value.equalsIgnoreCase("*")) {
           Segment segment = Segment.toSegment(value, null);
-          Float aFloatValue = Float.parseFloat(segment.getSegmentNo());
+          float aFloatValue = Float.parseFloat(segment.getSegmentNo());
           if (aFloatValue < 0 || aFloatValue > Float.MAX_VALUE) {
             throw new InvalidConfigurationException(
                 "carbon.input.segments.<database_name>.<table_name> value range should be greater "
@@ -2429,12 +2401,9 @@ public final class CarbonUtil {
           if (!FileFactory.isFileExist(metadataPath)) {
             totalDataSize = FileFactory.getDirectorySize(carbonTable.getTablePath());
           }
-          dataIndexSizeMap
-              .put(String.valueOf(CarbonCommonConstants.CARBON_TOTAL_DATA_SIZE), totalDataSize);
-          dataIndexSizeMap
-              .put(String.valueOf(CarbonCommonConstants.CARBON_TOTAL_INDEX_SIZE), totalIndexSize);
-          dataIndexSizeMap
-              .put(String.valueOf(CarbonCommonConstants.LAST_UPDATE_TIME), lastUpdateTime);
+          dataIndexSizeMap.put(CarbonCommonConstants.CARBON_TOTAL_DATA_SIZE, totalDataSize);
+          dataIndexSizeMap.put(CarbonCommonConstants.CARBON_TOTAL_INDEX_SIZE, totalIndexSize);
+          dataIndexSizeMap.put(CarbonCommonConstants.LAST_UPDATE_TIME, lastUpdateTime);
         } else {
           LOGGER.error("Not able to acquire the lock for Table status update for table");
         }
@@ -2790,7 +2759,7 @@ public final class CarbonUtil {
       String segmentId, boolean isTransactionalTable, boolean isStandardTable,
       boolean isPartitionTable) {
     String blockId;
-    String blockName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.length());
+    String blockName = filePath.substring(filePath.lastIndexOf("/") + 1);
     String tablePath = identifier.getTablePath();
 
     if (filePath.startsWith(tablePath)) {
@@ -2800,10 +2769,10 @@ public final class CarbonUtil {
       } else {
         // This is the case with partition table.
         String partitionDir;
-        if (tablePath.length() + 1 < filePath.length() - blockName.length() - 1) {
+        int partLength = filePath.length() - blockName.length() - 1;
+        if (tablePath.length() + 1 < partLength) {
           partitionDir =
-              filePath.substring(tablePath.length() + 1,
-                  filePath.length() - blockName.length() - 1);
+              filePath.substring(tablePath.length() + 1, partLength);
         } else {
           partitionDir = "";
         }
@@ -3220,9 +3189,7 @@ public final class CarbonUtil {
             DefaultEncodingFactory.getInstance().createEncoder(columnSpec, columnPage);
         newEncodedColumnPage = columnPageEncoder.encode(columnPage);
     }
-    FallbackEncodedColumnPage fallbackEncodedColumnPage =
-        new FallbackEncodedColumnPage(newEncodedColumnPage, pageIndex);
-    return fallbackEncodedColumnPage;
+    return new FallbackEncodedColumnPage(newEncodedColumnPage, pageIndex);
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/util/DataTypeConverterImpl.java b/core/src/main/java/org/apache/carbondata/core/util/DataTypeConverterImpl.java
index 86e5550..b6f458a 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/DataTypeConverterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/DataTypeConverterImpl.java
@@ -90,8 +90,7 @@ public class DataTypeConverterImpl implements DataTypeConverter, Serializable {
 
   @Override
   public Object[] unwrapGenericRowToObject(Object data) {
-    Object[] splitData = (Object[]) data;
-    return splitData;
+    return (Object[]) data;
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java b/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
index 357bb52..dd362d6 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
@@ -119,7 +119,7 @@ public final class DataTypeUtil {
     } else if (dataType == DataTypes.BYTE) {
       return Byte.parseByte(msrValue);
     } else {
-      Double parsedValue = Double.valueOf(msrValue);
+      double parsedValue = Double.parseDouble(msrValue);
       if (Double.isInfinite(parsedValue) || Double.isNaN(parsedValue)) {
         return null;
       }
@@ -159,7 +159,7 @@ public final class DataTypeUtil {
     } else if (dataType == DataTypes.TIMESTAMP) {
       return parseTimestamp(dimValue, timeStampFormat);
     } else {
-      Double parsedValue = Double.valueOf(dimValue);
+      double parsedValue = Double.parseDouble(dimValue);
       if (Double.isInfinite(parsedValue) || Double.isNaN(parsedValue)) {
         return null;
       }
@@ -508,7 +508,7 @@ public final class DataTypeUtil {
       }
     }
     if (actualDataType == DataTypes.BOOLEAN) {
-      return ByteUtil.toBytes(Boolean.valueOf(ByteUtil.toBoolean((byte) dimensionValue)));
+      return ByteUtil.toBytes(ByteUtil.toBoolean((byte) dimensionValue));
     } else if (actualDataType == DataTypes.SHORT) {
       return ByteUtil.toXorBytes((Short) dimensionValue);
     } else if (actualDataType == DataTypes.INT) {
@@ -529,14 +529,10 @@ public final class DataTypeUtil {
    * @return
    */
   public static boolean isFixedSizeDataType(DataType dataType) {
-    if (dataType == DataTypes.STRING ||
-        dataType == DataTypes.VARCHAR ||
-        dataType == DataTypes.BINARY ||
-        DataTypes.isDecimal(dataType)) {
-      return false;
-    } else {
-      return true;
-    }
+    return dataType != DataTypes.STRING
+        && dataType != DataTypes.VARCHAR
+        && dataType != DataTypes.BINARY
+        && !DataTypes.isDecimal(dataType);
   }
 
   /**
@@ -838,11 +834,11 @@ public final class DataTypeUtil {
       long parsedIntVal = 0;
       DataType dataType = columnSchema.getDataType();
       if (dataType == DataTypes.INT) {
-        parsedIntVal = (long) Integer.parseInt(data);
+        parsedIntVal = Integer.parseInt(data);
         return String.valueOf(parsedIntVal)
             .getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
       } else if (dataType == DataTypes.SHORT) {
-        parsedIntVal = (long) Short.parseShort(data);
+        parsedIntVal = Short.parseShort(data);
         return String.valueOf(parsedIntVal)
             .getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
       } else if (dataType == DataTypes.DOUBLE) {
@@ -1014,13 +1010,15 @@ public final class DataTypeUtil {
    * @return
    */
   public static boolean isPrimitiveColumn(DataType dataType) {
-    if (dataType == DataTypes.BOOLEAN || dataType == DataTypes.BYTE || dataType == DataTypes.SHORT
-        || dataType == DataTypes.INT || dataType == DataTypes.LONG
-        || dataType == DataTypes.TIMESTAMP || DataTypes.isDecimal(dataType)
-        || dataType == DataTypes.FLOAT || dataType == DataTypes.DOUBLE) {
-      return true;
-    }
-    return false;
+    return dataType == DataTypes.BOOLEAN
+        || dataType == DataTypes.BYTE
+        || dataType == DataTypes.SHORT
+        || dataType == DataTypes.INT
+        || dataType == DataTypes.LONG
+        || dataType == DataTypes.TIMESTAMP
+        || DataTypes.isDecimal(dataType)
+        || dataType == DataTypes.FLOAT
+        || dataType == DataTypes.DOUBLE;
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java b/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
index 36508c4..6848626 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
@@ -195,14 +195,10 @@ public class SessionParams implements Serializable, Cloneable {
         }
         break;
       // no validation needed while set for CARBON_OPTIONS_DATEFORMAT
-      case CARBON_OPTIONS_DATEFORMAT:
-        isValid = true;
-        break;
       // no validation needed while set for CARBON_OPTIONS_TIMESTAMPFORMAT
-      case CARBON_OPTIONS_TIMESTAMPFORMAT:
-        isValid = true;
-        break;
       // no validation needed while set for CARBON_OPTIONS_SERIALIZATION_NULL_FORMAT
+      case CARBON_OPTIONS_DATEFORMAT:
+      case CARBON_OPTIONS_TIMESTAMPFORMAT:
       case CARBON_OPTIONS_SERIALIZATION_NULL_FORMAT:
         isValid = true;
         break;
diff --git a/core/src/main/java/org/apache/carbondata/core/util/comparator/BooleanSerializableComparator.java b/core/src/main/java/org/apache/carbondata/core/util/comparator/BooleanSerializableComparator.java
index 389cf85..df89131 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/comparator/BooleanSerializableComparator.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/comparator/BooleanSerializableComparator.java
@@ -27,12 +27,6 @@ public class BooleanSerializableComparator implements SerializableComparator {
     } else if (key2 == null) {
       return 1;
     }
-    if (Boolean.compare((boolean) key1, (boolean) key2) < 0) {
-      return -1;
-    } else if (Boolean.compare((boolean) key1, (boolean) key2) > 0) {
-      return 1;
-    } else {
-      return 0;
-    }
+    return Boolean.compare((boolean) key1, (boolean) key2);
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/util/comparator/IntSerializableComparator.java b/core/src/main/java/org/apache/carbondata/core/util/comparator/IntSerializableComparator.java
index 9d02a0e..b86705e 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/comparator/IntSerializableComparator.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/comparator/IntSerializableComparator.java
@@ -27,12 +27,6 @@ public class IntSerializableComparator implements SerializableComparator {
     } else if (key2 == null) {
       return 1;
     }
-    if ((int) key1 < (int) key2) {
-      return -1;
-    } else if ((int) key1 > (int) key2) {
-      return 1;
-    } else {
-      return 0;
-    }
+    return Integer.compare((int) key1, (int) key2);
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/util/comparator/LongSerializableComparator.java b/core/src/main/java/org/apache/carbondata/core/util/comparator/LongSerializableComparator.java
index 3daafbe..017a61f 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/comparator/LongSerializableComparator.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/comparator/LongSerializableComparator.java
@@ -27,12 +27,6 @@ public class LongSerializableComparator implements SerializableComparator {
     } else if (key2 == null) {
       return 1;
     }
-    if ((long) key1 < (long) key2) {
-      return -1;
-    } else if ((long) key1 > (long) key2) {
-      return 1;
-    } else {
-      return 0;
-    }
+    return Long.compare((long) key1, (long) key2);
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/util/comparator/ShortSerializableComparator.java b/core/src/main/java/org/apache/carbondata/core/util/comparator/ShortSerializableComparator.java
index 8f8fff7..03062e6 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/comparator/ShortSerializableComparator.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/comparator/ShortSerializableComparator.java
@@ -27,12 +27,6 @@ public class ShortSerializableComparator implements SerializableComparator {
     } else if (key2 == null) {
       return 1;
     }
-    if ((short) key1 < (short) key2) {
-      return -1;
-    } else if ((short) key1 > (short) key2) {
-      return 1;
-    } else {
-      return 0;
-    }
+    return Short.compare((short) key1, (short) key2);
   }
 }
diff --git a/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java b/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
index 45f16ca..56d407d 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
@@ -557,7 +557,7 @@ public class CarbonTablePath {
     public static String getFileName(String dataFilePath) {
       int endIndex = dataFilePath.lastIndexOf(CarbonCommonConstants.FILE_SEPARATOR);
       if (endIndex > -1) {
-        return dataFilePath.substring(endIndex + 1, dataFilePath.length());
+        return dataFilePath.substring(endIndex + 1);
       } else {
         return dataFilePath;
       }
diff --git a/core/src/main/java/org/apache/carbondata/core/writer/CarbonIndexFileMergeWriter.java b/core/src/main/java/org/apache/carbondata/core/writer/CarbonIndexFileMergeWriter.java
index 35ef958..1fbe4cb 100644
--- a/core/src/main/java/org/apache/carbondata/core/writer/CarbonIndexFileMergeWriter.java
+++ b/core/src/main/java/org/apache/carbondata/core/writer/CarbonIndexFileMergeWriter.java
@@ -144,10 +144,9 @@ public class CarbonIndexFileMergeWriter {
       folderDetails = new SegmentFileStore.FolderDetails();
       folderDetails.setMergeFileName(mergeIndexFile);
       folderDetails.setStatus("Success");
-      List<String> partitions = new ArrayList<>();
       if (partitionPath.startsWith(tablePath)) {
-        partitionPath = partitionPath.substring(tablePath.length() + 1, partitionPath.length());
-        partitions.addAll(Arrays.asList(partitionPath.split("/")));
+        partitionPath = partitionPath.substring(tablePath.length() + 1);
+        List<String> partitions = new ArrayList<>(Arrays.asList(partitionPath.split("/")));
 
         folderDetails.setPartitions(partitions);
         folderDetails.setRelative(true);
diff --git a/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java b/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java
index 5d0e4b5..3314aaf 100644
--- a/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java
+++ b/core/src/main/java/org/apache/carbondata/core/writer/ThriftWriter.java
@@ -100,10 +100,7 @@ public class ThriftWriter {
    * @return
    */
   public boolean isOpen() {
-    if (null != binaryOut && null != dataOutputStream) {
-      return true;
-    }
-    return false;
+    return null != binaryOut && null != dataOutputStream;
   }
 
   /**
diff --git a/core/src/main/java/org/apache/carbondata/hadoop/CarbonInputSplit.java b/core/src/main/java/org/apache/carbondata/hadoop/CarbonInputSplit.java
index 3809609..f73fb6c 100644
--- a/core/src/main/java/org/apache/carbondata/hadoop/CarbonInputSplit.java
+++ b/core/src/main/java/org/apache/carbondata/hadoop/CarbonInputSplit.java
@@ -524,10 +524,7 @@ public class CarbonInputSplit extends FileSplit
     } else {
       compareResult = filePath1.compareTo(filePath2);
     }
-    if (compareResult != 0) {
-      return compareResult;
-    }
-    return 0;
+    return compareResult;
   }
 
   @Override


Mime
View raw message