Search in sources :

Example 1 with PagesSerdeFactory

use of io.hetu.core.transport.execution.buffer.PagesSerdeFactory in project hetu-core by openlookeng.

the class TestBinaryFileSpiller method setUp.

@BeforeMethod
public void setUp() throws IOException {
    Metadata metadata = createTestMetadataManager();
    FileSystemClientManager fileSystemClientManager = mock(FileSystemClientManager.class);
    when(fileSystemClientManager.getFileSystemClient(any(Path.class))).thenReturn(new HetuLocalFileSystemClient(new LocalConfig(new Properties()), Paths.get(spillPath.getCanonicalPath())));
    spillerStats = new SpillerStats();
    FeaturesConfig featuresConfig = new FeaturesConfig();
    try {
        featuresConfig.setSpillerSpillPaths(spillPath.getCanonicalPath());
    } catch (IOException e) {
        System.out.println(e.getStackTrace());
    }
    featuresConfig.setSpillMaxUsedSpaceThreshold(1.0);
    NodeSpillConfig nodeSpillConfig = new NodeSpillConfig();
    singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(metadata, spillerStats, featuresConfig, nodeSpillConfig, fileSystemClientManager);
    factory = new GenericSpillerFactory(singleStreamSpillerFactory);
    PagesSerdeFactory pagesSerdeFactory = new PagesSerdeFactory(metadata.getFunctionAndTypeManager().getBlockEncodingSerde(), nodeSpillConfig.isSpillCompressionEnabled());
    pagesSerde = pagesSerdeFactory.createPagesSerde();
    memoryContext = newSimpleAggregatedMemoryContext();
}
Also used : Path(java.nio.file.Path) LocalConfig(io.hetu.core.filesystem.LocalConfig) FeaturesConfig(io.prestosql.sql.analyzer.FeaturesConfig) Metadata(io.prestosql.metadata.Metadata) IOException(java.io.IOException) Properties(java.util.Properties) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) TestingPagesSerdeFactory(io.prestosql.testing.TestingPagesSerdeFactory) PagesSerdeFactory(io.hetu.core.transport.execution.buffer.PagesSerdeFactory) HetuLocalFileSystemClient(io.hetu.core.filesystem.HetuLocalFileSystemClient) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with PagesSerdeFactory

use of io.hetu.core.transport.execution.buffer.PagesSerdeFactory in project hetu-core by openlookeng.

the class SqlTaskExecutionFactory method create.

public SqlTaskExecution create(String taskInstanceId, Session session, QueryContext queryContext, TaskStateMachine taskStateMachine, OutputBuffer outputBuffer, PlanFragment fragment, List<TaskSource> sources, OptionalInt totalPartitions, Optional<PlanNodeId> consumer, Map<String, CommonTableExecutionContext> cteCtx) {
    TaskContext taskContext = queryContext.addTaskContext(taskInstanceId, taskStateMachine, session, perOperatorCpuTimerEnabled, cpuTimerEnabled, totalPartitions, consumer, new PagesSerdeFactory(metadata.getFunctionAndTypeManager().getBlockEncodingSerde(), isExchangeCompressionEnabled(session)));
    LocalExecutionPlan localExecutionPlan;
    try (SetThreadName ignored = new SetThreadName("Task-%s", taskStateMachine.getTaskId())) {
        try {
            localExecutionPlan = planner.plan(taskContext, fragment.getRoot(), TypeProvider.copyOf(fragment.getSymbols()), fragment.getPartitioningScheme(), fragment.getStageExecutionDescriptor(), fragment.getPartitionedSources(), outputBuffer, fragment.getFeederCTEId(), fragment.getFeederCTEParentId(), cteCtx);
        } catch (Throwable e) {
            // planning failed
            taskStateMachine.failed(e);
            throwIfUnchecked(e);
            throw new RuntimeException(e);
        }
    }
    return createSqlTaskExecution(taskStateMachine, taskContext, outputBuffer, sources, localExecutionPlan, taskExecutor, taskNotificationExecutor, splitMonitor);
}
Also used : LocalExecutionPlan(io.prestosql.sql.planner.LocalExecutionPlanner.LocalExecutionPlan) PagesSerdeFactory(io.hetu.core.transport.execution.buffer.PagesSerdeFactory) TaskContext(io.prestosql.operator.TaskContext) SetThreadName(io.airlift.concurrent.SetThreadName)

