integration/presto/src/main/prestodb/org/apache/carbondata/presto/impl/CarbonTableReader.java [244:287]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void refreshIndexInfo(CarbonTable carbonTable, Configuration config) {
    Map<String, Map<String, Map<String, String>>> indexTableMap = new ConcurrentHashMap<>();
    String indexInfo = config.get("indexInfo", IndexTableInfo.toGson(new IndexTableInfo[0]));
    String parentTableName = config.get("parentTableName", "");
    String parentTableId = config.get("parentTableId", "");
    String parentTablePath = config.get("parentTablePath", "");
    boolean isIndexTable = Boolean.getBoolean(config.get("isIndexTable", "false"));
    IndexTableInfo[] indexTableInfos = IndexTableInfo.fromGson(indexInfo);
    for (IndexTableInfo indexTableInfo : indexTableInfos) {
      Map<String, String> indexProperties = indexTableInfo.getIndexProperties();
      String indexProvider;
      if (indexProperties != null) {
        indexProvider = indexProperties.get(CarbonCommonConstants.INDEX_PROVIDER);
      } else {
        // in case if SI table has been created before the change CARBONDATA-3765,
        // indexProperties variable will not be present. On direct upgrade of SI store,
        // indexProperties will be null, in that case, create indexProperties from indexCols
        // For details, refer
        // {@link org.apache.spark.sql.secondaryindex.hive.CarbonInternalMetastore#refreshIndexInfo}
        indexProperties = new HashMap<>();
        indexProperties.put(CarbonCommonConstants.INDEX_COLUMNS,
            String.join(",", indexTableInfo.getIndexCols()));
        indexProvider = IndexType.SI.getIndexProviderName();
        indexProperties.put(CarbonCommonConstants.INDEX_PROVIDER, indexProvider);
        indexProperties.put(CarbonCommonConstants.INDEX_STATUS, IndexStatus.DISABLED.name());
      }
      if (indexTableMap.get(indexProvider) == null) {
        Map<String, Map<String, String>> indexTableInfoMap = new HashMap<>();
        indexTableInfoMap.put(indexTableInfo.getTableName(), indexProperties);
        indexTableMap.put(indexProvider, indexTableInfoMap);
      } else {
        indexTableMap.get(indexProvider).put(indexTableInfo.getTableName(), indexProperties);
      }
    }
    IndexMetadata indexMetadata =
        new IndexMetadata(indexTableMap, parentTableName, isIndexTable, parentTablePath,
            parentTableId);
    try {
      carbonTable.getTableInfo().getFactTable().getTableProperties()
          .put(carbonTable.getCarbonTableIdentifier().getTableId(), indexMetadata.serialize());
    } catch (IOException e) {
      LOGGER.error("Error serializing index metadata", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



integration/presto/src/main/prestosql/org/apache/carbondata/presto/impl/CarbonTableReader.java [239:282]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private void refreshIndexInfo(CarbonTable carbonTable, Configuration config) {
    Map<String, Map<String, Map<String, String>>> indexTableMap = new ConcurrentHashMap<>();
    String indexInfo = config.get("indexInfo", IndexTableInfo.toGson(new IndexTableInfo[0]));
    String parentTableName = config.get("parentTableName", "");
    String parentTableId = config.get("parentTableId", "");
    String parentTablePath = config.get("parentTablePath", "");
    boolean isIndexTable = Boolean.getBoolean(config.get("isIndexTable", "false"));
    IndexTableInfo[] indexTableInfos = IndexTableInfo.fromGson(indexInfo);
    for (IndexTableInfo indexTableInfo : indexTableInfos) {
      Map<String, String> indexProperties = indexTableInfo.getIndexProperties();
      String indexProvider;
      if (indexProperties != null) {
        indexProvider = indexProperties.get(CarbonCommonConstants.INDEX_PROVIDER);
      } else {
        // in case if SI table has been created before the change CARBONDATA-3765,
        // indexProperties variable will not be present. On direct upgrade of SI store,
        // indexProperties will be null, in that case, create indexProperties from indexCols
        // For details, refer
        // {@link org.apache.spark.sql.secondaryindex.hive.CarbonInternalMetastore#refreshIndexInfo}
        indexProperties = new HashMap<>();
        indexProperties.put(CarbonCommonConstants.INDEX_COLUMNS,
            String.join(",", indexTableInfo.getIndexCols()));
        indexProvider = IndexType.SI.getIndexProviderName();
        indexProperties.put(CarbonCommonConstants.INDEX_PROVIDER, indexProvider);
        indexProperties.put(CarbonCommonConstants.INDEX_STATUS, IndexStatus.DISABLED.name());
      }
      if (indexTableMap.get(indexProvider) == null) {
        Map<String, Map<String, String>> indexTableInfoMap = new HashMap<>();
        indexTableInfoMap.put(indexTableInfo.getTableName(), indexProperties);
        indexTableMap.put(indexProvider, indexTableInfoMap);
      } else {
        indexTableMap.get(indexProvider).put(indexTableInfo.getTableName(), indexProperties);
      }
    }
    IndexMetadata indexMetadata =
        new IndexMetadata(indexTableMap, parentTableName, isIndexTable, parentTablePath,
            parentTableId);
    try {
      carbonTable.getTableInfo().getFactTable().getTableProperties()
          .put(carbonTable.getCarbonTableIdentifier().getTableId(), indexMetadata.serialize());
    } catch (IOException e) {
      LOGGER.error("Error serializing index metadata", e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



