Search in sources :

Example 1 with PlanExecutor

use of org.finos.legend.engine.plan.execution.PlanExecutor in project legend-engine by finos.

the class TestStreamInput method testExecutionPlanWithStreamInput.

@Test
public void testExecutionPlanWithStreamInput() {
    String plan = "{\"serializer\":{\"name\":\"pure\",\"version\":\"vX_X_X\"},\"templateFunctions\":[\"<#function renderCollection collection separator><#return collection?join(separator)><\\/#function>\",\"<#function collectionSize collection> <#return collection?size> <\\/#function>\"],\"rootExecutionNode\":{\"_type\":\"relationalBlock\",\"resultType\":{\"tdsColumns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}],\"_type\":\"tds\"},\"executionNodes\":[{\"functionParameters\":[{\"name\":\"id\",\"supportsStream\":false,\"multiplicity\":{\"lowerBound\":0},\"class\":\"String\",\"_type\":\"var\"},{\"name\":\"name\",\"supportsStream\":true,\"multiplicity\":{\"lowerBound\":0},\"class\":\"String\",\"_type\":\"var\"}],\"_type\":\"function-parameters-validation\",\"resultType\":{\"dataType\":\"Boolean\",\"_type\":\"dataType\"}},{\"varName\":\"inFilterClause_name\",\"_type\":\"allocation\",\"resultType\":{\"dataType\":\"String\",\"_type\":\"dataType\"},\"executionNodes\":[{\"freeMarkerBooleanExpression\":\"${(instanceOf(name, \\\"Stream\\\") || ((collectionSize(name)) > 50))?c}\",\"trueBlock\":{\"_type\":\"sequence\",\"resultType\":{\"dataType\":\"String\",\"_type\":\"dataType\"},\"executionNodes\":[{\"inputVarNames\":[\"name\"],\"tempTableName\":\"tempTableForIn_name\",\"tempTableColumnMetaData\":[{\"column\":{\"label\":\"ColumnForStoringInCollection\",\"dataType\":\"VARCHAR(200)\"}}],\"connection\": {\"_type\": \"RelationalDatabaseConnection\",\"type\": \"H2\",\"authenticationStrategy\" : {\"_type\" : \"test\"},\"datasourceSpecification\" : {\"_type\" : \"h2Local\"}},\"_type\":\"createAndPopulateTempTable\",\"resultType\":{\"_type\":\"void\"},\"implementation\":{\"executionClassFullName\":\"com.alloy.plan.root.n2.n1.trueBlock.n1.CreateAndPopulateTempTable\",\"_type\":\"java\"}},{\"values\":{\"values\":[\"select \\\"temptableforin_name_0\\\".ColumnForStoringInCollection as ColumnForStoringInCollection from tempTableForIn_name as \\\"temptableforin_name_0\\\"\"],\"multiplicity\":{\"lowerBound\":1,\"upperBound\":1},\"_type\":\"string\"},\"_type\":\"constant\",\"resultType\":{\"dataType\":\"String\",\"_type\":\"dataType\"}}]},\"falseBlock\":{\"values\":{\"values\":[\"'${renderCollection(name \\\"','\\\")}'\"],\"multiplicity\":{\"lowerBound\":1,\"upperBound\":1},\"_type\":\"string\"},\"_type\":\"constant\",\"resultType\":{\"dataType\":\"String\",\"_type\":\"dataType\"}},\"_type\":\"freeMarkerConditionalExecutionNode\",\"resultType\":{\"dataType\":\"String\",\"_type\":\"dataType\"}}]},{\"_type\":\"relationalTdsInstantiation\",\"resultType\":{\"tdsColumns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}],\"_type\":\"tds\"},\"executionNodes\":[{\"sqlQuery\":\"select \\\"root\\\".name as \\\"name\\\" from employeeTable as \\\"root\\\" where (\\\"root\\\".name in (${inFilterClause_name}) or (${collectionSize(id)}) = 0)\",\"resultColumns\":[{\"label\":\"\\\"name\\\"\",\"dataType\":\"VARCHAR(1000)\"}],\"connection\": {\"_type\": \"RelationalDatabaseConnection\",\"type\": \"H2\",\"authenticationStrategy\" : {\"_type\" : \"test\"},\"datasourceSpecification\" : {\"_type\" : \"h2Local\"}},\"_type\":\"sql\",\"resultType\":{\"dataType\":\"meta::pure::metamodel::type::Any\",\"_type\":\"dataType\"}}]}]},\"authDependent\":false,\"globalImplementationSupport\":{\"classes\":[{\"package\":\"com.alloy.plan.root.n2.n1.trueBlock.n1\",\"name\":\"CreateAndPopulateTempTable\",\"source\":\"package com.alloy.plan.root.n2.n1.trueBlock.n1;\\n\\nimport org.finos.legend.engine.plan.dependencies.store.relational.IRelationalCreateAndPopulateTempTableExecutionNodeSpecifics;\\nimport org.finos.legend.engine.plan.dependencies.util.Library;\\nimport java.util.Arrays;\\nimport java.util.List;\\nimport java.util.Optional;\\nimport java.util.stream.Collector;\\nimport java.util.stream.Collectors;\\nimport java.util.stream.Stream;\\n\\npublic class CreateAndPopulateTempTable implements IRelationalCreateAndPopulateTempTableExecutionNodeSpecifics {\\n\\n    public String getGetterNameForProperty(String p) {\\n        return p == null ? null : Arrays.asList(\\\"get\\\", Library.toOne(Optional.ofNullable(p).map(Stream::of).orElseGet(Stream::empty).map(Library::toUpperFirstCharacter).collect(Collectors.toList()))).stream().collect(Collectors.joining(\\\"\\\"));\\n    }\\n}\\n\"}],\"_type\":\"java\"}}";
    PlanExecutor planExecutor = buildRelationalPlanExecutor();
    Map<String, ?> allInputsAsList = Maps.mutable.with("name", Lists.mutable.with("Alice", "Bob", "Curtis"), "id", Lists.mutable.with("A", "B", "C"));
    RelationalResult resultWithLists = (RelationalResult) planExecutor.execute(plan, allInputsAsList);
    Assert.assertEquals("{\"builder\": {\"_type\":\"tdsBuilder\",\"columns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}]}, \"activities\": [{\"_type\":\"relational\",\"sql\":\"select \\\"root\\\".name as \\\"name\\\" from employeeTable as \\\"root\\\" where (\\\"root\\\".name in ('Alice','Bob','Curtis') or (3) = 0)\"}], \"result\" : {\"columns\" : [\"name\"], \"rows\" : [{\"values\": [\"Alice\"]},{\"values\": [\"Bob\"]},{\"values\": [\"Curtis\"]}]}}", resultWithLists.flush(new RelationalResultToJsonDefaultSerializer(resultWithLists)));
    Map<String, ?> allInputsAsStream = Maps.mutable.with("name", Lists.mutable.with("Alice", "Bob", "Curtis").stream(), "id", Lists.mutable.with("A", "B", "C").stream());
    RelationalResult resultWithStreams = (RelationalResult) planExecutor.execute(plan, allInputsAsStream);
    Assert.assertEquals("{\"builder\": {\"_type\":\"tdsBuilder\",\"columns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}]}, \"activities\": [{\"_type\":\"relational\",\"sql\":\"select \\\"root\\\".name as \\\"name\\\" from employeeTable as \\\"root\\\" where (\\\"root\\\".name in (select \\\"temptableforin_name_0\\\".ColumnForStoringInCollection as ColumnForStoringInCollection from tempTableForIn_name as \\\"temptableforin_name_0\\\") or (3) = 0)\"}], \"result\" : {\"columns\" : [\"name\"], \"rows\" : [{\"values\": [\"Alice\"]},{\"values\": [\"Bob\"]},{\"values\": [\"Curtis\"]}]}}", resultWithStreams.flush(new RelationalResultToJsonDefaultSerializer(resultWithStreams)));
    Map<String, ?> inputsAsListAndStream1 = Maps.mutable.with("name", Lists.mutable.with("Alice", "Bob", "Curtis").stream(), "id", Lists.mutable.with("A", "B", "C"));
    RelationalResult resultWithListAndStream1 = (RelationalResult) planExecutor.execute(plan, inputsAsListAndStream1);
    Assert.assertEquals("{\"builder\": {\"_type\":\"tdsBuilder\",\"columns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}]}, \"activities\": [{\"_type\":\"relational\",\"sql\":\"select \\\"root\\\".name as \\\"name\\\" from employeeTable as \\\"root\\\" where (\\\"root\\\".name in (select \\\"temptableforin_name_0\\\".ColumnForStoringInCollection as ColumnForStoringInCollection from tempTableForIn_name as \\\"temptableforin_name_0\\\") or (3) = 0)\"}], \"result\" : {\"columns\" : [\"name\"], \"rows\" : [{\"values\": [\"Alice\"]},{\"values\": [\"Bob\"]},{\"values\": [\"Curtis\"]}]}}", resultWithListAndStream1.flush(new RelationalResultToJsonDefaultSerializer(resultWithListAndStream1)));
    Map<String, ?> inputsAsListAndStream2 = Maps.mutable.with("name", Lists.mutable.with("Alice", "Bob", "Curtis"), "id", Lists.mutable.with("A", "B", "C").stream());
    RelationalResult resultWithListAndStream2 = (RelationalResult) planExecutor.execute(plan, inputsAsListAndStream2);
    Assert.assertEquals("{\"builder\": {\"_type\":\"tdsBuilder\",\"columns\":[{\"name\":\"name\",\"type\":\"String\",\"relationalType\":\"VARCHAR(1000)\"}]}, \"activities\": [{\"_type\":\"relational\",\"sql\":\"select \\\"root\\\".name as \\\"name\\\" from employeeTable as \\\"root\\\" where (\\\"root\\\".name in ('Alice','Bob','Curtis') or (3) = 0)\"}], \"result\" : {\"columns\" : [\"name\"], \"rows\" : [{\"values\": [\"Alice\"]},{\"values\": [\"Bob\"]},{\"values\": [\"Curtis\"]}]}}", resultWithListAndStream2.flush(new RelationalResultToJsonDefaultSerializer(resultWithListAndStream2)));
}
Also used : RelationalResult(org.finos.legend.engine.plan.execution.stores.relational.result.RelationalResult) RelationalResultToJsonDefaultSerializer(org.finos.legend.engine.plan.execution.stores.relational.serialization.RelationalResultToJsonDefaultSerializer) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) Test(org.junit.Test)

