com.facebook.presto.metadata.Metadata.listSchemaNames()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中com.facebook.presto.metadata.Metadata.listSchemaNames()方法的一些代码示例,展示了Metadata.listSchemaNames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.listSchemaNames()方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:listSchemaNames

Metadata.listSchemaNames介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

public static SortedSet<String> listSchemas(Session session, Metadata metadata, AccessControl accessControl, String catalogName)
{
  Set<String> schemaNames = ImmutableSet.copyOf(metadata.listSchemaNames(session, catalogName));
  return ImmutableSortedSet.copyOf(accessControl.filterSchemas(session.getRequiredTransactionId(), session.getIdentity(), catalogName, schemaNames));
}

代码示例来源:origin: prestodb/presto

private Set<QualifiedTablePrefix> calculatePrefixesWithSchemaName(
    ConnectorSession connectorSession,
    TupleDomain<ColumnHandle> constraint,
    Optional<Predicate<Map<ColumnHandle, NullableValue>>> predicate)
{
  Optional<Set<String>> schemas = filterString(constraint, SCHEMA_COLUMN_HANDLE);
  if (schemas.isPresent()) {
    return schemas.get().stream()
        .filter(this::isLowerCase)
        .map(schema -> new QualifiedTablePrefix(catalogName, schema))
        .collect(toImmutableSet());
  }
  Session session = ((FullConnectorSession) connectorSession).getSession();
  return metadata.listSchemaNames(session, catalogName).stream()
      .filter(schema -> !predicate.isPresent() || predicate.get().test(schemaAsFixedValues(schema)))
      .map(schema -> new QualifiedTablePrefix(catalogName, schema))
      .collect(toImmutableSet());
}

代码示例来源:origin: prestodb/presto

@Test
  public void testUpperCaseSchemaIsChangedToLowerCase()
  {
    TransactionBuilder.transaction(queryRunner.getTransactionManager(), queryRunner.getAccessControl())
        .execute(
            TEST_SESSION,
            transactionSession -> {
              List<String> expectedSchemas = ImmutableList.of("information_schema", "upper_case_schema");
              assertEquals(queryRunner.getMetadata().listSchemaNames(transactionSession, "upper_case_schema_catalog"), expectedSchemas);
              return null;
            });
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private InternalTable buildSchemata(Session session, String catalogName)
{
  InternalTable.Builder table = InternalTable.builder(informationSchemaTableColumns(TABLE_SCHEMATA));
  for (String schema : metadata.listSchemaNames(session, catalogName)) {
    table.add(catalogName, schema);
  }
  return table.build();
}

代码示例来源:origin: com.facebook.presto/presto-tests

@Test
  public void testUpperCaseSchemaIsChangedToLowerCase()
  {
    TransactionBuilder.transaction(queryRunner.getTransactionManager(), queryRunner.getAccessControl())
        .execute(
            TEST_SESSION,
            transactionSession -> {
              List<String> expectedSchemas = ImmutableList.of("information_schema", "upper_case_schema");
              assertEquals(queryRunner.getMetadata().listSchemaNames(transactionSession, "upper_case_schema_catalog"), expectedSchemas);
              return null;
            });
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

if (!metadata.listSchemaNames(session, catalogName).contains(schemaName)) {
  throw new SemanticException(MISSING_SCHEMA, showTables, "Schema '%s' does not exist", schemaName);

代码示例来源: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 = FilterUtil.stringFilter(constraint, 1);

    Builder table = InMemoryRecordSet.builder(METADATA);
    for (String catalog : filter(metadata.getCatalogNames().keySet(), catalogFilter)) {
      for (String schema : metadata.listSchemaNames(session, catalog)) {
        table.addRow(schema, catalog);
      }
    }
    return table.build().cursor();
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

throw new SemanticException(MISSING_CATALOG, table, "Catalog %s does not exist", name.getCatalogName());
if (!metadata.listSchemaNames(session, name.getCatalogName()).contains(name.getSchemaName())) {
  throw new SemanticException(MISSING_SCHEMA, table, "Schema %s does not exist", name.getSchemaName());

相关文章