[CARBONDATA-4278] Avoid refetching all indexes to get segment properties
authorMahesh Raju Somalaraju <mahesh.somalaraju@huawei.com>
Mon, 23 Aug 2021 14:18:09 +0000 (19:48 +0530)
committerajantha-bhat <ajanthabhat@gmail.com>
Wed, 1 Sep 2021 10:54:07 +0000 (16:24 +0530)
commit226228f7474f4083d78b7bd8facb4ec1a41bfd56
treea8b8b1261674a1b3a0337acf3c99e22ff2278ca3
parent42f69827e0a577b6128417104c0a49cd5bf21ad7
[CARBONDATA-4278] Avoid refetching all indexes to get segment properties

Why is this PR needed?
When block index[BlockIndex] is available then no need to prepare indexes[List[BlockIndex] from available segments and partition locations which might cause delay in query performance.

What changes were proposed in this PR?
Call directly get segment properties if block index[BlockIndex] available.

      if (segmentIndices.get(0) instanceof BlockIndex) {
        segmentProperties =
            segmentPropertiesFetcher.getSegmentPropertiesFromIndex(segmentIndices.get(0));
      } else {
        segmentProperties =
            segmentPropertiesFetcher.getSegmentProperties(segment, partitionLocations);
      }
getSegmentPropertiesFromIndex is calling directly block index segment properties.

Does this PR introduce any user interface change?
No

Is any new testcase added?
No. Already index related test cases are present which can cover the added code.

This closes #4209
core/src/main/java/org/apache/carbondata/core/index/TableIndex.java