Example 2 with PlanExecutor

use of org.finos.legend.engine.plan.execution.PlanExecutor in project legend-engine by finos.

the class TestM2MGrammarCompileAndExecute method runTest.

private Response runTest(ExecuteInput input) {
    ModelManager modelManager = new ModelManager(DeploymentMode.TEST);
    PlanExecutor executor = PlanExecutor.newPlanExecutor(InMemory.build());
    HttpServletRequest request = (HttpServletRequest) Proxy.newProxyInstance(getClass().getClassLoader(), new java.lang.Class<?>[] { HttpServletRequest.class }, new ReflectiveInvocationHandler(new Request()));
    // Should use: core_pure_extensions_extension.Root_meta_pure_router_extension_defaultExtensions__RouterExtension_MANY_(modelManager.)
    Response result = new Execute(modelManager, executor, (PureModel pureModel) -> Lists.mutable.empty(), LegendPlanTransformers.transformers).execute(request, input, SerializationFormat.defaultFormat, null, null);
    Assert.assertEquals(200, result.getStatus());
    return result;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Response(javax.ws.rs.core.Response) Execute(org.finos.legend.engine.query.pure.api.Execute) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) HttpServletRequest(javax.servlet.http.HttpServletRequest) BeforeClass(org.junit.BeforeClass) Class(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.Class) ModelManager(org.finos.legend.engine.language.pure.modelManager.ModelManager) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel)

