本文整理了Java中com.facebook.presto.metadata.Metadata.listTableColumns()
方法的一些代码示例,展示了Metadata.listTableColumns()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.listTableColumns()
方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:listTableColumns
[英]Gets the metadata for all columns that match the specified table prefix.
[中]获取与指定表前缀匹配的所有列的元数据。
代码示例来源:origin: prestodb/presto
public static Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(Session session, Metadata metadata, AccessControl accessControl, QualifiedTablePrefix prefix)
{
Map<SchemaTableName, List<ColumnMetadata>> tableColumns = metadata.listTableColumns(session, prefix).entrySet().stream()
.collect(toImmutableMap(entry -> entry.getKey().asSchemaTableName(), Entry::getValue));
Set<SchemaTableName> allowedTables = accessControl.filterTables(
session.getRequiredTransactionId(),
session.getIdentity(),
prefix.getCatalogName(),
tableColumns.keySet());
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> result = ImmutableMap.builder();
for (Entry<SchemaTableName, List<ColumnMetadata>> entry : tableColumns.entrySet()) {
if (allowedTables.contains(entry.getKey())) {
result.put(entry);
}
}
return result.build();
}
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
private Map<QualifiedObjectName, List<ColumnMetadata>> getColumnsList(Session session, String catalogName, Map<String, NullableValue> filters)
{
return metadata.listTableColumns(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);
Builder table = InMemoryRecordSet.builder(METADATA);
for (String catalog : filter(metadata.getCatalogNames().keySet(), catalogFilter)) {
QualifiedTablePrefix prefix = FilterUtil.tablePrefix(catalog, schemaFilter, tableFilter);
for (Entry<QualifiedObjectName, List<ColumnMetadata>> entry : metadata.listTableColumns(session, prefix).entrySet()) {
addColumnRows(table, entry.getKey(), entry.getValue());
}
}
return table.build().cursor();
}
内容来源于网络,如有侵权,请联系作者删除!