Search in sources :

Example 81 with Optional

use of java.util.Optional in project presto by prestodb.

the class ClusterMemoryManager method updatePools.

private synchronized void updatePools(Map<MemoryPoolId, Integer> queryCounts) {
    // Update view of cluster memory and pools
    List<MemoryInfo> nodeMemoryInfos = nodes.values().stream().map(RemoteNodeMemory::getInfo).filter(Optional::isPresent).map(Optional::get).collect(toImmutableList());
    long totalClusterMemory = nodeMemoryInfos.stream().map(MemoryInfo::getTotalNodeMemory).mapToLong(DataSize::toBytes).sum();
    clusterMemoryBytes.set(totalClusterMemory);
    Set<MemoryPoolId> activePoolIds = nodeMemoryInfos.stream().flatMap(info -> info.getPools().keySet().stream()).collect(toImmutableSet());
    // Make a copy to materialize the set difference
    Set<MemoryPoolId> removedPools = ImmutableSet.copyOf(difference(pools.keySet(), activePoolIds));
    for (MemoryPoolId removed : removedPools) {
        unexport(pools.get(removed));
        pools.remove(removed);
        if (changeListeners.containsKey(removed)) {
            for (Consumer<MemoryPoolInfo> listener : changeListeners.get(removed)) {
                listenerExecutor.execute(() -> listener.accept(new MemoryPoolInfo(0, 0, ImmutableMap.of())));
            }
        }
    }
    for (MemoryPoolId id : activePoolIds) {
        ClusterMemoryPool pool = pools.computeIfAbsent(id, poolId -> {
            ClusterMemoryPool newPool = new ClusterMemoryPool(poolId);
            String objectName = ObjectNames.builder(ClusterMemoryPool.class, newPool.getId().toString()).build();
            try {
                exporter.export(objectName, newPool);
            } catch (JmxException e) {
                log.error(e, "Error exporting memory pool %s", poolId);
            }
            return newPool;
        });
        pool.update(nodeMemoryInfos, queryCounts.getOrDefault(pool.getId(), 0));
        if (changeListeners.containsKey(id)) {
            MemoryPoolInfo info = pool.getInfo();
            for (Consumer<MemoryPoolInfo> listener : changeListeners.get(id)) {
                listenerExecutor.execute(() -> listener.accept(info));
            }
        }
    }
}
Also used : SystemSessionProperties.getQueryMaxCpuTime(com.facebook.presto.SystemSessionProperties.getQueryMaxCpuTime) Duration(io.airlift.units.Duration) ACTIVE(com.facebook.presto.spi.NodeState.ACTIVE) RESERVED_POOL(com.facebook.presto.memory.LocalMemoryManager.RESERVED_POOL) PreDestroy(javax.annotation.PreDestroy) Sets.difference(com.google.common.collect.Sets.difference) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) Node(com.facebook.presto.spi.Node) Duration.nanosSince(io.airlift.units.Duration.nanosSince) Map(java.util.Map) GENERAL_POOL(com.facebook.presto.memory.LocalMemoryManager.GENERAL_POOL) ImmutableCollectors.toImmutableSet(com.facebook.presto.util.ImmutableCollectors.toImmutableSet) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) ImmutableCollectors.toImmutableList(com.facebook.presto.util.ImmutableCollectors.toImmutableList) ServerConfig(com.facebook.presto.server.ServerConfig) ObjectNames(org.weakref.jmx.ObjectNames) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) GuardedBy(javax.annotation.concurrent.GuardedBy) Executors(java.util.concurrent.Executors) String.format(java.lang.String.format) ExceededCpuLimitException(com.facebook.presto.ExceededCpuLimitException) QueryIdGenerator(com.facebook.presto.execution.QueryIdGenerator) QueryExecution(com.facebook.presto.execution.QueryExecution) DataSize(io.airlift.units.DataSize) List(java.util.List) Optional(java.util.Optional) JmxException(org.weakref.jmx.JmxException) SystemSessionProperties.resourceOvercommit(com.facebook.presto.SystemSessionProperties.resourceOvercommit) JsonCodec(io.airlift.json.JsonCodec) HttpClient(io.airlift.http.client.HttpClient) ExceededMemoryLimitException.exceededGlobalLimit(com.facebook.presto.ExceededMemoryLimitException.exceededGlobalLimit) RESOURCE_OVERCOMMIT(com.facebook.presto.SystemSessionProperties.RESOURCE_OVERCOMMIT) Logger(io.airlift.log.Logger) DataSize.succinctBytes(io.airlift.units.DataSize.succinctBytes) HashMap(java.util.HashMap) PrestoException(com.facebook.presto.spi.PrestoException) CLUSTER_OUT_OF_MEMORY(com.facebook.presto.spi.StandardErrorCode.CLUSTER_OUT_OF_MEMORY) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ImmutableList(com.google.common.collect.ImmutableList) Managed(org.weakref.jmx.Managed) Objects.requireNonNull(java.util.Objects.requireNonNull) MemoryPoolInfo(com.facebook.presto.spi.memory.MemoryPoolInfo) SystemSessionProperties.getQueryMaxMemory(com.facebook.presto.SystemSessionProperties.getQueryMaxMemory) ExecutorService(java.util.concurrent.ExecutorService) ClusterMemoryPoolManager(com.facebook.presto.spi.memory.ClusterMemoryPoolManager) SHUTTING_DOWN(com.facebook.presto.spi.NodeState.SHUTTING_DOWN) LocationFactory(com.facebook.presto.execution.LocationFactory) Consumer(java.util.function.Consumer) MemoryPoolId(com.facebook.presto.spi.memory.MemoryPoolId) AtomicLong(java.util.concurrent.atomic.AtomicLong) QueryId(com.facebook.presto.spi.QueryId) VisibleForTesting(com.google.common.annotations.VisibleForTesting) MBeanExporter(org.weakref.jmx.MBeanExporter) JmxException(org.weakref.jmx.JmxException) Optional(java.util.Optional) MemoryPoolInfo(com.facebook.presto.spi.memory.MemoryPoolInfo) MemoryPoolId(com.facebook.presto.spi.memory.MemoryPoolId)