Example 3 with PlanExecutor

use of org.finos.legend.engine.plan.execution.PlanExecutor in project legend-engine by finos.

the class Server method run.

@Override
public void run(ServerConfiguration serverConfiguration, Environment environment) {
    loadVaults(serverConfiguration.vaults);
    this.environment = environment;
    DeploymentStateAndVersions.DEPLOYMENT_MODE = serverConfiguration.deployment.mode;
    SDLCLoader sdlcLoader = new SDLCLoader(serverConfiguration.metadataserver, null);
    ModelManager modelManager = new ModelManager(serverConfiguration.deployment.mode, sdlcLoader);
    ChainFixingFilterHandler.apply(environment.getApplicationContext(), serverConfiguration.filterPriorities);
    RelationalStoreExecutor relationalStoreExecutor = (RelationalStoreExecutor) Relational.build(serverConfiguration.relationalexecution);
    PlanExecutor planExecutor = PlanExecutor.newPlanExecutor(relationalStoreExecutor, ServiceStore.build(), InMemory.build());
    // Session Management
    SessionTracker sessionTracker = new SessionTracker();
    environment.servlets().setSessionHandler(new SessionHandler());
    environment.servlets().addServletListeners(sessionTracker);
    environment.jersey().register(new SessionInfo(sessionTracker));
    // API & Swagger
    environment.jersey().setUrlPattern("/api/*");
    ServerShared.registerSwagger(environment, serverConfiguration.swagger);
    // Server
    environment.jersey().register(new Info(serverConfiguration.deployment, serverConfiguration.opentracing));
    environment.jersey().register(new CurrentUser());
    environment.jersey().register(new Memory());
    environment.jersey().register(new RelationalExecutorInformation());
    // Grammar
    environment.jersey().register(new GrammarToJson());
    environment.jersey().register(new JsonToGrammar());
    environment.jersey().register(new RelationalOperationElementGrammarToJson());
    environment.jersey().register(new RelationalOperationElementJsonToGrammar());
    environment.jersey().register(new TransformGrammarToJson());
    environment.jersey().register(new TransformJsonToGrammar());
    environment.jersey().register(new TransformRelationalOperationElementGrammarToJson());
    environment.jersey().register(new TransformRelationalOperationElementJsonToGrammar());
    // Relational
    environment.jersey().register(new SchemaExplorationApi(modelManager, relationalStoreExecutor));
    // Compilation
    environment.jersey().register((DynamicFeature) (resourceInfo, context) -> context.register(new InflateInterceptor()));
    environment.jersey().register(new Compile(modelManager));
    // Generation and Import
    MutableList<GenerationExtension> genExtensions = Iterate.addAllTo(ServiceLoader.load(GenerationExtension.class), Lists.mutable.empty());
    environment.jersey().register(new CodeGenerators(modelManager, genExtensions.select(p -> p.getMode() == GenerationMode.Code).collect(GenerationExtension::getGenerationDescription).select(Objects::nonNull)));
    environment.jersey().register(new CodeImports(modelManager, genExtensions.select(p -> p.getMode() == GenerationMode.Code).collect(GenerationExtension::getImportDescription).select(Objects::nonNull)));
    environment.jersey().register(new SchemaGenerators(modelManager, genExtensions.select(p -> p.getMode() == GenerationMode.Schema).collect(GenerationExtension::getGenerationDescription).select(Objects::nonNull)));
    environment.jersey().register(new SchemaImports(modelManager, genExtensions.select(p -> p.getMode() == GenerationMode.Schema).collect(GenerationExtension::getImportDescription).select(Objects::nonNull)));
    genExtensions.forEach(p -> environment.jersey().register(p.getService(modelManager)));
    // Execution
    MutableList<PlanGeneratorExtension> generatorExtensions = Lists.mutable.withAll(ServiceLoader.load(PlanGeneratorExtension.class));
    Function<PureModel, RichIterable<? extends Root_meta_pure_router_extension_RouterExtension>> routerExtensions = (PureModel pureModel) -> generatorExtensions.flatCollect(e -> e.getExtraRouterExtensions(pureModel));
    environment.jersey().register(new Execute(modelManager, planExecutor, routerExtensions, generatorExtensions.flatCollect(PlanGeneratorExtension::getExtraPlanTransformers)));
    environment.jersey().register(new ExecutePlanStrategic(planExecutor));
    environment.jersey().register(new ExecutePlanLegacy(planExecutor));
    // GraphQL
    environment.jersey().register(new GraphQLGrammar());
    environment.jersey().register(new GraphQLExecute(modelManager, planExecutor, serverConfiguration.metadataserver, generatorExtensions.flatCollect(PlanGeneratorExtension::getExtraPlanTransformers)));
    environment.jersey().register(new GraphQLDebug(modelManager, serverConfiguration.metadataserver));
    // Service
    environment.jersey().register(new ServiceModelingApi(modelManager, serverConfiguration.deployment.mode));
    // Query
    environment.jersey().register(new ApplicationQuery(ApplicationQueryConfiguration.getMongoClient()));
    // Global
    environment.jersey().register(new JsonInformationExceptionMapper());
    environment.jersey().register(new CatchAllExceptionMapper());
    // External Format
    environment.jersey().register(new ExternalFormats(modelManager));
    enableCors(environment);
}
Also used : SessionHandler(org.eclipse.jetty.server.session.SessionHandler) CurrentUser(org.finos.legend.engine.server.core.api.CurrentUser) ExecutePlanStrategic(org.finos.legend.engine.plan.execution.api.ExecutePlanStrategic) Memory(org.finos.legend.engine.server.core.api.Memory) SchemaExplorationApi(org.finos.legend.engine.plan.execution.stores.relational.connection.api.schema.SchemaExplorationApi) LegendPac4jBundle(org.finos.legend.server.pac4j.LegendPac4jBundle) MutableList(org.eclipse.collections.api.list.MutableList) SwaggerBundleConfiguration(io.federecio.dropwizard.swagger.SwaggerBundleConfiguration) RelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementGrammarToJson) ExecutePlanLegacy(org.finos.legend.engine.plan.execution.api.ExecutePlanLegacy) RichIterable(org.eclipse.collections.api.RichIterable) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) GenerationMode(org.finos.legend.engine.external.shared.format.extension.GenerationMode) Info(org.finos.legend.engine.server.core.api.Info) GraphQLGrammar(org.finos.legend.engine.query.graphQL.api.grammar.GraphQLGrammar) NamedType(com.fasterxml.jackson.databind.jsontype.NamedType) SchemaGenerators(org.finos.legend.engine.external.shared.format.generations.loaders.SchemaGenerators) RelationalExecutorInformation(org.finos.legend.engine.plan.execution.stores.relational.api.RelationalExecutorInformation) EnumSet(java.util.EnumSet) Application(io.dropwizard.Application) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel) GraphQLDebug(org.finos.legend.engine.query.graphQL.api.debug.GraphQLDebug) CollectorRegistry(io.prometheus.client.CollectorRegistry) Execute(org.finos.legend.engine.query.pure.api.Execute) ServiceLoader(java.util.ServiceLoader) FilterRegistration(javax.servlet.FilterRegistration) SwaggerBundle(io.federecio.dropwizard.swagger.SwaggerBundle) Iterate(org.eclipse.collections.impl.utility.Iterate) Root_meta_pure_router_extension_RouterExtension(org.finos.legend.pure.generated.Root_meta_pure_router_extension_RouterExtension) ApplicationQuery(org.finos.legend.engine.application.query.api.ApplicationQuery) Objects(java.util.Objects) AssetsBundle(io.dropwizard.assets.AssetsBundle) DynamicFeature(javax.ws.rs.container.DynamicFeature) ExternalFormats(org.finos.legend.engine.external.shared.format.model.api.ExternalFormats) List(java.util.List) RelationalStoreExecutor(org.finos.legend.engine.plan.execution.stores.relational.plugin.RelationalStoreExecutor) CodeGenerators(org.finos.legend.engine.external.shared.format.generations.loaders.CodeGenerators) TransformRelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementGrammarToJson) SDLCLoader(org.finos.legend.engine.language.pure.modelManager.sdlc.SDLCLoader) TransformRelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementJsonToGrammar) ObjectMapperFactory(org.finos.legend.engine.shared.core.ObjectMapperFactory) GraphQLExecute(org.finos.legend.engine.query.graphQL.api.execute.GraphQLExecute) InflateInterceptor(org.finos.legend.engine.shared.core.operational.http.InflateInterceptor) TransformGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.grammarToJson.TransformGrammarToJson) PlanGeneratorExtension(org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension) SchemaImports(org.finos.legend.engine.external.shared.format.imports.loaders.SchemaImports) ServiceStore(org.finos.legend.engine.plan.execution.stores.service.plugin.ServiceStore) LegendDefaultDatabaseAuthenticationFlowProviderConfiguration(org.finos.legend.engine.authentication.LegendDefaultDatabaseAuthenticationFlowProviderConfiguration) CatchAllExceptionMapper(org.finos.legend.engine.server.core.exceptionMappers.CatchAllExceptionMapper) Bootstrap(io.dropwizard.setup.Bootstrap) Function(org.eclipse.collections.api.block.function.Function) GrammarToJson(org.finos.legend.engine.language.pure.grammar.api.grammarToJson.GrammarToJson) Lists(org.eclipse.collections.api.factory.Lists) Vault(org.finos.legend.engine.shared.core.vault.Vault) SessionAttributeBundle(org.finos.legend.engine.server.core.session.SessionAttributeBundle) ServiceModelingApi(org.finos.legend.engine.plan.execution.service.api.ServiceModelingApi) RelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementJsonToGrammar) JsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.jsonToGrammar.JsonToGrammar) CrossOriginFilter(org.eclipse.jetty.servlets.CrossOriginFilter) Environment(io.dropwizard.setup.Environment) CodeImports(org.finos.legend.engine.external.shared.format.imports.loaders.CodeImports) Logger(org.slf4j.Logger) Relational(org.finos.legend.engine.plan.execution.stores.relational.plugin.Relational) GenerationExtension(org.finos.legend.engine.external.shared.format.extension.GenerationExtension) ServerShared(org.finos.legend.engine.server.core.ServerShared) JsonInformationExceptionMapper(org.finos.legend.engine.server.core.exceptionMappers.JsonInformationExceptionMapper) VaultConfiguration(org.finos.legend.engine.shared.core.vault.VaultConfiguration) ListIterate(org.eclipse.collections.impl.utility.ListIterate) SessionInfo(org.finos.legend.engine.server.core.session.api.SessionInfo) SessionHandler(org.eclipse.jetty.server.session.SessionHandler) InMemory(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemory) MultiPartBundle(io.dropwizard.forms.MultiPartBundle) ApplicationQueryConfiguration(org.finos.legend.engine.application.query.configuration.ApplicationQueryConfiguration) TransformJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.jsonToGrammar.TransformJsonToGrammar) ModelManager(org.finos.legend.engine.language.pure.modelManager.ModelManager) DeploymentStateAndVersions(org.finos.legend.engine.shared.core.deployment.DeploymentStateAndVersions) VaultFactory(org.finos.legend.engine.shared.core.vault.VaultFactory) LegendPlanTransformers(org.finos.legend.engine.plan.generation.transformers.LegendPlanTransformers) HostnameHeaderBundle(org.finos.legend.server.shared.bundles.HostnameHeaderBundle) PureProtocolObjectMapperFactory(org.finos.legend.engine.protocol.pure.v1.PureProtocolObjectMapperFactory) DispatcherType(javax.servlet.DispatcherType) ChainFixingFilterHandler(org.finos.legend.server.shared.bundles.ChainFixingFilterHandler) SessionTracker(org.finos.legend.engine.server.core.session.SessionTracker) EngineUrlStreamHandlerFactory(org.finos.legend.engine.shared.core.url.EngineUrlStreamHandlerFactory) Compile(org.finos.legend.engine.language.pure.compiler.api.Compile) CurrentUser(org.finos.legend.engine.server.core.api.CurrentUser) Execute(org.finos.legend.engine.query.pure.api.Execute) GraphQLExecute(org.finos.legend.engine.query.graphQL.api.execute.GraphQLExecute) Memory(org.finos.legend.engine.server.core.api.Memory) InMemory(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemory) RelationalStoreExecutor(org.finos.legend.engine.plan.execution.stores.relational.plugin.RelationalStoreExecutor) SessionInfo(org.finos.legend.engine.server.core.session.api.SessionInfo) ExternalFormats(org.finos.legend.engine.external.shared.format.model.api.ExternalFormats) TransformRelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementJsonToGrammar) RelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementJsonToGrammar) TransformGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.grammarToJson.TransformGrammarToJson) Compile(org.finos.legend.engine.language.pure.compiler.api.Compile) JsonInformationExceptionMapper(org.finos.legend.engine.server.core.exceptionMappers.JsonInformationExceptionMapper) GraphQLExecute(org.finos.legend.engine.query.graphQL.api.execute.GraphQLExecute) ServiceModelingApi(org.finos.legend.engine.plan.execution.service.api.ServiceModelingApi) CatchAllExceptionMapper(org.finos.legend.engine.server.core.exceptionMappers.CatchAllExceptionMapper) RelationalExecutorInformation(org.finos.legend.engine.plan.execution.stores.relational.api.RelationalExecutorInformation) PlanGeneratorExtension(org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension) RelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementGrammarToJson) TransformRelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementGrammarToJson) TransformGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.grammarToJson.TransformGrammarToJson) GrammarToJson(org.finos.legend.engine.language.pure.grammar.api.grammarToJson.GrammarToJson) GraphQLDebug(org.finos.legend.engine.query.graphQL.api.debug.GraphQLDebug) GenerationExtension(org.finos.legend.engine.external.shared.format.extension.GenerationExtension) ExecutePlanLegacy(org.finos.legend.engine.plan.execution.api.ExecutePlanLegacy) ExecutePlanStrategic(org.finos.legend.engine.plan.execution.api.ExecutePlanStrategic) RelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementGrammarToJson) TransformRelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementGrammarToJson) InflateInterceptor(org.finos.legend.engine.shared.core.operational.http.InflateInterceptor) GraphQLGrammar(org.finos.legend.engine.query.graphQL.api.grammar.GraphQLGrammar) SchemaExplorationApi(org.finos.legend.engine.plan.execution.stores.relational.connection.api.schema.SchemaExplorationApi) SchemaImports(org.finos.legend.engine.external.shared.format.imports.loaders.SchemaImports) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) SchemaGenerators(org.finos.legend.engine.external.shared.format.generations.loaders.SchemaGenerators) CodeGenerators(org.finos.legend.engine.external.shared.format.generations.loaders.CodeGenerators) SDLCLoader(org.finos.legend.engine.language.pure.modelManager.sdlc.SDLCLoader) SessionTracker(org.finos.legend.engine.server.core.session.SessionTracker) TransformRelationalOperationElementGrammarToJson(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementGrammarToJson) CodeImports(org.finos.legend.engine.external.shared.format.imports.loaders.CodeImports) ModelManager(org.finos.legend.engine.language.pure.modelManager.ModelManager) Info(org.finos.legend.engine.server.core.api.Info) SessionInfo(org.finos.legend.engine.server.core.session.api.SessionInfo) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel) Root_meta_pure_router_extension_RouterExtension(org.finos.legend.pure.generated.Root_meta_pure_router_extension_RouterExtension) TransformRelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementJsonToGrammar) RelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.RelationalOperationElementJsonToGrammar) JsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.jsonToGrammar.JsonToGrammar) TransformJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.jsonToGrammar.TransformJsonToGrammar) RichIterable(org.eclipse.collections.api.RichIterable) TransformJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.jsonToGrammar.TransformJsonToGrammar) ApplicationQuery(org.finos.legend.engine.application.query.api.ApplicationQuery) Objects(java.util.Objects) TransformRelationalOperationElementJsonToGrammar(org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.TransformRelationalOperationElementJsonToGrammar)

