• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SchemaTablePrefix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.presto.spi.SchemaTablePrefix的典型用法代码示例。如果您正苦于以下问题:Java SchemaTablePrefix类的具体用法?Java SchemaTablePrefix怎么用?Java SchemaTablePrefix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SchemaTablePrefix类属于com.facebook.presto.spi包,在下文中一共展示了SchemaTablePrefix类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:19,代码来源:EthereumMetadata.java


示例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();
}
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:17,代码来源:KuduMetadata.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:RedisMetadata.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:JmxMetadata.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:JdbcMetadata.java


示例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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:MetadataManager.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:HiveMetadata.java


示例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();
}
 
开发者ID:qubole,项目名称:presto-kinesis,代码行数:26,代码来源:KinesisMetadata.java


示例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;
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:34,代码来源:MetaDataQuery.java


示例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));
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:15,代码来源:HDFSMetadata.java


示例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;
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:19,代码来源:HDFSMetadata.java


示例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()));
}
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:8,代码来源:KuduMetadata.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:15,代码来源:ExampleMetadata.java


示例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());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:16,代码来源:RaptorMetadata.java


示例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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:RaptorMetadata.java


示例16: testListTableColumns

import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Test
public void testListTableColumns()
{
    metadata.createTable(SESSION, getOrdersTable());
    Map<SchemaTableName, List<ColumnMetadata>> columns = metadata.listTableColumns(SESSION, new SchemaTablePrefix());
    assertEquals(columns, ImmutableMap.of(DEFAULT_TEST_ORDERS, getOrdersTable().getColumns()));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:TestRaptorMetadata.java


示例17: testListTableColumnsFiltering

import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Test
public void testListTableColumnsFiltering()
{
    metadata.createTable(SESSION, getOrdersTable());
    Map<SchemaTableName, List<ColumnMetadata>> filterCatalog = metadata.listTableColumns(SESSION, new SchemaTablePrefix());
    Map<SchemaTableName, List<ColumnMetadata>> filterSchema = metadata.listTableColumns(SESSION, new SchemaTablePrefix("test"));
    Map<SchemaTableName, List<ColumnMetadata>> filterTable = metadata.listTableColumns(SESSION, new SchemaTablePrefix("test", "orders"));
    assertEquals(filterCatalog, filterSchema);
    assertEquals(filterCatalog, filterTable);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:TestRaptorMetadata.java


示例18: testViews

import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Test
public void testViews()
{
    SchemaTableName test1 = new SchemaTableName("test", "test_view1");
    SchemaTableName test2 = new SchemaTableName("test", "test_view2");

    // create views
    metadata.createView(SESSION, test1, "test1", false);
    metadata.createView(SESSION, test2, "test2", false);

    // verify listing
    List<SchemaTableName> list = metadata.listViews(SESSION, "test");
    assertEqualsIgnoreOrder(list, ImmutableList.of(test1, test2));

    // verify getting data
    Map<SchemaTableName, ConnectorViewDefinition> views = metadata.getViews(SESSION, new SchemaTablePrefix("test"));
    assertEquals(views.keySet(), ImmutableSet.of(test1, test2));
    assertEquals(views.get(test1).getViewData(), "test1");
    assertEquals(views.get(test2).getViewData(), "test2");

    // drop first view
    metadata.dropView(SESSION, test1);

    views = metadata.getViews(SESSION, new SchemaTablePrefix("test"));
    assertEquals(views.keySet(), ImmutableSet.of(test2));

    // drop second view
    metadata.dropView(SESSION, test2);

    views = metadata.getViews(SESSION, new SchemaTablePrefix("test"));
    assertTrue(views.isEmpty());

    // verify listing everything
    views = metadata.getViews(SESSION, new SchemaTablePrefix());
    assertTrue(views.isEmpty());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:37,代码来源:TestRaptorMetadata.java


示例19: listTableColumns

import com.facebook.presto.spi.SchemaTablePrefix; //导入依赖的package包/类
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
    return tables.values().stream()
            .filter(table -> prefix.matches(table.toSchemaTableName()))
            .collect(toMap(BlackHoleTableHandle::toSchemaTableName, handle -> handle.toTableMetadata().getColumns()));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:BlackHoleMetadata.java


示例20: 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>> builder = ImmutableMap.builder();
    for (Entry<SchemaTableName, ConnectorTableMetadata> entry : TABLES.entrySet()) {
        if (prefix.matches(entry.getKey())) {
            builder.put(entry.getKey(), entry.getValue().getColumns());
        }
    }
    return builder.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:InformationSchemaMetadata.java



注:本文中的com.facebook.presto.spi.SchemaTablePrefix类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConnectionReleaseTrigger类代码示例发布时间:2022-05-22
下一篇:
Java LazyString类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap