本文整理汇总了Java中com.facebook.presto.spi.SchemaTablePrefix类的典型用法代码示例。如果您正苦于以下问题:Java SchemaTablePrefix类的具体用法?Java SchemaTablePrefix怎么用?Java SchemaTablePrefix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchemaTablePrefix类属于com.facebook.presto.spi包,在下文中一共展示了SchemaTablePrefix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
List<SchemaTableName> tableNames = prefix.getSchemaName() == null ? listTables(session, null) : ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
for (SchemaTableName tableName : tableNames) {
ConnectorTableMetadata tableMetadata = getTableMetadata(tableName);
// table can disappear during listing operation
if (tableMetadata != null) {
columns.put(tableName, tableMetadata.getColumns());
}
}
return columns.build();
}
示例2: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
KuduClient kuduClient = kuduClientManager.getClient();
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
for (SchemaTableName tableName : listTables(session, prefix)) {
KuduTableHandle tableHandle = kuduTables.getTables(kuduClient).get(tableName);
if (tableHandle != null) {
columns.put(tableName, kuduTables.getColumns(kuduClient, tableHandle));
}
}
kuduClientManager.close(kuduClient);
return columns.build();
}
示例3: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getSchemaName() == null) {
tableNames = listTables(session, null);
}
else {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
for (SchemaTableName tableName : tableNames) {
ConnectorTableMetadata tableMetadata = getTableMetadata(tableName);
// table can disappear during listing operation
if (tableMetadata != null) {
columns.put(tableName, tableMetadata.getColumns());
}
}
return columns.build();
}
示例4: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
if (prefix.getSchemaName() != null && !prefix.getSchemaName().equals(SCHEMA_NAME)) {
return ImmutableMap.of();
}
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getTableName() == null) {
tableNames = listTables(session, prefix.getSchemaName());
}
else {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
for (SchemaTableName tableName : tableNames) {
JmxTableHandle tableHandle = getTableHandle(session, tableName);
columns.put(tableName, tableHandle.getTableMetadata().getColumns());
}
return columns.build();
}
示例5: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
for (SchemaTableName tableName : listTables(session, prefix.getSchemaName())) {
try {
JdbcTableHandle tableHandle = jdbcClient.getTableHandle(tableName);
if (tableHandle == null) {
continue;
}
columns.put(tableName, getTableMetadata(session, tableHandle).getColumns());
}
catch (TableNotFoundException e) {
// table disappeared during listing operation
}
}
return columns.build();
}
示例6: getViews
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<QualifiedObjectName, ViewDefinition> getViews(Session session, QualifiedTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
SchemaTablePrefix tablePrefix = prefix.asSchemaTablePrefix();
Map<QualifiedObjectName, ViewDefinition> views = new LinkedHashMap<>();
for (ConnectorEntry connectorEntry : allConnectorsFor(prefix.getCatalogName())) {
ConnectorMetadata metadata = connectorEntry.getMetadata(session);
ConnectorSession connectorSession = session.toConnectorSession(connectorEntry.getCatalog());
for (Entry<SchemaTableName, ConnectorViewDefinition> entry : metadata.getViews(connectorSession, tablePrefix).entrySet()) {
QualifiedObjectName viewName = new QualifiedObjectName(
prefix.getCatalogName(),
entry.getKey().getSchemaName(),
entry.getKey().getTableName());
views.put(viewName, deserializeView(entry.getValue().getViewData()));
}
}
return ImmutableMap.copyOf(views);
}
示例7: getViews
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, ConnectorViewDefinition> views = ImmutableMap.builder();
List<SchemaTableName> tableNames;
if (prefix.getTableName() != null) {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
else {
tableNames = listViews(session, prefix.getSchemaName());
}
for (SchemaTableName schemaTableName : tableNames) {
Optional<Table> table = metastore.getTable(schemaTableName.getSchemaName(), schemaTableName.getTableName());
if (table.isPresent() && HiveUtil.isPrestoView(table.get())) {
views.put(schemaTableName, new ConnectorViewDefinition(
schemaTableName,
Optional.ofNullable(table.get().getOwner()),
decodeViewData(table.get().getViewOriginalText())));
}
}
return views.build();
}
示例8: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
checkNotNull(prefix, "prefix is null");
log.debug("Called listTableColumns on %s.%s", prefix.getSchemaName(), prefix.getTableName());
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
// NOTE: prefix.getTableName or prefix.getSchemaName can be null
List<SchemaTableName> tableNames;
if (prefix.getSchemaName() != null && prefix.getTableName() != null) {
tableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
else {
tableNames = listTables(session, null);
}
for (SchemaTableName tableName : tableNames) {
ConnectorTableMetadata tableMetadata = getTableMetadata(tableName);
if (tableMetadata != null) {
columns.put(tableName, tableMetadata.getColumns());
}
}
return columns.build();
}
示例9: listTables
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
public List<SchemaTableName> listTables(SchemaTablePrefix prefix)
{
log.info("List all tables with prefix " + prefix.toString());
List<SchemaTableName> tables = new ArrayList<>();
String dbPrefix = prefix.getSchemaName();
log.debug("listTables dbPrefix: " + dbPrefix);
String tblPrefix = prefix.getTableName();
log.debug("listTables tblPrefix: " + tblPrefix);
// if dbPrefix not mean to match all
String tblName;
String dbName;
if (dbPrefix != null) {
if (tblPrefix != null) {
tblName = tblPrefix;
dbName = dbPrefix;
}
else {
MetaProto.StringListType stringListType = metaClient.listTables(dbPrefix);
log.info("record size: " + stringListType.getStrCount());
if (stringListType.getStrCount() == 0) {
return tables;
}
for (int i = 0; i < stringListType.getStrCount(); i++) {
tblName = stringListType.getStr(0);
dbName = dbPrefix;
log.debug("listTables tableName: " + formName(dbName, tblName));
tables.add(new SchemaTableName(dbName, tblName));
}
}
}
return tables;
}
示例10: listTables
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
/**
* List table names, possibly filtered by schema. An empty list is returned if none match.
*
* @param session session
* @param schemaNameOrNull schema name
*/
@Override
public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull)
{
if (schemaNameOrNull == null) {
return new ArrayList<>();
}
return metaDataQuery.listTables(new SchemaTablePrefix(schemaNameOrNull));
}
示例11: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
/**
* Gets the metadata for all columns that match the specified table prefix.
*
* @param session session
* @param prefix prefix
*/
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
Map<SchemaTableName, List<ColumnMetadata>> tableColumns = new HashMap<>();
List<SchemaTableName> tableNames = metaDataQuery.listTables(prefix);
for (SchemaTableName table : tableNames) {
List<ColumnMetadata> columnMetadatas = metaDataQuery.getTableColMetadata(connectorId, table.getSchemaName(),
table.getTableName()).orElse(new ArrayList<>());
tableColumns.putIfAbsent(table, columnMetadatas);
}
return tableColumns;
}
示例12: listTables
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
private List<SchemaTableName> listTables(ConnectorSession session, SchemaTablePrefix prefix)
{
if (prefix.getSchemaName() == null) {
return listTables(session, prefix.getSchemaName());
}
return ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
}
示例13: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
for (SchemaTableName tableName : listTables(session, prefix)) {
ConnectorTableMetadata tableMetadata = getTableMetadata(tableName);
// table can disappear during listing operation
if (tableMetadata != null) {
columns.put(tableName, tableMetadata.getColumns());
}
}
return columns.build();
}
示例14: listTableColumns
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
requireNonNull(prefix, "prefix is null");
ImmutableListMultimap.Builder<SchemaTableName, ColumnMetadata> columns = ImmutableListMultimap.builder();
for (TableColumn tableColumn : dao.listTableColumns(prefix.getSchemaName(), prefix.getTableName())) {
if (tableColumn.getColumnName().equals(SAMPLE_WEIGHT_COLUMN_NAME)) {
continue;
}
ColumnMetadata columnMetadata = new ColumnMetadata(tableColumn.getColumnName(), tableColumn.getDataType(), false);
columns.put(tableColumn.getTable(), columnMetadata);
}
return Multimaps.asMap(columns.build());
}
示例15: getViews
import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
{
ImmutableMap.Builder<SchemaTableName, ConnectorViewDefinition> map = ImmutableMap.builder();
for (ViewResult view : dao.getViews(prefix.getSchemaName(), prefix.getTableName())) {
map.put(view.getName(), new ConnectorViewDefinition(view.getName(), Optional.empty(), view.getData()));
}
return map.build();
}