Example 4 with PlanExecutor

use of org.finos.legend.engine.plan.execution.PlanExecutor in project legend-engine by finos.

the class TestPlanExecutor method testPlanExecutorConstructionWithNoConfig.

@Test
public void testPlanExecutorConstructionWithNoConfig() {
    // assert that we construct a plan executor with all known store executors even when no configuration is supplied
    PlanExecutor planExecutor = PlanExecutor.newPlanExecutorWithConfigurations();
    ImmutableList<StoreExecutor> extraExecutors = planExecutor.getExtraExecutors();
    StoreExecutor relationalExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof FakeRelationalStoreExecutorBuilder.Executor);
    assertNotNull("failed to locate relational executor", relationalExecutor);
    StoreExecutor serviceStoreExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof FakeServiceStoreExecutorBuilder.Executor);
    assertNotNull("failed to locate service store executor", serviceStoreExecutor);
    StoreExecutor inmemoryExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof InMemoryStoreExecutor);
    assertNotNull("failed to locate inmemory executor", inmemoryExecutor);
}
Also used : InMemoryStoreExecutor(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor) FakeServiceStoreExecutorBuilder(org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeServiceStoreExecutorBuilder) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) InMemoryStoreExecutor(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor) StoreExecutor(org.finos.legend.engine.plan.execution.stores.StoreExecutor) FakeRelationalStoreExecutorBuilder(org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeRelationalStoreExecutorBuilder) Test(org.junit.Test)

