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


Java SchemaTableName类代码示例

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


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

示例1: HDFSSplit

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@JsonCreator
public HDFSSplit(
        @JsonProperty("connectorId") HDFSConnectorId connectorId,
        @JsonProperty("table") SchemaTableName table,
        @JsonProperty("path") String path,
        @JsonProperty("start") long start,
        @JsonProperty("len") long len,
        @JsonProperty("addresses") List<HostAddress> addresses
        )
{
    this.connectorId = requireNonNull(connectorId, "connectorId is null");
    this.table = requireNonNull(table, "table is null");
    this.path = requireNonNull(path, "path is null");
    this.start = requireNonNull(start);
    this.len = requireNonNull(len);
    this.addresses = ImmutableList.copyOf(requireNonNull(addresses, "addresses is null"));
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:18,代码来源:HDFSSplit.java

示例2: 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

示例3: getRows

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Override
public Collection<? extends List<?>> getRows(SchemaTableName schemaTableName)
{
    try {
        Response<List<Issue>> execute = service.listPrestoIssues().execute();
        if (!execute.isSuccessful()) {
            throw new IllegalStateException("Unable to read: " + execute.message());
        }
        List<Issue> issues = execute.body();
        return issues.stream()
                .map(issue -> ImmutableList.of(issue.getNumber(), issue.getState(), issue.getUser().getLogin(), issue.getTitle()))
                .collect(toList());
    }
    catch (IOException e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:18,代码来源:GithubRest.java

示例4: listTableColumns

import com.facebook.presto.spi.SchemaTableName; //导入依赖的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

示例5: getTables

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
public Map<SchemaTableName, KuduTableHandle> getTables(KuduClient kuduClient)
    {
        Map<SchemaTableName, KuduTableHandle> tables = null;
        ImmutableMap.Builder<SchemaTableName, KuduTableHandle> tablesBuilder = ImmutableMap.builder();
//        ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> tableColumnsBuilder = ImmutableMap.builder();
        List<String> listTable = null;
        try {
            listTable = kuduClient.getTablesList().getTablesList();
        }
        catch (KuduException e) {
            e.printStackTrace();
        }

        for (String table : listTable) {
            SchemaTableName schemaTableName = new SchemaTableName(PRESTO_KUDU_SCHEMA, table);
            tablesBuilder.put(schemaTableName, new KuduTableHandle(schemaTableName));
        }

        tables = tablesBuilder.build();

        return tables;
    }
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:23,代码来源:KuduTables.java

示例6: listTableColumns

import com.facebook.presto.spi.SchemaTableName; //导入依赖的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

示例7: KuduRecordCursor

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
public KuduRecordCursor(KuduClientManager kuduClientManager, int kuduTokenId, List<KuduColumnHandle> columns, SchemaTableName tableName, TupleDomain<KuduColumnHandle> predicate)

    {
        this.kuduClientManager = requireNonNull(kuduClientManager, "kuduClientManager is null");
        this.columns = requireNonNull(columns, "columns is null");

        fieldToColumnIndex = new int[columns.size()];
        for (int i = 0; i < columns.size(); i++) {
            KuduColumnHandle columnHandle = columns.get(i);
            fieldToColumnIndex[i] = columnHandle.getOrdinalPosition();
        }

        this.kuduClient = requireNonNull(kuduClientManager.getClient(), "kuduClient is null");

        List<KuduScanToken> tokends = kuduClientManager
                .newScanTokenBuilder(this.kuduClient, tableName.getTableName())
                .setProjectedColumnNames(columns.stream().map(column->column.getColumnName()).collect(Collectors.toList()))
                .build();
        try {
            this.kuduScanner = tokends.get(kuduTokenId).intoScanner(this.kuduClient);
        }
        catch (Exception e) {
            logger.error(e, e.getMessage());
        }
    }
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:26,代码来源:KuduRecordCursor.java

示例8: spinUp

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@BeforeMethod
public void spinUp() throws Exception {
    ImmutableMap<SchemaTableName, KinesisStreamDescription> streamMap =
            ImmutableMap.<SchemaTableName, KinesisStreamDescription>builder().
                    put(TestUtils.createEmptyStreamDescription(dummyStreamName, new SchemaTableName("default", dummyStreamName))).
                    put(TestUtils.createSimpleJsonStreamDescription(jsonStreamName, new SchemaTableName("default", jsonStreamName))).
                    build();
    this.queryRunner = new StandaloneQueryRunner(SESSION);
    KinesisPlugin plugin = TestUtils.installKinesisPlugin(queryRunner, streamMap);
    clientManager = TestUtils.getTestClientManager(plugin.getInjector());
    mockClient = (MockKinesisClient) clientManager.getClient();

    mockClient.createStream(dummyStreamName, 2);
    mockClient.createStream(jsonStreamName, 2);

    log.info("Completed spinUp steps.  *** READY FOR QUERIES ***");
}
 
开发者ID:qubole,项目名称:presto-kinesis,代码行数:18,代码来源:TestRecordAccess.java

示例9: testTypesOrcRecordCursor

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Test
public void testTypesOrcRecordCursor()
        throws Exception
{
    ConnectorSession session = newSession();

    if (metadata.getTableHandle(session, new SchemaTableName(database, "presto_test_types_orc")) == null) {
        return;
    }

    ConnectorTableHandle tableHandle = getTableHandle(new SchemaTableName(database, "presto_test_types_orc"));
    ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle);
    HiveSplit hiveSplit = getHiveSplit(tableHandle);
    List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values());

    ConnectorPageSourceProvider pageSourceProvider = new HivePageSourceProvider(
            new HiveClientConfig().setTimeZone(timeZone.getID()),
            hdfsEnvironment,
            ImmutableSet.<HiveRecordCursorProvider>of(new OrcRecordCursorProvider()),
            ImmutableSet.<HivePageSourceFactory>of(),
            TYPE_MANAGER);

    ConnectorPageSource pageSource = pageSourceProvider.createPageSource(session, hiveSplit, columnHandles);
    assertGetRecords(ORC, tableMetadata, hiveSplit, pageSource, columnHandles);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:AbstractTestHiveClient.java

示例10: getTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Override
public TpchTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
    requireNonNull(tableName, "tableName is null");
    if (!tableNames.contains(tableName.getTableName())) {
        return null;
    }

    // parse the scale factor
    double scaleFactor = schemaNameToScaleFactor(tableName.getSchemaName());
    if (scaleFactor < 0) {
        return null;
    }

    return new TpchTableHandle(connectorId, tableName.getTableName(), scaleFactor);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:TpchMetadata.java

示例11: testGetTableHandle

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Test
public void testGetTableHandle() throws IOException {
  Path basePath = setupTest(conf, SESSION.getUser(), SpreadsheetMetadataTest.class);
  SpreadsheetMetadata spreadsheetMetadata = new SpreadsheetMetadata(ugi, conf, basePath, SPREADSHEETS, useFileCache,
      true);
  List<SchemaTableName> listTables = spreadsheetMetadata.listTables(SESSION, SCHEMA_NAME);
  for (SchemaTableName name : listTables) {
    ConnectorTableHandle tableHandle = spreadsheetMetadata.getTableHandle(SESSION, name);
    assertTrue(tableHandle instanceof SpreadsheetTableHandle);
    SpreadsheetTableHandle spreadsheetTableHandle = (SpreadsheetTableHandle) tableHandle;
    String filePath = new Path(new Path(new Path(basePath, SESSION.getUser()), SPREADSHEETS),
        PRESTO_EXAMPLE_XLSX).toString();
    assertEquals(filePath, spreadsheetTableHandle.getSpreadsheetPath());
    SchemaTableName tableName = spreadsheetTableHandle.getTableName();
    assertEquals(name, tableName);
    assertEquals(SESSION.getUser(), spreadsheetTableHandle.getUser());
  }
}
 
开发者ID:fortitudetec,项目名称:presto-plugins,代码行数:19,代码来源:SpreadsheetMetadataTest.java

示例12: map

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Override
public TableColumn map(int index, ResultSet r, StatementContext ctx)
        throws SQLException
{
    SchemaTableName table = new SchemaTableName(
            r.getString("schema_name"),
            r.getString("table_name"));

    String typeName = r.getString("data_type");
    Type type = typeManager.getType(parseTypeSignature(typeName));
    checkArgument(type != null, "Unknown type %s", typeName);

    return new TableColumn(
            table,
            r.getString("column_name"),
            type,
            r.getLong("column_id"));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TableColumn.java

示例13: testNoTableFilter

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
@Test
public void testNoTableFilter()
        throws Exception
{
    // Create "orders" table in a different schema
    metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("test", "orders2"))
            .column("orderkey", BIGINT)
            .build());

    // Create another table that should not be selected
    metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("schema1", "foo"))
            .column("orderkey", BIGINT)
            .build());

    TupleDomain<Integer> tupleDomain = TupleDomain.withColumnDomains(
            ImmutableMap.<Integer, Domain>builder()
                    .put(0, Domain.singleValue(VARCHAR, utf8Slice("test")))
                    .build());

    MetadataDao metadataDao = dummyHandle.attach(MetadataDao.class);
    Set<Long> actual = ImmutableSet.copyOf(ShardMetadataRecordCursor.getTableIds(dbi, tupleDomain));
    Set<Long> expected = ImmutableSet.of(
            metadataDao.getTableInformation("test", "orders").getTableId(),
            metadataDao.getTableInformation("test", "orders2").getTableId());
    assertEquals(actual, expected);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:TestShardMetadataRecordCursor.java

示例14: 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

示例15: getTable

import com.facebook.presto.spi.SchemaTableName; //导入依赖的package包/类
private Table getTable(HiveMetastore metastore, SchemaTableName tableName)
{
    Optional<Table> target = metastore.getTable(tableName.getSchemaName(), tableName.getTableName());
    if (!target.isPresent()) {
        throw new TableNotFoundException(tableName);
    }
    Table table = target.get();

    String protectMode = table.getParameters().get(ProtectMode.PARAMETER_NAME);
    if (protectMode != null && getProtectModeFromString(protectMode).offline) {
        throw new TableOfflineException(tableName);
    }

    String prestoOffline = table.getParameters().get(PRESTO_OFFLINE);
    if (!isNullOrEmpty(prestoOffline)) {
        throw new TableOfflineException(tableName, format("Table '%s' is offline for Presto: %s", tableName, prestoOffline));
    }

    return table;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:HivePartitionManager.java


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