本文整理了Java中com.facebook.presto.metadata.Metadata.listViews()
方法的一些代码示例,展示了Metadata.listViews()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.listViews()
方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:listViews
[英]Get the names that match the specified table prefix (never null).
[中]
代码示例来源:origin: prestodb/presto
public static Set<SchemaTableName> listViews(Session session, Metadata metadata, AccessControl accessControl, QualifiedTablePrefix prefix)
{
Set<SchemaTableName> tableNames = metadata.listViews(session, prefix).stream()
.map(QualifiedObjectName::asSchemaTableName)
.collect(toImmutableSet());
return accessControl.filterTables(session.getRequiredTransactionId(), session.getIdentity(), prefix.getCatalogName(), tableNames);
}
代码示例来源:origin: prestodb/presto
public Set<QualifiedTablePrefix> calculatePrefixesWithTableName(
ConnectorSession connectorSession,
Set<QualifiedTablePrefix> prefixes,
TupleDomain<ColumnHandle> constraint,
Optional<Predicate<Map<ColumnHandle, NullableValue>>> predicate)
{
Session session = ((FullConnectorSession) connectorSession).getSession();
Optional<Set<String>> tables = filterString(constraint, TABLE_NAME_COLUMN_HANDLE);
if (tables.isPresent()) {
return prefixes.stream()
.flatMap(prefix -> tables.get().stream()
.filter(this::isLowerCase)
.map(table -> table.toLowerCase(ENGLISH))
.map(table -> new QualifiedObjectName(catalogName, prefix.getSchemaName().get(), table)))
.filter(objectName -> metadata.getTableHandle(session, objectName).isPresent() || metadata.getView(session, objectName).isPresent())
.map(QualifiedObjectName::asQualifiedTablePrefix)
.collect(toImmutableSet());
}
return prefixes.stream()
.flatMap(prefix -> Stream.concat(
metadata.listTables(session, prefix).stream(),
metadata.listViews(session, prefix).stream()))
.filter(objectName -> !predicate.isPresent() || predicate.get().test(asFixedValues(objectName)))
.map(QualifiedObjectName::asQualifiedTablePrefix)
.collect(toImmutableSet());
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
private List<QualifiedObjectName> getViewsList(Session session, String catalogName, Map<String, NullableValue> filters)
{
return metadata.listViews(session, extractQualifiedTablePrefix(catalogName, filters));
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint)
{
GlobalSystemTransactionHandle transaction = checkType(transactionHandle, GlobalSystemTransactionHandle.class, "transaction");
Session session = toSession(transaction.getTransactionId(), connectorSession);
Optional<String> catalogFilter = stringFilter(constraint, 0);
Optional<String> schemaFilter = stringFilter(constraint, 1);
Optional<String> tableFilter = stringFilter(constraint, 2);
Optional<String> typeFilter = stringFilter(constraint, 3);
Builder table = InMemoryRecordSet.builder(METADATA);
for (String catalog : filter(metadata.getCatalogNames().keySet(), catalogFilter)) {
QualifiedTablePrefix prefix = tablePrefix(catalog, schemaFilter, tableFilter);
if (FilterUtil.emptyOrEquals(typeFilter, "TABLE")) {
for (QualifiedObjectName name : metadata.listTables(session, prefix)) {
table.addRow(tableRow(name, "TABLE"));
}
}
if (FilterUtil.emptyOrEquals(typeFilter, "VIEW")) {
for (QualifiedObjectName name : metadata.listViews(session, prefix)) {
table.addRow(tableRow(name, "VIEW"));
}
}
}
return table.build().cursor();
}
内容来源于网络,如有侵权,请联系作者删除!