Example 5 with PlanExecutor

use of org.finos.legend.engine.plan.execution.PlanExecutor in project legend-engine by finos.

the class TestPlanExecutor method testPlanExecutorConstructionWithConfig.

@Test
public void testPlanExecutorConstructionWithConfig() {
    // assert that we construct a plan executor with the proper configs
    PlanExecutor planExecutor = PlanExecutor.newPlanExecutorWithConfigurations(new FakeRelationalStoreExecutorBuilder.Configuration(), new FakeServiceStoreExecutorBuilder.Configuration());
    ImmutableList<StoreExecutor> extraExecutors = planExecutor.getExtraExecutors();
    StoreExecutor relationalExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof FakeRelationalStoreExecutorBuilder.Executor);
    assertNotNull("failed to locate relational executor", relationalExecutor);
    StoreExecutorConfiguration relationalConfiguration = ((FakeRelationalStoreExecutorBuilder.Executor) relationalExecutor).getConfiguration();
    assertNotNull("builder not invoked with config", relationalConfiguration);
    StoreExecutor serviceStoreExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof FakeServiceStoreExecutorBuilder.Executor);
    assertNotNull("failed to locate service store executor", serviceStoreExecutor);
    StoreExecutorConfiguration serviceStoreConfiguration = ((FakeServiceStoreExecutorBuilder.Executor) serviceStoreExecutor).getConfiguration();
    assertNotNull("builder not invoked with config", serviceStoreConfiguration);
    StoreExecutor inmemoryExecutor = extraExecutors.detect(storeExecutor -> storeExecutor instanceof InMemoryStoreExecutor);
    assertNotNull("failed to locate inmemory executor", inmemoryExecutor);
}
Also used : InMemoryStoreExecutor(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor) StoreExecutor(org.finos.legend.engine.plan.execution.stores.StoreExecutor) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) InMemoryStoreExecutor(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor) FakeServiceStoreExecutorBuilder(org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeServiceStoreExecutorBuilder) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) InMemoryStoreExecutor(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor) StoreExecutor(org.finos.legend.engine.plan.execution.stores.StoreExecutor) StoreExecutorConfiguration(org.finos.legend.engine.plan.execution.stores.StoreExecutorConfiguration) FakeRelationalStoreExecutorBuilder(org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeRelationalStoreExecutorBuilder) Test(org.junit.Test)

