Github user manishgupta88 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2654#discussion_r214352965 --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/page/encoding/DefaultEncodingFactory.java --- @@ -346,12 +371,21 @@ static ColumnPageCodec selectCodecByAlgorithmForDecimal(SimpleStatsResult stats, // no effect to use adaptive or delta, use compression only return new DirectCompressCodec(stats.getDataType()); } + boolean isSort = false; + boolean isInvertedIndex = false; + if (columnSpec instanceof TableSpec.DimensionSpec + && columnSpec.getColumnType() != ColumnType.COMPLEX_PRIMITIVE) { + isSort = ((TableSpec.DimensionSpec) columnSpec).isInSortColumns(); + isInvertedIndex = isSort && ((TableSpec.DimensionSpec) columnSpec).isDoInvertedIndex(); + } --- End diff -- Put the above changes in one method as the same code is used in above places also and then call this method while creating the encoding type
---