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

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

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

Metadata.getSessionPropertyManager介绍

暂无

代码示例

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

@Override
  public ListenableFuture<?> execute(ResetSession statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters)
  {
    List<String> parts = statement.getName().getParts();
    if (parts.size() > 2) {
      throw new SemanticException(INVALID_SESSION_PROPERTY, statement, "Invalid session property '%s'", statement.getName());
    }

    // validate the property name
    if (parts.size() == 1) {
      metadata.getSessionPropertyManager().getSystemSessionPropertyMetadata(parts.get(0))
          .orElseThrow(() -> new SemanticException(INVALID_SESSION_PROPERTY, statement, "Session property %s does not exist", statement.getName()));
    }
    else {
      ConnectorId connectorId = metadata.getCatalogHandle(stateMachine.getSession(), parts.get(0))
          .orElseThrow(() -> new SemanticException(MISSING_CATALOG, statement, "Catalog %s does not exist", parts.get(0)));
      metadata.getSessionPropertyManager().getConnectorSessionPropertyMetadata(connectorId, parts.get(1))
          .orElseThrow(() -> new SemanticException(INVALID_SESSION_PROPERTY, statement, "Session property %s does not exist", statement.getName()));
    }

    stateMachine.addResetSessionProperties(statement.getName().toString());

    return immediateFuture(null);
  }
}

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

if (parts.size() == 1) {
  accessControl.checkCanSetSystemSessionProperty(session.getIdentity(), parts.get(0));
  propertyMetadata = metadata.getSessionPropertyManager().getSystemSessionPropertyMetadata(parts.get(0))
      .orElseThrow(() -> new SemanticException(INVALID_SESSION_PROPERTY, statement, "Session property %s does not exist", statement.getName()));
      .orElseThrow(() -> new SemanticException(MISSING_CATALOG, statement, "Catalog %s does not exist", parts.get(0)));
  accessControl.checkCanSetCatalogSessionProperty(session.getRequiredTransactionId(), session.getIdentity(), parts.get(0), parts.get(1));
  propertyMetadata = metadata.getSessionPropertyManager().getConnectorSessionPropertyMetadata(connectorId, parts.get(1))
      .orElseThrow(() -> new SemanticException(INVALID_SESSION_PROPERTY, statement, "Session property %s does not exist", statement.getName()));

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

defaultSession = defaultSession.toSessionRepresentation().toSession(coordinator.getMetadata().getSessionPropertyManager());
this.prestoClient = closer.register(new TestingPrestoClient(coordinator, defaultSession));
  server.getCatalogManager().registerCatalog(bogusTestingCatalog);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);

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

public StandaloneQueryRunner(Session defaultSession)
    throws Exception
{
  requireNonNull(defaultSession, "defaultSession is null");
  try {
    server = createTestingPrestoServer();
  }
  catch (Exception e) {
    close();
    throw e;
  }
  this.prestoClient = new TestingPrestoClient(server, defaultSession);
  refreshNodes();
  server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES);
}

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

Session viewSession = Session.builder(metadata.getSessionPropertyManager())
    .setQueryId(session.getQueryId())
    .setTransactionId(session.getTransactionId().orElse(null))

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

.put("connector_long", "11")
        .build()),
    getQueryRunner().getMetadata().getSessionPropertyManager(),
    getSession().getPreparedStatements());
MaterializedResult result = computeActual(session, "SHOW SESSION");

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

List<SessionPropertyValue> sessionProperties = metadata.getSessionPropertyManager().getAllSessionProperties(session, catalogNames);
for (SessionPropertyValue sessionProperty : sessionProperties) {
  if (sessionProperty.isHidden()) {

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

private static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

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

public static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true")
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

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

@Override
  public CompletableFuture<?> execute(ResetSession statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine)
  {
    if (statement.getName().getParts().size() > 2) {
      throw new SemanticException(INVALID_SESSION_PROPERTY, statement, "Invalid session property '%s'", statement.getName());
    }

    // validate the property name
    metadata.getSessionPropertyManager().getSessionPropertyMetadata(statement.getName().toString());

    stateMachine.addResetSessionProperties(statement.getName().toString());

    return completedFuture(null);
  }
}

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

defaultSession = defaultSession.toSessionRepresentation().toSession(coordinator.getMetadata().getSessionPropertyManager());
this.prestoClient = closer.register(new TestingPrestoClient(coordinator, defaultSession));
  server.getCatalogManager().registerCatalog(bogusTestingCatalog);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);

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