Aggregations

PlanExecutor (org.finos.legend.engine.plan.execution.PlanExecutor)6 PureModel (org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel)3 ModelManager (org.finos.legend.engine.language.pure.modelManager.ModelManager)2 StoreExecutor (org.finos.legend.engine.plan.execution.stores.StoreExecutor)2 InMemoryStoreExecutor (org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemoryStoreExecutor)2 FakeRelationalStoreExecutorBuilder (org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeRelationalStoreExecutorBuilder)2 FakeServiceStoreExecutorBuilder (org.finos.legend.engine.plan.execution.stores.relational.plugin.FakeServiceStoreExecutorBuilder)2 Execute (org.finos.legend.engine.query.pure.api.Execute)2 Test (org.junit.Test)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)1 Application (io.dropwizard.Application)1 AssetsBundle (io.dropwizard.assets.AssetsBundle)1 MultiPartBundle (io.dropwizard.forms.MultiPartBundle)1 Bootstrap (io.dropwizard.setup.Bootstrap)1 Environment (io.dropwizard.setup.Environment)1 SwaggerBundle (io.federecio.dropwizard.swagger.SwaggerBundle)1 SwaggerBundleConfiguration (io.federecio.dropwizard.swagger.SwaggerBundleConfiguration)1 CollectorRegistry (io.prometheus.client.CollectorRegistry)1 EnumSet (java.util.EnumSet)1