コード例 #1
0
ファイル: LocalQueryRunner.java プロジェクト: posix4e/presto
 public void createCatalog(
     String catalogName, ConnectorFactory connectorFactory, Map<String, String> properties) {
   nodeManager.addCurrentNodeDatasource(catalogName);
   connectorManager.createConnection(catalogName, connectorFactory, properties);
 }
コード例 #2
0
 public void createCatalog(
     String catalogName, String connectorName, Map<String, String> properties) {
   connectorManager.createConnection(catalogName, connectorName, properties);
   updateDatasourcesAnnouncement(announcer, catalogName);
 }
コード例 #3
0
  public LocalQueryRunner(Session defaultSession) {
    requireNonNull(defaultSession, "defaultSession is null");
    this.executor = newCachedThreadPool(daemonThreadsNamed("local-query-runner-%s"));

    this.sqlParser = new SqlParser();
    this.nodeManager = new InMemoryNodeManager();
    this.typeRegistry = new TypeRegistry();
    this.indexManager = new IndexManager();
    this.pageSinkManager = new PageSinkManager();

    this.splitManager = new SplitManager();
    this.blockEncodingSerde = new BlockEncodingManager(typeRegistry);
    this.metadata =
        new MetadataManager(
            new FeaturesConfig().setExperimentalSyntaxEnabled(true),
            typeRegistry,
            splitManager,
            blockEncodingSerde,
            new SessionPropertyManager(),
            new TablePropertyManager());
    this.accessControl = new TestingAccessControlManager();
    this.pageSourceManager = new PageSourceManager();

    this.compiler = new ExpressionCompiler(metadata);

    this.connectorManager =
        new ConnectorManager(
            metadata,
            accessControl,
            splitManager,
            pageSourceManager,
            indexManager,
            pageSinkManager,
            new HandleResolver(),
            ImmutableMap.<String, ConnectorFactory>of(),
            nodeManager);

    Connector systemConnector =
        new SystemConnector(
            nodeManager,
            ImmutableSet.of(
                new NodeSystemTable(nodeManager),
                new CatalogSystemTable(metadata),
                new TablePropertiesSystemTable(metadata)));

    connectorManager.createConnection(SystemConnector.NAME, systemConnector);

    // rewrite session to use managed SessionPropertyMetadata
    this.defaultSession =
        new Session(
            defaultSession.getIdentity(),
            defaultSession.getSource(),
            defaultSession.getCatalog(),
            defaultSession.getSchema(),
            defaultSession.getTimeZoneKey(),
            defaultSession.getLocale(),
            defaultSession.getRemoteUserAddress(),
            defaultSession.getUserAgent(),
            defaultSession.getStartTime(),
            defaultSession.getSystemProperties(),
            defaultSession.getCatalogProperties(),
            metadata.getSessionPropertyManager());

    dataDefinitionTask =
        ImmutableMap.<Class<? extends Statement>, DataDefinitionTask<?>>builder()
            .put(CreateTable.class, new CreateTableTask())
            .put(
                CreateView.class,
                new CreateViewTask(
                    jsonCodec(ViewDefinition.class),
                    sqlParser,
                    accessControl,
                    new FeaturesConfig()))
            .put(DropTable.class, new DropTableTask())
            .put(DropView.class, new DropViewTask())
            .put(RenameColumn.class, new RenameColumnTask())
            .put(RenameTable.class, new RenameTableTask())
            .put(ResetSession.class, new ResetSessionTask())
            .put(SetSession.class, new SetSessionTask())
            .build();
  }
コード例 #4
0
 @Override
 public void close() {
   executor.shutdownNow();
   connectorManager.stop();
 }
コード例 #5
0
 @Inject
 public SystemTablesRegistrar(
     ConnectorManager manager, GlobalSystemConnectorFactory globalSystemConnectorFactory) {
   manager.createConnection(
       GlobalSystemConnector.NAME, globalSystemConnectorFactory, ImmutableMap.of());
 }