PropertyMetadata<?> propertyMetadata = metadata.getSessionPropertyManager().getSessionPropertyMetadata(propertyName.toString());
metadata.getSessionPropertyManager().decodeProperty(propertyName.toString(), value, propertyMetadata.getJavaType());
stateMachine.addSetSessionProperties(propertyName.toString(), value);

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

public StandaloneQueryRunner(Session defaultSession)
    throws Exception
{
  requireNonNull(defaultSession, "defaultSession is null");
  try {
    server = createTestingPrestoServer();
  }
  catch (Exception e) {
    close();
    throw e;
  }
  this.prestoClient = new TestingPrestoClient(server, defaultSession);
  refreshNodes();
  server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES);
}

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

Session viewSession = Session.builder(metadata.getSessionPropertyManager())
    .setQueryId(session.getQueryId())
    .setTransactionId(session.getTransactionId().orElse(null))

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

List<SessionPropertyValue> sessionProperties = metadata.getSessionPropertyManager().getAllSessionProperties(session);
for (SessionPropertyValue sessionProperty : sessionProperties) {
  if (sessionProperty.isHidden()) {

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

.put("connector_long", "11")
        .build()),
    getQueryRunner().getMetadata().getSessionPropertyManager(),
    getSession().getPreparedStatements());
MaterializedResult result = computeActual(session, "SHOW SESSION");

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

private static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

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

private static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(localQueryRunner.getNodeManager(), 1),
      ImmutableMap.<String, String>of());
  localQueryRunner.createCatalog(TPCH_SAMPLED_SCHEMA, new SampledTpchConnectorFactory(localQueryRunner.getNodeManager(), 1, 2), ImmutableMap.<String, String>of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(AbstractTestQueries.TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties("connector", AbstractTestQueries.TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

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

private InternalTable getInternalTable(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, ConnectorSplit connectorSplit, List<ColumnHandle> columns)
{
  InformationSchemaTransactionHandle transaction = checkType(transactionHandle, InformationSchemaTransactionHandle.class, "transaction");
  InformationSchemaSplit split = checkType(connectorSplit, InformationSchemaSplit.class, "split");
  requireNonNull(columns, "columns is null");
  InformationSchemaTableHandle handle = split.getTableHandle();
  Map<String, NullableValue> filters = split.getFilters();
  Session session = Session.builder(metadata.getSessionPropertyManager())
      .setTransactionId(transaction.getTransactionId())
      .setQueryId(new QueryId(connectorSession.getQueryId()))
      .setIdentity(connectorSession.getIdentity())
      .setSource("information_schema")
      .setCatalog("") // default catalog is not be used
      .setSchema("") // default schema is not be used
      .setTimeZoneKey(connectorSession.getTimeZoneKey())
      .setLocale(connectorSession.getLocale())
      .setStartTime(connectorSession.getStartTime())
      .build();
  return getInformationSchemaTable(session, handle.getCatalogName(), handle.getSchemaTableName(), filters);
}

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

public static LocalQueryRunner createLocalQueryRunner()
{
  Session defaultSession = testSessionBuilder()
      .setCatalog("local")
      .setSchema(TINY_SCHEMA_NAME)
      .setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true")
      .build();
  LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
  // add the tpch catalog
  // local queries run directly against the generator
  localQueryRunner.createCatalog(
      defaultSession.getCatalog().get(),
      new TpchConnectorFactory(1),
      ImmutableMap.of());
  localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
  SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
  sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
  sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
  return localQueryRunner;
}

相关文章