Example 3 with PagesSerdeFactory

use of io.hetu.core.transport.execution.buffer.PagesSerdeFactory in project hetu-core by openlookeng.

the class MemoryConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context) {
    requireNonNull(requiredConfig, "requiredConfig is null");
    if (context.getHetuMetastore() == null) {
        throw new IllegalStateException("HetuMetastore must be configured to use the Memory Connector. Please refer to HetuMetastore docs for details.");
    }
    try {
        // A plugin is not required to use Guice; it is just very convenient
        Bootstrap app = new Bootstrap(binder -> {
            binder.bind(PageSorter.class).toInstance(context.getPageSorter());
            binder.bind(FunctionMetadataManager.class).toInstance(context.getFunctionMetadataManager());
            binder.bind(StandardFunctionResolution.class).toInstance(context.getStandardFunctionResolution());
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
            binder.bind(DeterminismEvaluator.class).toInstance(context.getRowExpressionService().getDeterminismEvaluator());
            binder.bind(HetuMetastore.class).toInstance(context.getHetuMetastore());
        }, new MBeanModule(), new MBeanServerModule(), new JsonModule(), new MemoryModule(context.getTypeManager(), context.getNodeManager(), new PagesSerdeFactory(context.getBlockEncodingSerde(), false).createPagesSerde()));
        Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(requiredConfig).initialize();
        synchronized (MemoryThreadManager.class) {
            if (!MemoryThreadManager.isSharedThreadPoolInitilized()) {
                MemoryThreadManager.initSharedThreadPool(injector.getInstance(MemoryConfig.class).getThreadPoolSize());
            }
        }
        MemoryConnector memoryConnector = injector.getInstance(MemoryConnector.class);
        memoryConnector.scheduleRefreshJob();
        return memoryConnector;
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) DeterminismEvaluator(io.prestosql.spi.relation.DeterminismEvaluator) JsonModule(io.airlift.json.JsonModule) FunctionMetadataManager(io.prestosql.spi.function.FunctionMetadataManager) HetuMetastore(io.prestosql.spi.metastore.HetuMetastore) PagesSerdeFactory(io.hetu.core.transport.execution.buffer.PagesSerdeFactory) RowExpressionService(io.prestosql.spi.relation.RowExpressionService) MBeanServerModule(io.prestosql.plugin.base.jmx.MBeanServerModule) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) PageSorter(io.prestosql.spi.PageSorter) TypeManager(io.prestosql.spi.type.TypeManager) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution)

Aggregations

PagesSerdeFactory (io.hetu.core.transport.execution.buffer.PagesSerdeFactory)3 Injector (com.google.inject.Injector)1 Bootstrap (io.airlift.bootstrap.Bootstrap)1 SetThreadName (io.airlift.concurrent.SetThreadName)1 JsonModule (io.airlift.json.JsonModule)1 HetuLocalFileSystemClient (io.hetu.core.filesystem.HetuLocalFileSystemClient)1 LocalConfig (io.hetu.core.filesystem.LocalConfig)1 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)1 Metadata (io.prestosql.metadata.Metadata)1 TaskContext (io.prestosql.operator.TaskContext)1 MBeanServerModule (io.prestosql.plugin.base.jmx.MBeanServerModule)1 PageSorter (io.prestosql.spi.PageSorter)1 FunctionMetadataManager (io.prestosql.spi.function.FunctionMetadataManager)1 StandardFunctionResolution (io.prestosql.spi.function.StandardFunctionResolution)1 HetuMetastore (io.prestosql.spi.metastore.HetuMetastore)1 DeterminismEvaluator (io.prestosql.spi.relation.DeterminismEvaluator)1 RowExpressionService (io.prestosql.spi.relation.RowExpressionService)1 TypeManager (io.prestosql.spi.type.TypeManager)1 FeaturesConfig (io.prestosql.sql.analyzer.FeaturesConfig)1 LocalExecutionPlan (io.prestosql.sql.planner.LocalExecutionPlanner.LocalExecutionPlan)1