Example 82 with Optional

use of java.util.Optional in project presto by prestodb.

the class MetadataManager method getLayouts.

@Override
public List<TableLayoutResult> getLayouts(Session session, TableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
    if (constraint.getSummary().isNone()) {
        return ImmutableList.of();
    }
    ConnectorId connectorId = table.getConnectorId();
    ConnectorTableHandle connectorTable = table.getConnectorHandle();
    CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId);
    ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
    ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(connectorId);
    ConnectorSession connectorSession = session.toConnectorSession(connectorId);
    List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(connectorSession, connectorTable, constraint, desiredColumns);
    return layouts.stream().map(layout -> new TableLayoutResult(fromConnectorLayout(connectorId, transaction, layout.getTableLayout()), layout.getUnenforcedConstraint())).collect(toImmutableList());
}
Also used : TypeManager(com.facebook.presto.spi.type.TypeManager) TypeRegistry(com.facebook.presto.type.TypeRegistry) BETWEEN(com.facebook.presto.spi.function.OperatorType.BETWEEN) ConnectorTransactionHandle(com.facebook.presto.spi.connector.ConnectorTransactionHandle) TableIdentity(com.facebook.presto.spi.TableIdentity) BIGINT(com.facebook.presto.spi.type.BigintType.BIGINT) Privilege(com.facebook.presto.spi.security.Privilege) ObjectMapperProvider(io.airlift.json.ObjectMapperProvider) SchemaTableName(com.facebook.presto.spi.SchemaTableName) HashMultimap(com.google.common.collect.HashMultimap) BOOLEAN(com.facebook.presto.spi.type.BooleanType.BOOLEAN) Map(java.util.Map) ImmutableCollectors.toImmutableList(com.facebook.presto.util.ImmutableCollectors.toImmutableList) LESS_THAN(com.facebook.presto.spi.function.OperatorType.LESS_THAN) LESS_THAN_OR_EQUAL(com.facebook.presto.spi.function.OperatorType.LESS_THAN_OR_EQUAL) ENGLISH(java.util.Locale.ENGLISH) ImmutableSet(com.google.common.collect.ImmutableSet) EQUAL(com.facebook.presto.spi.function.OperatorType.EQUAL) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ConnectorResolvedIndex(com.facebook.presto.spi.ConnectorResolvedIndex) String.format(java.lang.String.format) ConnectorSession(com.facebook.presto.spi.ConnectorSession) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) TupleDomain(com.facebook.presto.spi.predicate.TupleDomain) List(java.util.List) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) OperatorType(com.facebook.presto.spi.function.OperatorType) QualifiedObjectName.convertFromSchemaTableName(com.facebook.presto.metadata.QualifiedObjectName.convertFromSchemaTableName) JsonCodecFactory(io.airlift.json.JsonCodecFactory) Entry(java.util.Map.Entry) Optional(java.util.Optional) GREATER_THAN(com.facebook.presto.spi.function.OperatorType.GREATER_THAN) ConnectorId(com.facebook.presto.connector.ConnectorId) Joiner(com.google.common.base.Joiner) JsonCodec(io.airlift.json.JsonCodec) TypeSignature(com.facebook.presto.spi.type.TypeSignature) ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) QualifiedName(com.facebook.presto.sql.tree.QualifiedName) Slice(io.airlift.slice.Slice) HASH_CODE(com.facebook.presto.spi.function.OperatorType.HASH_CODE) ConnectorTableHandle(com.facebook.presto.spi.ConnectorTableHandle) HashMap(java.util.HashMap) ConnectorOutputTableHandle(com.facebook.presto.spi.ConnectorOutputTableHandle) PrestoException(com.facebook.presto.spi.PrestoException) Multimap(com.google.common.collect.Multimap) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) Inject(javax.inject.Inject) LinkedHashMap(java.util.LinkedHashMap) OptionalLong(java.util.OptionalLong) BlockEncodingSerde(com.facebook.presto.spi.block.BlockEncodingSerde) ImmutableList(com.google.common.collect.ImmutableList) Type(com.facebook.presto.spi.type.Type) Objects.requireNonNull(java.util.Objects.requireNonNull) TransactionManager(com.facebook.presto.transaction.TransactionManager) LinkedHashSet(java.util.LinkedHashSet) ConnectorInsertTableHandle(com.facebook.presto.spi.ConnectorInsertTableHandle) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) NOT_EQUAL(com.facebook.presto.spi.function.OperatorType.NOT_EQUAL) ConnectorOutputMetadata(com.facebook.presto.spi.connector.ConnectorOutputMetadata) Session(com.facebook.presto.Session) CatalogSchemaName(com.facebook.presto.spi.CatalogSchemaName) ConnectorTableLayout(com.facebook.presto.spi.ConnectorTableLayout) ColumnIdentity(com.facebook.presto.spi.ColumnIdentity) Constraint(com.facebook.presto.spi.Constraint) ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) INVALID_VIEW(com.facebook.presto.spi.StandardErrorCode.INVALID_VIEW) TypeDeserializer(com.facebook.presto.type.TypeDeserializer) SYNTAX_ERROR(com.facebook.presto.spi.StandardErrorCode.SYNTAX_ERROR) SchemaTablePrefix(com.facebook.presto.spi.SchemaTablePrefix) ColumnHandle(com.facebook.presto.spi.ColumnHandle) ViewColumn(com.facebook.presto.metadata.ViewDefinition.ViewColumn) QueryId(com.facebook.presto.spi.QueryId) GREATER_THAN_OR_EQUAL(com.facebook.presto.spi.function.OperatorType.GREATER_THAN_OR_EQUAL) ConnectorNewTableLayout(com.facebook.presto.spi.ConnectorNewTableLayout) VisibleForTesting(com.google.common.annotations.VisibleForTesting) TransactionManager.createTestTransactionManager(com.facebook.presto.transaction.TransactionManager.createTestTransactionManager) TableLayout.fromConnectorLayout(com.facebook.presto.metadata.TableLayout.fromConnectorLayout) ConnectorViewDefinition(com.facebook.presto.spi.ConnectorViewDefinition) BlockEncodingManager(com.facebook.presto.block.BlockEncodingManager) ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorTransactionHandle(com.facebook.presto.spi.connector.ConnectorTransactionHandle) ConnectorSession(com.facebook.presto.spi.ConnectorSession) ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) ConnectorId(com.facebook.presto.connector.ConnectorId) ConnectorTableHandle(com.facebook.presto.spi.ConnectorTableHandle)

