当前位置: 首页>>代码示例>>Java>>正文


Java SchemaTableName.getSchemaName方法代码示例

本文整理汇总了Java中com.facebook.presto.spi.SchemaTableName.getSchemaName方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaTableName.getSchemaName方法的具体用法?Java SchemaTableName.getSchemaName怎么用?Java SchemaTableName.getSchemaName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.presto.spi.SchemaTableName的用法示例。


在下文中一共展示了SchemaTableName.getSchemaName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHistory

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private History getHistory(SchemaTableName schemaTableName)
{
    String schemaName = schemaTableName.getSchemaName();
    try {
        if (CHANNEL_SCHEMA.equalsIgnoreCase(schemaName)) {
            return service.channelHistory(token, getChannelId(schemaTableName))
                    .execute()
                    .body();
        }
        if (IM_SCHEMA.equalsIgnoreCase(schemaName)) {
            return service.imHistory(token, getChannelId(schemaTableName))
                    .execute()
                    .body();
        }
    }
    catch (IOException e) {
        throw Throwables.propagate(e);
    }
    return new History(true, "no such schema", ImmutableList.of());
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:21,代码来源:SlackRest.java

示例2: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private ConnectorTableHandle getTableHandle(SchemaTableName tableName)
{
    requireNonNull(tableName, "tableName is null");
    Table table = dao.getTableInformation(tableName.getSchemaName(), tableName.getTableName());
    if (table == null) {
        return null;
    }
    List<TableColumn> tableColumns = dao.getTableColumns(table.getTableId());
    checkArgument(!tableColumns.isEmpty(), "Table %s does not have any columns", tableName);

    RaptorColumnHandle sampleWeightColumnHandle = null;
    for (TableColumn tableColumn : tableColumns) {
        if (SAMPLE_WEIGHT_COLUMN_NAME.equals(tableColumn.getColumnName())) {
            sampleWeightColumnHandle = getRaptorColumnHandle(tableColumn);
        }
    }

    return new RaptorTableHandle(
            connectorId,
            tableName.getSchemaName(),
            tableName.getTableName(),
            table.getTableId(),
            OptionalLong.empty(),
            Optional.ofNullable(sampleWeightColumnHandle));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:RaptorMetadata.java

示例3: createView

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public void createView(ConnectorSession session, SchemaTableName viewName, String viewData, boolean replace)
{
    String schemaName = viewName.getSchemaName();
    String tableName = viewName.getTableName();

    if (replace) {
        runTransaction(dbi, (handle, status) -> {
            MetadataDao dao = handle.attach(MetadataDao.class);
            dao.dropView(schemaName, tableName);
            dao.insertView(schemaName, tableName, viewData);
            return null;
        });
        return;
    }

    try {
        dao.insertView(schemaName, tableName, viewData);
    }
    catch (PrestoException e) {
        if (viewExists(session, viewName)) {
            throw new PrestoException(ALREADY_EXISTS, "View already exists: " + viewName);
        }
        throw e;
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:RaptorMetadata.java

示例4: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public RedisTableHandle getTableHandle(ConnectorSession session, SchemaTableName schemaTableName)
{
    RedisTableDescription table = getDefinedTables().get(schemaTableName);
    if (table == null) {
        return null;
    }

    // check if keys are supplied in a zset
    // via the table description doc
    String keyName = null;
    if (table.getKey() != null) {
        keyName = table.getKey().getName();
    }

    return new RedisTableHandle(
            connectorId,
            schemaTableName.getSchemaName(),
            schemaTableName.getTableName(),
            getDataFormat(table.getKey()),
            getDataFormat(table.getValue()),
            keyName);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:RedisMetadata.java

示例5: loadTpchTableDescription

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, RedisTableDescription> loadTpchTableDescription(
        JsonCodec<RedisTableDescription> tableDescriptionJsonCodec,
        SchemaTableName schemaTableName,
        String dataFormat)
        throws IOException
{
    RedisTableDescription tpchTemplate;
    try (InputStream data = RedisTestUtils.class.getResourceAsStream(format("/tpch/%s/%s.json", dataFormat, schemaTableName.getTableName()))) {
        tpchTemplate = tableDescriptionJsonCodec.fromJson(ByteStreams.toByteArray(data));
    }

    RedisTableDescription tableDescription = new RedisTableDescription(
            schemaTableName.getTableName(),
            schemaTableName.getSchemaName(),
            tpchTemplate.getKey(),
            tpchTemplate.getValue());

    return new AbstractMap.SimpleImmutableEntry<>(schemaTableName, tableDescription);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:20,代码来源:RedisTestUtils.java

示例6: getTableMetadata

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private TableMetadata getTableMetadata(SchemaTableName schemaTableName)
{
    String schemaName = schemaTableName.getSchemaName();
    String tableName = schemaTableName.getTableName();

    KeyspaceMetadata keyspaceMetadata = getCheckedKeyspaceMetadata(schemaName);
    TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName);
    if (tableMetadata != null) {
        return tableMetadata;
    }

    for (TableMetadata table : keyspaceMetadata.getTables()) {
        if (table.getName().equalsIgnoreCase(tableName)) {
            return table;
        }
    }
    throw new TableNotFoundException(schemaTableName);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:CassandraSession.java

示例7: beginInsert

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public HiveInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle)
{
    verifyJvmTimeZone();

    SchemaTableName tableName = schemaTableName(tableHandle);
    Optional<Table> table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName());
    if (!table.isPresent()) {
        throw new TableNotFoundException(tableName);
    }

    checkTableIsWritable(table.get());

    HiveStorageFormat hiveStorageFormat = extractHiveStorageFormat(table.get());

    List<HiveColumnHandle> handles = hiveColumnHandles(connectorId, table.get());

    return new HiveInsertTableHandle(
            connectorId,
            tableName.getSchemaName(),
            tableName.getTableName(),
            handles,
            session.getQueryId(),
            locationService.forExistingTable(session.getQueryId(), table.get()),
            hiveStorageFormat);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:HiveMetadata.java

示例8: getChannelId

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
private String getChannelId(SchemaTableName schemaTableName)
{
    String schemaName = schemaTableName.getSchemaName();
    String tableName = schemaTableName.getTableName();
    if (CHANNEL_SCHEMA.equalsIgnoreCase(schemaName)) {
        return channels.get(tableName).getId();
    }
    if (IM_SCHEMA.equalsIgnoreCase(schemaName)) {
        String userId = users.get(tableName).getId();
        return ims.get(userId).getId();
    }
    throw new IllegalArgumentException("Unknown schema: " + schemaName);
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:14,代码来源:SlackRest.java

示例9: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public KafkaTableHandle getTableHandle(ConnectorSession session, SchemaTableName schemaTableName)
{
    KafkaTopicDescription table = tableDescriptions.get(schemaTableName);
    if (table == null) {
        return null;
    }

    return new KafkaTableHandle(connectorId,
            schemaTableName.getSchemaName(),
            schemaTableName.getTableName(),
            table.getTopicName(),
            getDataFormat(table.getKey()),
            getDataFormat(table.getMessage()));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:16,代码来源:KafkaMetadata.java

示例10: loadTpchTopicDescription

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, KafkaTopicDescription> loadTpchTopicDescription(JsonCodec<KafkaTopicDescription> topicDescriptionJsonCodec, String topicName, SchemaTableName schemaTableName)
        throws IOException
{
    KafkaTopicDescription tpchTemplate = topicDescriptionJsonCodec.fromJson(ByteStreams.toByteArray(TestUtils.class.getResourceAsStream(format("/tpch/%s.json", schemaTableName.getTableName()))));

    return new AbstractMap.SimpleImmutableEntry<>(
            schemaTableName,
            new KafkaTopicDescription(schemaTableName.getTableName(), schemaTableName.getSchemaName(), topicName, tpchTemplate.getKey(), tpchTemplate.getMessage()));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:TestUtils.java

示例11: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public ExampleTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
    if (!listSchemaNames(session).contains(tableName.getSchemaName())) {
        return null;
    }

    ExampleTable table = exampleClient.getTable(tableName.getSchemaName(), tableName.getTableName());
    if (table == null) {
        return null;
    }

    return new ExampleTableHandle(connectorId, tableName.getSchemaName(), tableName.getTableName());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:15,代码来源:ExampleMetadata.java

示例12: createEmptyTableDescription

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, RedisTableDescription> createEmptyTableDescription(SchemaTableName schemaTableName)
{
    RedisTableDescription tableDescription = new RedisTableDescription(
            schemaTableName.getTableName(),
            schemaTableName.getSchemaName(),
            null,
            null);

    return new AbstractMap.SimpleImmutableEntry<>(schemaTableName, tableDescription);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:RedisTestUtils.java

示例13: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Nullable
@Override
public JdbcTableHandle getTableHandle(SchemaTableName schemaTableName)
{
    try (Connection connection = driver.connect(connectionUrl, connectionProperties)) {
        DatabaseMetaData metadata = connection.getMetaData();
        String jdbcSchemaName = schemaTableName.getSchemaName();
        String jdbcTableName = schemaTableName.getTableName();
        if (metadata.storesUpperCaseIdentifiers()) {
            jdbcSchemaName = jdbcSchemaName.toUpperCase(ENGLISH);
            jdbcTableName = jdbcTableName.toUpperCase(ENGLISH);
        }
        try (ResultSet resultSet = getTables(connection, jdbcSchemaName, jdbcTableName)) {
            List<JdbcTableHandle> tableHandles = new ArrayList<>();
            while (resultSet.next()) {
                tableHandles.add(new JdbcTableHandle(
                        connectorId,
                        schemaTableName,
                        resultSet.getString("TABLE_CAT"),
                        resultSet.getString("TABLE_SCHEM"),
                        resultSet.getString("TABLE_NAME")));
            }
            if (tableHandles.isEmpty()) {
                return null;
            }
            if (tableHandles.size() > 1) {
                throw new PrestoException(NOT_SUPPORTED, "Multiple tables matched: " + schemaTableName);
            }
            return getOnlyElement(tableHandles);
        }
    }
    catch (SQLException e) {
        throw new PrestoException(JDBC_ERROR, e);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:36,代码来源:BaseJdbcClient.java

示例14: createSimpleJsonStreamDescription

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
public static Map.Entry<SchemaTableName, KinesisStreamDescription> createSimpleJsonStreamDescription(String streamName, SchemaTableName schemaTableName)
{
    // Format: {"id" : 1324, "name" : "some string"}
    ArrayList<KinesisStreamFieldDescription> fieldList = new ArrayList<KinesisStreamFieldDescription>();
    fieldList.add(new KinesisStreamFieldDescription("id", BigintType.BIGINT, "id", "comment", null, null, false));
    fieldList.add(new KinesisStreamFieldDescription("name", VarcharType.VARCHAR, "name", "comment", null, null, false));
    KinesisStreamFieldGroup grp = new KinesisStreamFieldGroup("json", fieldList);

    KinesisStreamDescription desc = new KinesisStreamDescription(schemaTableName.getTableName(), schemaTableName.getSchemaName(), streamName, grp);
    return new AbstractMap.SimpleImmutableEntry<>(schemaTableName, desc);
}
 
开发者ID:qubole,项目名称:presto-kinesis,代码行数:12,代码来源:TestUtils.java

示例15: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入方法依赖的package包/类
@Override
public HiveTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
    requireNonNull(tableName, "tableName is null");
    if (!metastore.getTable(tableName.getSchemaName(), tableName.getTableName()).isPresent()) {
        return null;
    }
    return new HiveTableHandle(connectorId, tableName.getSchemaName(), tableName.getTableName());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:HiveMetadata.java


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