/** * {@inheritDoc} */ @Override public List<String> get_databases(final String hivePattern) throws TException { return requestWrapper("get_databases", new Object[]{hivePattern}, () -> { List<String> result = v1.getCatalog(catalogName).getDatabases(); if (hivePattern != null) { // Unsure about the pattern format. I couldn't find any tests. Assuming it is regex. final Pattern pattern = PATTERNS.getUnchecked("(?i)" + hivePattern.replaceAll("\\*", ".*")); result = result.stream().filter(name -> pattern.matcher(name).matches()) .collect(Collectors.toList()); } return result; }); }
/** * {@inheritDoc} */ @Override public List<String> get_databases(final String hivePattern) throws TException { return requestWrapper("get_databases", new Object[]{hivePattern}, () -> { List<String> result = v1.getCatalog(catalogName).getDatabases(); if (hivePattern != null) { // Unsure about the pattern format. I couldn't find any tests. Assuming it is regex. final Pattern pattern = PATTERNS.getUnchecked("(?i)" + hivePattern.replaceAll("\\*", ".*")); result = result.stream().filter(name -> pattern.matcher(name).matches()) .collect(Collectors.toList()); } return result; }); }
/** * {@inheritDoc} */ @Override public List<String> get_all_databases() throws TException { return requestWrapper("get_all_databases", new Object[]{}, () -> v1.getCatalog(catalogName).getDatabases()); }
/** * {@inheritDoc} */ @Override public List<String> get_all_databases() throws TException { return requestWrapper("get_all_databases", new Object[]{}, () -> v1.getCatalog(catalogName).getDatabases()); }
private List<QualifiedName> getDatabaseNamesToRefresh(final CatalogDto catalogDto) { List<QualifiedName> result = null; if (!config.getElasticSearchRefreshIncludeDatabases().isEmpty()) { result = config.getElasticSearchRefreshIncludeDatabases().stream() .filter(q -> catalogDto.getName().getCatalogName().equals(q.getCatalogName())) .collect(Collectors.toList()); } else { result = catalogDto.getDatabases().stream() .map(n -> QualifiedName.ofDatabase(catalogDto.getName().getCatalogName(), n)) .collect(Collectors.toList()); } if (!config.getElasticSearchRefreshExcludeQualifiedNames().isEmpty()) { result.removeAll(config.getElasticSearchRefreshExcludeQualifiedNames()); } return result; }
/** * {@inheritDoc} */ @Override public boolean exists(final QualifiedName name) { final CatalogDto catalogDto = catalogService.get(QualifiedName.ofCatalog(name.getCatalogName())); return catalogDto.getDatabases().contains(name.getDatabaseName()); }