Example 83 with Optional

use of java.util.Optional in project presto by prestodb.

the class ServerMainModule method setup.

@Override
protected void setup(Binder binder) {
    ServerConfig serverConfig = buildConfigObject(ServerConfig.class);
    if (serverConfig.isCoordinator()) {
        install(new CoordinatorModule());
        binder.bind(new TypeLiteral<Optional<QueryPerformanceFetcher>>() {
        }).toProvider(QueryPerformanceFetcherProvider.class).in(Scopes.SINGLETON);
    } else {
        binder.bind(new TypeLiteral<Optional<QueryPerformanceFetcher>>() {
        }).toInstance(Optional.empty());
        // Install no-op resource group manager on workers, since only coordinators manage resource groups.
        binder.bind(ResourceGroupManager.class).to(NoOpResourceGroupManager.class).in(Scopes.SINGLETON);
        // HACK: this binding is needed by SystemConnectorModule, but will only be used on the coordinator
        binder.bind(QueryManager.class).toInstance(newProxy(QueryManager.class, (proxy, method, args) -> {
            throw new UnsupportedOperationException();
        }));
    }
    configBinder(binder).bindConfig(FeaturesConfig.class);
    binder.bind(SqlParser.class).in(Scopes.SINGLETON);
    binder.bind(SqlParserOptions.class).toInstance(sqlParserOptions);
    bindFailureDetector(binder, serverConfig.isCoordinator());
    jaxrsBinder(binder).bind(ThrowableMapper.class);
    configBinder(binder).bindConfig(QueryManagerConfig.class);
    jsonCodecBinder(binder).bindJsonCodec(ViewDefinition.class);
    // session properties
    binder.bind(SessionPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(SystemSessionProperties.class).in(Scopes.SINGLETON);
    // schema properties
    binder.bind(SchemaPropertyManager.class).in(Scopes.SINGLETON);
    // table properties
    binder.bind(TablePropertyManager.class).in(Scopes.SINGLETON);
    // node manager
    discoveryBinder(binder).bindSelector("presto");
    binder.bind(DiscoveryNodeManager.class).in(Scopes.SINGLETON);
    binder.bind(InternalNodeManager.class).to(DiscoveryNodeManager.class).in(Scopes.SINGLETON);
    newExporter(binder).export(DiscoveryNodeManager.class).withGeneratedName();
    httpClientBinder(binder).bindHttpClient("node-manager", ForNodeManager.class).withTracing().withConfigDefaults(config -> {
        config.setIdleTimeout(new Duration(30, SECONDS));
        config.setRequestTimeout(new Duration(10, SECONDS));
    });
    // node scheduler
    // TODO: remove from NodePartitioningManager and move to CoordinatorModule
    configBinder(binder).bindConfig(NodeSchedulerConfig.class);
    binder.bind(NodeScheduler.class).in(Scopes.SINGLETON);
    binder.bind(NodeSchedulerExporter.class).in(Scopes.SINGLETON);
    binder.bind(NodeTaskMap.class).in(Scopes.SINGLETON);
    newExporter(binder).export(NodeScheduler.class).withGeneratedName();
    // network topology
    // TODO: move to CoordinatorModule when NodeScheduler is moved
    install(installModuleIf(NodeSchedulerConfig.class, config -> LEGACY.equalsIgnoreCase(config.getNetworkTopology()), moduleBinder -> moduleBinder.bind(NetworkTopology.class).to(LegacyNetworkTopology.class).in(Scopes.SINGLETON)));
    install(installModuleIf(NodeSchedulerConfig.class, config -> FLAT.equalsIgnoreCase(config.getNetworkTopology()), moduleBinder -> moduleBinder.bind(NetworkTopology.class).to(FlatNetworkTopology.class).in(Scopes.SINGLETON)));
    // task execution
    jaxrsBinder(binder).bind(TaskResource.class);
    newExporter(binder).export(TaskResource.class).withGeneratedName();
    binder.bind(TaskManager.class).to(SqlTaskManager.class).in(Scopes.SINGLETON);
    // workaround for CodeCache GC issue
    if (JavaVersion.current().getMajor() == 8) {
        configBinder(binder).bindConfig(CodeCacheGcConfig.class);
        binder.bind(CodeCacheGcTrigger.class).in(Scopes.SINGLETON);
    }
    // Add monitoring for JVM pauses
    binder.bind(PauseMeter.class).in(Scopes.SINGLETON);
    newExporter(binder).export(PauseMeter.class).withGeneratedName();
    configBinder(binder).bindConfig(MemoryManagerConfig.class);
    configBinder(binder).bindConfig(NodeMemoryConfig.class);
    configBinder(binder).bindConfig(ReservedSystemMemoryConfig.class);
    binder.bind(LocalMemoryManager.class).in(Scopes.SINGLETON);
    binder.bind(LocalMemoryManagerExporter.class).in(Scopes.SINGLETON);
    newExporter(binder).export(TaskManager.class).withGeneratedName();
    binder.bind(TaskExecutor.class).in(Scopes.SINGLETON);
    newExporter(binder).export(TaskExecutor.class).withGeneratedName();
    binder.bind(LocalExecutionPlanner.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(CompilerConfig.class);
    binder.bind(ExpressionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(ExpressionCompiler.class).withGeneratedName();
    configBinder(binder).bindConfig(TaskManagerConfig.class);
    binder.bind(IndexJoinLookupStats.class).in(Scopes.SINGLETON);
    newExporter(binder).export(IndexJoinLookupStats.class).withGeneratedName();
    binder.bind(AsyncHttpExecutionMBean.class).in(Scopes.SINGLETON);
    newExporter(binder).export(AsyncHttpExecutionMBean.class).withGeneratedName();
    binder.bind(JoinFilterFunctionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinFilterFunctionCompiler.class).withGeneratedName();
    binder.bind(JoinCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinCompiler.class).withGeneratedName();
    binder.bind(OrderingCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(OrderingCompiler.class).withGeneratedName();
    binder.bind(PagesIndex.Factory.class).to(PagesIndex.DefaultFactory.class);
    binder.bind(JoinProbeCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinProbeCompiler.class).withGeneratedName();
    binder.bind(LookupJoinOperators.class).in(Scopes.SINGLETON);
    jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class);
    jsonCodecBinder(binder).bindJsonCodec(StageInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
    jaxrsBinder(binder).bind(PagesResponseWriter.class);
    // exchange client
    binder.bind(new TypeLiteral<ExchangeClientSupplier>() {
    }).to(ExchangeClientFactory.class).in(Scopes.SINGLETON);
    httpClientBinder(binder).bindHttpClient("exchange", ForExchange.class).withTracing().withConfigDefaults(config -> {
        config.setIdleTimeout(new Duration(30, SECONDS));
        config.setRequestTimeout(new Duration(10, SECONDS));
        config.setMaxConnectionsPerServer(250);
        config.setMaxContentLength(new DataSize(32, MEGABYTE));
    });
    configBinder(binder).bindConfig(ExchangeClientConfig.class);
    binder.bind(ExchangeExecutionMBean.class).in(Scopes.SINGLETON);
    newExporter(binder).export(ExchangeExecutionMBean.class).withGeneratedName();
    // execution
    binder.bind(LocationFactory.class).to(HttpLocationFactory.class).in(Scopes.SINGLETON);
    // memory manager
    jaxrsBinder(binder).bind(MemoryResource.class);
    jsonCodecBinder(binder).bindJsonCodec(MemoryInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(MemoryPoolAssignmentsRequest.class);
    // transaction manager
    configBinder(binder).bindConfig(TransactionManagerConfig.class);
    // data stream provider
    binder.bind(PageSourceManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSourceProvider.class).to(PageSourceManager.class).in(Scopes.SINGLETON);
    // page sink provider
    binder.bind(PageSinkManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSinkProvider.class).to(PageSinkManager.class).in(Scopes.SINGLETON);
    // metadata
    binder.bind(StaticCatalogStore.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(StaticCatalogStoreConfig.class);
    binder.bind(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(Metadata.class).to(MetadataManager.class).in(Scopes.SINGLETON);
    // type
    binder.bind(TypeRegistry.class).in(Scopes.SINGLETON);
    binder.bind(TypeManager.class).to(TypeRegistry.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
    newSetBinder(binder, Type.class);
    // split manager
    binder.bind(SplitManager.class).in(Scopes.SINGLETON);
    // node partitioning manager
    binder.bind(NodePartitioningManager.class).in(Scopes.SINGLETON);
    // index manager
    binder.bind(IndexManager.class).in(Scopes.SINGLETON);
    // handle resolver
    binder.install(new HandleJsonModule());
    // connector
    binder.bind(ConnectorManager.class).in(Scopes.SINGLETON);
    // system connector
    binder.install(new SystemConnectorModule());
    // splits
    jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class);
    jsonCodecBinder(binder).bindJsonCodec(ConnectorSplit.class);
    jsonBinder(binder).addSerializerBinding(Slice.class).to(SliceSerializer.class);
    jsonBinder(binder).addDeserializerBinding(Slice.class).to(SliceDeserializer.class);
    jsonBinder(binder).addSerializerBinding(Expression.class).to(ExpressionSerializer.class);
    jsonBinder(binder).addDeserializerBinding(Expression.class).to(ExpressionDeserializer.class);
    jsonBinder(binder).addDeserializerBinding(FunctionCall.class).to(FunctionCallDeserializer.class);
    // query monitor
    configBinder(binder).bindConfig(QueryMonitorConfig.class);
    binder.bind(QueryMonitor.class).in(Scopes.SINGLETON);
    // Determine the NodeVersion
    String prestoVersion = serverConfig.getPrestoVersion();
    if (prestoVersion == null) {
        prestoVersion = getClass().getPackage().getImplementationVersion();
    }
    checkState(prestoVersion != null, "presto.version must be provided when it cannot be automatically determined");
    NodeVersion nodeVersion = new NodeVersion(prestoVersion);
    binder.bind(NodeVersion.class).toInstance(nodeVersion);
    // presto announcement
    discoveryBinder(binder).bindHttpAnnouncement("presto").addProperty("node_version", nodeVersion.toString()).addProperty("coordinator", String.valueOf(serverConfig.isCoordinator())).addProperty("connectorIds", nullToEmpty(serverConfig.getDataSources()));
    // server info resource
    jaxrsBinder(binder).bind(ServerInfoResource.class);
    // plugin manager
    binder.bind(PluginManager.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(PluginManagerConfig.class);
    binder.bind(CatalogManager.class).in(Scopes.SINGLETON);
    // optimizers
    binder.bind(PlanOptimizers.class).in(Scopes.SINGLETON);
    // block encodings
    binder.bind(BlockEncodingManager.class).in(Scopes.SINGLETON);
    binder.bind(BlockEncodingSerde.class).to(BlockEncodingManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, new TypeLiteral<BlockEncodingFactory<?>>() {
    });
    jsonBinder(binder).addSerializerBinding(Block.class).to(BlockJsonSerde.Serializer.class);
    jsonBinder(binder).addDeserializerBinding(Block.class).to(BlockJsonSerde.Deserializer.class);
    // thread visualizer
    jaxrsBinder(binder).bind(ThreadResource.class);
    // PageSorter
    binder.bind(PageSorter.class).to(PagesIndexPageSorter.class).in(Scopes.SINGLETON);
    // PageIndexer
    binder.bind(PageIndexerFactory.class).to(GroupByHashPageIndexerFactory.class).in(Scopes.SINGLETON);
    // Finalizer
    binder.bind(FinalizerService.class).in(Scopes.SINGLETON);
    // Spiller
    binder.bind(SpillerFactory.class).to(BinarySpillerFactory.class).in(Scopes.SINGLETON);
    newExporter(binder).export(SpillerFactory.class).withGeneratedName();
}
Also used : TypeManager(com.facebook.presto.spi.type.TypeManager) PageSourceProvider(com.facebook.presto.split.PageSourceProvider) TaskStatus(com.facebook.presto.execution.TaskStatus) JoinProbeCompiler(com.facebook.presto.sql.gen.JoinProbeCompiler) TypeRegistry(com.facebook.presto.type.TypeRegistry) NodeInfo(io.airlift.node.NodeInfo) ForNodeManager(com.facebook.presto.metadata.ForNodeManager) PauseMeter(io.airlift.stats.PauseMeter) QueryPerformanceFetcher(com.facebook.presto.execution.QueryPerformanceFetcher) Executors.newSingleThreadScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor) StageInfo(com.facebook.presto.execution.StageInfo) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) FinalizerService(com.facebook.presto.util.FinalizerService) BoundedExecutor(io.airlift.concurrent.BoundedExecutor) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) LocalMemoryManager(com.facebook.presto.memory.LocalMemoryManager) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) DiscoveryNodeManager(com.facebook.presto.metadata.DiscoveryNodeManager) JsonCodecBinder.jsonCodecBinder(io.airlift.json.JsonCodecBinder.jsonCodecBinder) PageSinkManager(com.facebook.presto.split.PageSinkManager) FlatNetworkTopology(com.facebook.presto.execution.scheduler.FlatNetworkTopology) Set(java.util.Set) ExpressionDeserializer(com.facebook.presto.sql.Serialization.ExpressionDeserializer) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) HttpClientBinder.httpClientBinder(io.airlift.http.client.HttpClientBinder.httpClientBinder) FLAT(com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.FLAT) DiscoveryBinder.discoveryBinder(io.airlift.discovery.client.DiscoveryBinder.discoveryBinder) ConfigBinder.configBinder(io.airlift.configuration.ConfigBinder.configBinder) TypeLiteral(com.google.inject.TypeLiteral) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) Reflection.newProxy(com.google.common.reflect.Reflection.newProxy) Slice(io.airlift.slice.Slice) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) MEGABYTE(io.airlift.units.DataSize.Unit.MEGABYTE) MemoryResource(com.facebook.presto.memory.MemoryResource) ReservedSystemMemoryConfig(com.facebook.presto.memory.ReservedSystemMemoryConfig) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) Binder(com.google.inject.Binder) Type(com.facebook.presto.spi.type.Type) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) PageSorter(com.facebook.presto.spi.PageSorter) NetworkTopology(com.facebook.presto.execution.scheduler.NetworkTopology) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) TransactionManager(com.facebook.presto.transaction.TransactionManager) ResourceGroupManager(com.facebook.presto.execution.resourceGroups.ResourceGroupManager) QueryMonitorConfig(com.facebook.presto.event.query.QueryMonitorConfig) BinarySpillerFactory(com.facebook.presto.spiller.BinarySpillerFactory) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) LocationFactory(com.facebook.presto.execution.LocationFactory) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit) StaticCatalogStoreConfig(com.facebook.presto.metadata.StaticCatalogStoreConfig) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) TaskInfo(com.facebook.presto.execution.TaskInfo) Metadata(com.facebook.presto.metadata.Metadata) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) Block(com.facebook.presto.spi.block.Block) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) MetadataManager(com.facebook.presto.metadata.MetadataManager) NodeVersion(com.facebook.presto.client.NodeVersion) NodeScheduler(com.facebook.presto.execution.scheduler.NodeScheduler) JsonBinder.jsonBinder(io.airlift.json.JsonBinder.jsonBinder) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) NoOpResourceGroupManager(com.facebook.presto.execution.resourceGroups.NoOpResourceGroupManager) Duration(io.airlift.units.Duration) PagesIndex(com.facebook.presto.operator.PagesIndex) MemoryPoolAssignmentsRequest(com.facebook.presto.memory.MemoryPoolAssignmentsRequest) ConnectorManager(com.facebook.presto.connector.ConnectorManager) ExportBinder.newExporter(org.weakref.jmx.guice.ExportBinder.newExporter) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) QueryMonitor(com.facebook.presto.event.query.QueryMonitor) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) ImmutableSet(com.google.common.collect.ImmutableSet) ConditionalModule.installModuleIf(io.airlift.configuration.ConditionalModule.installModuleIf) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) ForExchange(com.facebook.presto.operator.ForExchange) NodeSchedulerExporter(com.facebook.presto.execution.scheduler.NodeSchedulerExporter) BlockEncodingFactory(com.facebook.presto.spi.block.BlockEncodingFactory) SplitManager(com.facebook.presto.split.SplitManager) LEGACY(com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.LEGACY) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) SqlParser(com.facebook.presto.sql.parser.SqlParser) Preconditions.checkState(com.google.common.base.Preconditions.checkState) ExchangeClientConfig(com.facebook.presto.operator.ExchangeClientConfig) DataSize(io.airlift.units.DataSize) ServiceDescriptor(io.airlift.discovery.client.ServiceDescriptor) TransactionManagerConfig(com.facebook.presto.transaction.TransactionManagerConfig) JaxrsBinder.jaxrsBinder(io.airlift.jaxrs.JaxrsBinder.jaxrsBinder) Optional(java.util.Optional) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) PageSinkProvider(com.facebook.presto.split.PageSinkProvider) ForTransactionManager(com.facebook.presto.transaction.ForTransactionManager) QueryManager(com.facebook.presto.execution.QueryManager) Singleton(javax.inject.Singleton) MemoryInfo(com.facebook.presto.memory.MemoryInfo) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) LegacyNetworkTopology(com.facebook.presto.execution.scheduler.LegacyNetworkTopology) BlockEncodingSerde(com.facebook.presto.spi.block.BlockEncodingSerde) AbstractConfigurationAwareModule(io.airlift.configuration.AbstractConfigurationAwareModule) PageSourceManager(com.facebook.presto.split.PageSourceManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) Threads.daemonThreadsNamed(io.airlift.concurrent.Threads.daemonThreadsNamed) TaskManager(com.facebook.presto.execution.TaskManager) LocalMemoryManagerExporter(com.facebook.presto.memory.LocalMemoryManagerExporter) Objects.requireNonNull(java.util.Objects.requireNonNull) IndexManager(com.facebook.presto.index.IndexManager) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) FunctionCallDeserializer(com.facebook.presto.sql.Serialization.FunctionCallDeserializer) ExecutorService(java.util.concurrent.ExecutorService) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) ExchangeClientSupplier(com.facebook.presto.operator.ExchangeClientSupplier) TaskExecutor(com.facebook.presto.execution.TaskExecutor) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) Scopes(com.google.inject.Scopes) CatalogManager(com.facebook.presto.metadata.CatalogManager) CompilerConfig(com.facebook.presto.sql.planner.CompilerConfig) QueryPerformanceFetcherProvider(com.facebook.presto.execution.QueryPerformanceFetcherProvider) FailureDetectorModule(com.facebook.presto.failureDetector.FailureDetectorModule) TypeDeserializer(com.facebook.presto.type.TypeDeserializer) Provides(com.google.inject.Provides) Expression(com.facebook.presto.sql.tree.Expression) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) FailureDetector(com.facebook.presto.failureDetector.FailureDetector) ExpressionSerializer(com.facebook.presto.sql.Serialization.ExpressionSerializer) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) ServerInfo(com.facebook.presto.client.ServerInfo) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) SECONDS(java.util.concurrent.TimeUnit.SECONDS) BlockEncodingManager(com.facebook.presto.block.BlockEncodingManager) TypeRegistry(com.facebook.presto.type.TypeRegistry) PageSourceManager(com.facebook.presto.split.PageSourceManager) NodeVersion(com.facebook.presto.client.NodeVersion) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) QueryPerformanceFetcher(com.facebook.presto.execution.QueryPerformanceFetcher) DataSize(io.airlift.units.DataSize) QueryMonitor(com.facebook.presto.event.query.QueryMonitor) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) ExchangeClientSupplier(com.facebook.presto.operator.ExchangeClientSupplier) NodeScheduler(com.facebook.presto.execution.scheduler.NodeScheduler) NoOpResourceGroupManager(com.facebook.presto.execution.resourceGroups.NoOpResourceGroupManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) QueryPerformanceFetcherProvider(com.facebook.presto.execution.QueryPerformanceFetcherProvider) Optional(java.util.Optional) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) SqlParser(com.facebook.presto.sql.parser.SqlParser) Duration(io.airlift.units.Duration) PauseMeter(io.airlift.stats.PauseMeter) IndexManager(com.facebook.presto.index.IndexManager) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) TaskExecutor(com.facebook.presto.execution.TaskExecutor) BlockEncodingManager(com.facebook.presto.block.BlockEncodingManager) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) Slice(io.airlift.slice.Slice) LegacyNetworkTopology(com.facebook.presto.execution.scheduler.LegacyNetworkTopology) BinarySpillerFactory(com.facebook.presto.spiller.BinarySpillerFactory) Block(com.facebook.presto.spi.block.Block) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) BinarySpillerFactory(com.facebook.presto.spiller.BinarySpillerFactory) LocationFactory(com.facebook.presto.execution.LocationFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) BlockEncodingFactory(com.facebook.presto.spi.block.BlockEncodingFactory) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) BlockEncodingFactory(com.facebook.presto.spi.block.BlockEncodingFactory) PagesIndex(com.facebook.presto.operator.PagesIndex) LocalMemoryManagerExporter(com.facebook.presto.memory.LocalMemoryManagerExporter) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) JoinProbeCompiler(com.facebook.presto.sql.gen.JoinProbeCompiler) TypeLiteral(com.google.inject.TypeLiteral) LocalMemoryManager(com.facebook.presto.memory.LocalMemoryManager) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) PageSinkManager(com.facebook.presto.split.PageSinkManager) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) FlatNetworkTopology(com.facebook.presto.execution.scheduler.FlatNetworkTopology) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) NodeSchedulerExporter(com.facebook.presto.execution.scheduler.NodeSchedulerExporter) BinarySpillerFactory(com.facebook.presto.spiller.BinarySpillerFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) ConnectorManager(com.facebook.presto.connector.ConnectorManager) SplitManager(com.facebook.presto.split.SplitManager) CatalogManager(com.facebook.presto.metadata.CatalogManager) Type(com.facebook.presto.spi.type.Type) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) TaskManager(com.facebook.presto.execution.TaskManager) MetadataManager(com.facebook.presto.metadata.MetadataManager) Expression(com.facebook.presto.sql.tree.Expression) FinalizerService(com.facebook.presto.util.FinalizerService) QueryManager(com.facebook.presto.execution.QueryManager) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) DiscoveryNodeManager(com.facebook.presto.metadata.DiscoveryNodeManager) SystemSessionProperties(com.facebook.presto.SystemSessionProperties)

