Collection<Resource> missingResources = Lists.newArrayList();
Map<Resource, Collection<SecondaryIndex>> indexMap = Maps.newHashMap();
for(EntityConfig config : updater.getEntityConfigs()) {
try {
Resource resource = hive.getPartitionDimension().getResource(config.getResourceName());
for(EntityIndexConfig indexConfig : getHiveIndexes(config)) {
try {
resource.getSecondaryIndex(indexConfig.getIndexName());
} catch(HiveKeyNotFoundException ex) {
if(!indexMap.containsKey(resource))
indexMap.put(resource, new ArrayList<SecondaryIndex>());
indexMap.get(resource).add(configToIndex().f(indexConfig));
}
}
} catch(HiveKeyNotFoundException e) {
Resource resource = new Resource(
config.getResourceName(),
JdbcTypeMapper.primitiveTypeToJdbcType(config.getIdClass()),
config.isPartitioningResource());
missingResources.add(resource);
indexMap.put(resource, Transform.map(configToIndex(), config.getEntityIndexConfigs()));