ajantha-bhat commented on a change in pull request #3688: [CARBONDATA-3765]
Refactor Index Metadata for CG and FG Indexes
URL: https://github.com/apache/carbondata/pull/3688#discussion_r405976891
##########
File path:
core/src/main/java/org/apache/carbondata/core/datamap/DataMapStoreManager.java
##########
@@ -101,49 +100,29 @@ private DataMapStoreManager() {
}
/**
- * It only gives the visible datamaps
- */
- List<TableIndex> getAllVisibleIndexes(CarbonTable carbonTable) throws
IOException {
- CarbonSessionInfo sessionInfo =
ThreadLocalSessionInfo.getCarbonSessionInfo();
- List<TableIndex> allDataMaps = getAllIndexes(carbonTable);
- Iterator<TableIndex> dataMapIterator = allDataMaps.iterator();
- while (dataMapIterator.hasNext()) {
- TableIndex dataMap = dataMapIterator.next();
- String dbName = carbonTable.getDatabaseName();
- String tableName = carbonTable.getTableName();
- String dmName = dataMap.getDataMapSchema().getDataMapName();
- // TODO: need support get the visible status of datamap without
sessionInfo in the future
- if (sessionInfo != null) {
- boolean isDmVisible = sessionInfo.getSessionParams().getProperty(
- String.format("%s%s.%s.%s",
CarbonCommonConstants.CARBON_DATAMAP_VISIBLE,
- dbName, tableName, dmName),
"true").trim().equalsIgnoreCase("true");
- if (!isDmVisible) {
- LOGGER.warn(String.format("Ignore invisible datamap %s on table
%s.%s",
- dmName, dbName, tableName));
- dataMapIterator.remove();
- }
- } else {
- String message = "Carbon session info is null";
- LOGGER.info(message);
- }
- }
- return allDataMaps;
- }
-
- /**
- * It gives all indexes except the default index.
+ * It gives all indexes except the default index and secondary index.
+ * Collect's Coarse grain and Fine grain indexes on a table
*
* @return
*/
public List<TableIndex> getAllIndexes(CarbonTable carbonTable) throws
IOException {
- List<DataMapSchema> dataMapSchemas = getDataMapSchemasOfTable(carbonTable);
+ String indexMeta =
carbonTable.getTableInfo().getFactTable().getTableProperties()
+ .get(carbonTable.getCarbonTableIdentifier().getTableId());
+ IndexMetadata indexMetadata = IndexMetadata.deserialize(indexMeta);
List<TableIndex> indexes = new ArrayList<>();
- if (dataMapSchemas != null) {
- for (DataMapSchema dataMapSchema : dataMapSchemas) {
- RelationIdentifier identifier = dataMapSchema.getParentTables().get(0);
- if (dataMapSchema.isIndex() && identifier.getTableId()
- .equals(carbonTable.getTableId())) {
- indexes.add(getIndex(carbonTable, dataMapSchema));
+ if (null != indexMetadata) {
+ // get bloom indexes and lucene indexes
+ for (Map.Entry<String, Map<String, Map<String, String>>> providerEntry :
indexMetadata
+ .getIndexesMap().entrySet()) {
+ for (Map.Entry<String, Map<String, String>> indexEntry :
providerEntry.getValue()
+ .entrySet()) {
+ if (!indexEntry.getValue().get(CarbonCommonConstants.INDEX_PROVIDER)
Review comment:
we are sending bloom and lucene to SI flow. But SI is still not like boom
and lucene. So we are excluding here. This is causing multiple branches inside
index again. we need to unify this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services