Example 84 with Optional

use of java.util.Optional in project presto by prestodb.

the class LocalExecutionPlanner method plan.

public LocalExecutionPlan plan(Session session, PlanNode plan, Map<Symbol, Type> types, PartitioningScheme partitioningScheme, OutputBuffer outputBuffer) {
    List<Symbol> outputLayout = partitioningScheme.getOutputLayout();
    if (partitioningScheme.getPartitioning().getHandle().equals(FIXED_BROADCAST_DISTRIBUTION) || partitioningScheme.getPartitioning().getHandle().equals(FIXED_ARBITRARY_DISTRIBUTION) || partitioningScheme.getPartitioning().getHandle().equals(SINGLE_DISTRIBUTION) || partitioningScheme.getPartitioning().getHandle().equals(COORDINATOR_DISTRIBUTION)) {
        return plan(session, plan, outputLayout, types, new TaskOutputFactory(outputBuffer));
    }
    // We can convert the symbols directly into channels, because the root must be a sink and therefore the layout is fixed
    List<Integer> partitionChannels;
    List<Optional<NullableValue>> partitionConstants;
    List<Type> partitionChannelTypes;
    if (partitioningScheme.getHashColumn().isPresent()) {
        partitionChannels = ImmutableList.of(outputLayout.indexOf(partitioningScheme.getHashColumn().get()));
        partitionConstants = ImmutableList.of(Optional.empty());
        partitionChannelTypes = ImmutableList.of(BIGINT);
    } else {
        partitionChannels = partitioningScheme.getPartitioning().getArguments().stream().map(ArgumentBinding::getColumn).map(outputLayout::indexOf).collect(toImmutableList());
        partitionConstants = partitioningScheme.getPartitioning().getArguments().stream().map(argument -> {
            if (argument.isConstant()) {
                return Optional.of(argument.getConstant());
            }
            return Optional.<NullableValue>empty();
        }).collect(toImmutableList());
        partitionChannelTypes = partitioningScheme.getPartitioning().getArguments().stream().map(argument -> {
            if (argument.isConstant()) {
                return argument.getConstant().getType();
            }
            return types.get(argument.getColumn());
        }).collect(toImmutableList());
    }
    PartitionFunction partitionFunction = nodePartitioningManager.getPartitionFunction(session, partitioningScheme, partitionChannelTypes);
    OptionalInt nullChannel = OptionalInt.empty();
    Set<Symbol> partitioningColumns = partitioningScheme.getPartitioning().getColumns();
    // partitioningColumns expected to have one column in the normal case, and zero columns when partitioning on a constant
    checkArgument(!partitioningScheme.isReplicateNulls() || partitioningColumns.size() <= 1);
    if (partitioningScheme.isReplicateNulls() && partitioningColumns.size() == 1) {
        nullChannel = OptionalInt.of(outputLayout.indexOf(getOnlyElement(partitioningColumns)));
    }
    return plan(session, plan, outputLayout, types, new PartitionedOutputFactory(partitionFunction, partitionChannels, partitionConstants, nullChannel, outputBuffer, maxPagePartitioningBufferSize));
}
Also used : PartitionFunction(com.facebook.presto.operator.PartitionFunction) Optional(java.util.Optional) NullableValue(com.facebook.presto.spi.predicate.NullableValue) OptionalInt(java.util.OptionalInt) PartitionedOutputFactory(com.facebook.presto.operator.PartitionedOutputOperator.PartitionedOutputFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Type(com.facebook.presto.spi.type.Type) TaskOutputFactory(com.facebook.presto.operator.TaskOutputOperator.TaskOutputFactory)

Example 85 with Optional

use of java.util.Optional in project presto by prestodb.

the class LogicalPlanner method createInsertPlan.

private RelationPlan createInsertPlan(Analysis analysis, Insert insertStatement) {
    Analysis.Insert insert = analysis.getInsert().get();
    TableMetadata tableMetadata = metadata.getTableMetadata(session, insert.getTarget());
    List<ColumnMetadata> visibleTableColumns = tableMetadata.getColumns().stream().filter(column -> !column.isHidden()).collect(toImmutableList());
    List<String> visibleTableColumnNames = visibleTableColumns.stream().map(ColumnMetadata::getName).collect(toImmutableList());
    RelationPlan plan = createRelationPlan(analysis, insertStatement.getQuery());
    Map<String, ColumnHandle> columns = metadata.getColumnHandles(session, insert.getTarget());
    Assignments.Builder assignments = Assignments.builder();
    for (ColumnMetadata column : tableMetadata.getColumns()) {
        if (column.isHidden()) {
            continue;
        }
        Symbol output = symbolAllocator.newSymbol(column.getName(), column.getType());
        int index = insert.getColumns().indexOf(columns.get(column.getName()));
        if (index < 0) {
            assignments.put(output, new NullLiteral());
        } else {
            Symbol input = plan.getSymbol(index);
            Type tableType = column.getType();
            Type queryType = symbolAllocator.getTypes().get(input);
            if (queryType.equals(tableType) || metadata.getTypeManager().isTypeOnlyCoercion(queryType, tableType)) {
                assignments.put(output, input.toSymbolReference());
            } else {
                Expression cast = new Cast(input.toSymbolReference(), tableType.getTypeSignature().toString());
                assignments.put(output, cast);
            }
        }
    }
    ProjectNode projectNode = new ProjectNode(idAllocator.getNextId(), plan.getRoot(), assignments.build());
    List<Field> fields = visibleTableColumns.stream().map(column -> Field.newUnqualified(column.getName(), column.getType())).collect(toImmutableList());
    Scope scope = Scope.builder().withRelationType(new RelationType(fields)).build();
    plan = new RelationPlan(projectNode, scope, projectNode.getOutputSymbols());
    Optional<NewTableLayout> newTableLayout = metadata.getInsertLayout(session, insert.getTarget());
    return createTableWriterPlan(analysis, plan, new InsertReference(insert.getTarget()), visibleTableColumnNames, newTableLayout);
}
Also used : QualifiedObjectName(com.facebook.presto.metadata.QualifiedObjectName) TableMetadata(com.facebook.presto.metadata.TableMetadata) ExplainAnalyzeNode(com.facebook.presto.sql.planner.plan.ExplainAnalyzeNode) NOT_FOUND(com.facebook.presto.spi.StandardErrorCode.NOT_FOUND) Field(com.facebook.presto.sql.analyzer.Field) TableWriterNode(com.facebook.presto.sql.planner.plan.TableWriterNode) ValuesNode(com.facebook.presto.sql.planner.plan.ValuesNode) BIGINT(com.facebook.presto.spi.type.BigintType.BIGINT) Delete(com.facebook.presto.sql.tree.Delete) Map(java.util.Map) ImmutableCollectors.toImmutableList(com.facebook.presto.util.ImmutableCollectors.toImmutableList) Assignments(com.facebook.presto.sql.planner.plan.Assignments) OutputNode(com.facebook.presto.sql.planner.plan.OutputNode) ImmutableSet(com.google.common.collect.ImmutableSet) Query(com.facebook.presto.sql.tree.Query) Explain(com.facebook.presto.sql.tree.Explain) String.format(java.lang.String.format) SqlParser(com.facebook.presto.sql.parser.SqlParser) Preconditions.checkState(com.google.common.base.Preconditions.checkState) NullLiteral(com.facebook.presto.sql.tree.NullLiteral) List(java.util.List) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) NOT_SUPPORTED(com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED) Analysis(com.facebook.presto.sql.analyzer.Analysis) Optional(java.util.Optional) ConnectorId(com.facebook.presto.connector.ConnectorId) LimitNode(com.facebook.presto.sql.planner.plan.LimitNode) PlanOptimizer(com.facebook.presto.sql.planner.optimizations.PlanOptimizer) LambdaArgumentDeclaration(com.facebook.presto.sql.tree.LambdaArgumentDeclaration) NewTableLayout(com.facebook.presto.metadata.NewTableLayout) WriterTarget(com.facebook.presto.sql.planner.plan.TableWriterNode.WriterTarget) PrestoException(com.facebook.presto.spi.PrestoException) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Type(com.facebook.presto.spi.type.Type) PlanNode(com.facebook.presto.sql.planner.plan.PlanNode) Objects.requireNonNull(java.util.Objects.requireNonNull) Cast(com.facebook.presto.sql.tree.Cast) VARBINARY(com.facebook.presto.spi.type.VarbinaryType.VARBINARY) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) PlanSanityChecker(com.facebook.presto.sql.planner.sanity.PlanSanityChecker) CreateTableAsSelect(com.facebook.presto.sql.tree.CreateTableAsSelect) Session(com.facebook.presto.Session) InsertReference(com.facebook.presto.sql.planner.plan.TableWriterNode.InsertReference) RelationType(com.facebook.presto.sql.analyzer.RelationType) DeleteNode(com.facebook.presto.sql.planner.plan.DeleteNode) Insert(com.facebook.presto.sql.tree.Insert) Scope(com.facebook.presto.sql.analyzer.Scope) ProjectNode(com.facebook.presto.sql.planner.plan.ProjectNode) Expression(com.facebook.presto.sql.tree.Expression) ColumnHandle(com.facebook.presto.spi.ColumnHandle) CreateName(com.facebook.presto.sql.planner.plan.TableWriterNode.CreateName) IdentityLinkedHashMap(com.facebook.presto.util.maps.IdentityLinkedHashMap) TableFinishNode(com.facebook.presto.sql.planner.plan.TableFinishNode) Metadata(com.facebook.presto.metadata.Metadata) Statement(com.facebook.presto.sql.tree.Statement) Cast(com.facebook.presto.sql.tree.Cast) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) NewTableLayout(com.facebook.presto.metadata.NewTableLayout) Assignments(com.facebook.presto.sql.planner.plan.Assignments) InsertReference(com.facebook.presto.sql.planner.plan.TableWriterNode.InsertReference) Field(com.facebook.presto.sql.analyzer.Field) RelationType(com.facebook.presto.sql.analyzer.RelationType) TableMetadata(com.facebook.presto.metadata.TableMetadata) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) ColumnHandle(com.facebook.presto.spi.ColumnHandle) Type(com.facebook.presto.spi.type.Type) RelationType(com.facebook.presto.sql.analyzer.RelationType) Scope(com.facebook.presto.sql.analyzer.Scope) Expression(com.facebook.presto.sql.tree.Expression) Analysis(com.facebook.presto.sql.analyzer.Analysis) ProjectNode(com.facebook.presto.sql.planner.plan.ProjectNode) NullLiteral(com.facebook.presto.sql.tree.NullLiteral)

Aggregations

Optional (java.util.Optional)414 List (java.util.List)208 Map (java.util.Map)138 ArrayList (java.util.ArrayList)107 Set (java.util.Set)95 Collectors (java.util.stream.Collectors)92 IOException (java.io.IOException)85 ImmutableList (com.google.common.collect.ImmutableList)82 ImmutableMap (com.google.common.collect.ImmutableMap)75 Test (org.junit.Test)69 ImmutableSet (com.google.common.collect.ImmutableSet)65 HashMap (java.util.HashMap)65 Path (java.nio.file.Path)55 Logger (org.slf4j.Logger)54 LoggerFactory (org.slf4j.LoggerFactory)53 Collections (java.util.Collections)51 Collection (java.util.Collection)48 Arrays (java.util.Arrays)42 BuildTarget (com.facebook.buck.model.BuildTarget)40 HashSet (java.util.HashSet)37