static Collection<String> getAllDataSourceNames(SQLMetadataConnector connector,
      final MetadataStorageTablesConfig metadataStorageTablesConfig) {
    return connector.getDBI()
        .withHandle((HandleCallback<List<String>>) handle -> handle.createQuery(String.format(
            "SELECT DISTINCT(datasource) FROM %s WHERE used = true",
            metadataStorageTablesConfig.getSegmentsTable()))
            .fold(Lists.<String>newArrayList(),
                (druidDataSources, stringObjectMap, foldController, statementContext) -> {
                  druidDataSources.add(MapUtils.getString(stringObjectMap, "datasource"));
                  return druidDataSources;
                }));
  }
@param connector                   SQL metadata connector to the metadata storage
@param metadataStorageTablesConfig Table config
@return all the active data sources in the metadata storage
druid-handler/src/java/org/apache/hadoop/hive/druid/DruidStorageHandlerUtils.java