/** * It only gives the visible datamaps */ List<TableDataMap> getAllVisibleDataMap(CarbonTable carbonTable) throws IOException { CarbonSessionInfo sessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); List<TableDataMap> allDataMaps = getAllDataMap(carbonTable); Iterator<TableDataMap> dataMapIterator = allDataMaps.iterator(); while (dataMapIterator.hasNext()) { TableDataMap 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; }
/** * returns session property value * * @param key * @return */ private String getSessionPropertyValue(String key) { String value = null; CarbonSessionInfo carbonSessionInfo = ThreadLocalSessionInfo.getCarbonSessionInfo(); if (null != carbonSessionInfo) { SessionParams sessionParams = ThreadLocalSessionInfo.getCarbonSessionInfo().getSessionParams(); if (null != sessionParams) { value = sessionParams.getProperty(key); } } return value; }
CarbonInputFormat.setValidateSegmentsToAccess( conf, Boolean.valueOf(carbonSessionInfo.getThreadParams().getProperty( validateInputSegmentsKey, "true"))); String queryOnPreAggStreamingKey = CarbonCommonConstantsInternal.QUERY_ON_PRE_AGG_STREAMING + tableUniqueKey; boolean queryOnPreAggStreaming = Boolean.valueOf(carbonSessionInfo.getThreadParams() .getProperty(queryOnPreAggStreamingKey, "false")); String inputSegmentsKey = CarbonCommonConstants.CARBON_INPUT_SEGMENTS + tableUniqueKey; CarbonInputFormat.setValidateSegmentsToAccess(conf, Boolean.valueOf(carbonSessionInfo.getThreadParams() .getProperty(validateInputSegmentsKey, "true"))); CarbonInputFormat.setQuerySegment( conf, carbonSessionInfo.getThreadParams().getProperty( inputSegmentsKey, CarbonProperties.getInstance().getProperty(inputSegmentsKey, "*")));