@Override public void run() { physicalTableDictionary.values().stream() .map(PhysicalTable::getDataSourceNames) .flatMap(Set::stream) .distinct() .peek(dataSourceName -> LOG.trace("Querying metadata for datasource: {}", dataSourceName)) .forEach(this::queryDataSourceMetadata); lastRunTimestamp.set(DateTime.now()); }
/** * DruidDimensionRowProvider fetches data from Druid and adds it to the dimension cache. * The dimensions to be loaded can be passed in as a parameter. * * @param physicalTableDictionary The physical tables * @param dimensionDictionary The dimension dictionary to load dimensions from. * @param dimensionsToLoad The dimensions to use. * @param druidWebService The druid webservice to query. */ public DruidDimensionValueLoader( PhysicalTableDictionary physicalTableDictionary, DimensionDictionary dimensionDictionary, List<String> dimensionsToLoad, DruidWebService druidWebService ) { this.dimensions = dimensionsToLoad.stream() .map(dimensionDictionary::findByApiName) .collect(Collectors.toCollection(LinkedHashSet::new)); this.dataSources = physicalTableDictionary.values().stream() .map(table -> table.withConstraint(DataSourceConstraint.unconstrained(table))) .map(TableDataSource::new) .collect(Collectors.toCollection(LinkedHashSet::new)); this.druidWebService = druidWebService; }
/** * SqlDimensionValueLoader fetches data from Sql and adds it to the dimension cache. * The dimensions to be loaded can be passed in as a parameter. * * @param physicalTableDictionary The physical tables * @param dimensionDictionary The dimension dictionary to load dimensions from. * @param dimensionsToLoad The dimensions to be loaded. * @param sqlBackedClient The sql backed client. */ public SqlDimensionValueLoader( PhysicalTableDictionary physicalTableDictionary, DimensionDictionary dimensionDictionary, List<String> dimensionsToLoad, SqlBackedClient sqlBackedClient ) { this.dimensions = dimensionsToLoad.stream() .map(dimensionDictionary::findByApiName) .collect(Collectors.toCollection(LinkedHashSet::new)); this.dataSources = physicalTableDictionary.values().stream() .map(table -> table.withConstraint(DataSourceConstraint.unconstrained(table))) .map(TableDataSource::new) .collect(Collectors.toCollection(LinkedHashSet::new)); this.sqlBackedClient = sqlBackedClient; }