diff --git a/h2Console1.4.200.sh b/h2Console1.4.200.sh new file mode 100644 index 00000000000..87a071a35cc --- /dev/null +++ b/h2Console1.4.200.sh @@ -0,0 +1 @@ +java -jar ~/.m2/repository/com/h2database/h2/1.4.200/h2-1.4.200.jar diff --git a/legend-engine-config/legend-engine-configuration/legend-engine-configuration-contract-extension-pure/src/main/resources/core_configuration.definition.json b/legend-engine-config/legend-engine-configuration/legend-engine-configuration-contract-extension-pure/src/main/resources/core_configuration.definition.json index 9ec33f1e43e..b7654749d34 100644 --- a/legend-engine-config/legend-engine-configuration/legend-engine-configuration-contract-extension-pure/src/main/resources/core_configuration.definition.json +++ b/legend-engine-config/legend-engine-configuration/legend-engine-configuration-contract-extension-pure/src/main/resources/core_configuration.definition.json @@ -3,7 +3,7 @@ "pattern": "(meta::pure::extension::configuration)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "core", "core_service", "core_external_language_java", diff --git a/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java b/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java index de34c3cc6de..f01e7d23158 100644 --- a/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java +++ b/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java @@ -517,7 +517,7 @@ protected Iterable getExpectedCodeRepositories() .with("core") .with("core_generation") .with("core_service") - .with("core_functions") + .with("core_functions_unclassified") .with("core_analytics_binding") .with("core_analytics_class") .with("core_analytics_function") @@ -540,6 +540,9 @@ protected Iterable getExpectedCodeRepositories() .with("core_external_query_graphql_metamodel") .with("core_external_query_sql_metamodel") .with("core_function_activator") + .with("core_functions_standard") + .with("core_functions_relation") + .with("core_functions_json") .with("core_external_compiler") .with("core_persistence") .with("core_external_language_daml") diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/pom.xml b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/pom.xml index 675d984a7e2..025d10a6d8e 100644 --- a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/pom.xml +++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/pom.xml @@ -128,6 +128,10 @@ org.finos.legend.engine legend-engine-shared-extensions + + org.finos.legend.engine + legend-engine-shared-structures + org.finos.legend.engine diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/core/commands/Ext.java b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/core/commands/Ext.java index b8c0ecf7330..7fc55942220 100644 --- a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/core/commands/Ext.java +++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/core/commands/Ext.java @@ -19,7 +19,7 @@ import org.finos.legend.engine.repl.core.Command; import org.finos.legend.engine.shared.core.extension.Extensions; import org.finos.legend.engine.shared.core.extension.LegendExtension; -import org.finos.legend.engine.shared.core.extension.TreeNode; +import org.finos.legend.shared.stuctures.TreeNode; import org.jline.reader.Candidate; import org.jline.reader.LineReader; import org.jline.reader.ParsedLine; diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/pom.xml b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/pom.xml index 6ecd30a9fe3..2642b1f0460 100644 --- a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/pom.xml +++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/pom.xml @@ -484,6 +484,10 @@ org.finos.legend.engine legend-engine-shared-core + + org.finos.legend.engine + legend-engine-shared-structures + org.finos.legend.engine legend-engine-shared-vault-core @@ -1047,8 +1051,8 @@ runtime - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json runtime @@ -1069,11 +1073,11 @@ - - - - - + + org.finos.legend.engine + legend-engine-xt-relationalStore-duckdb-PCT + runtime + org.finos.legend.engine legend-engine-xt-javaPlatformBinding-PCT diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java index b1474a4d961..8012083fca1 100644 --- a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java +++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java @@ -134,6 +134,7 @@ import org.finos.legend.engine.server.core.bundles.ErrorHandlingBundle; import org.finos.legend.engine.server.core.exceptionMappers.CatchAllExceptionMapper; import org.finos.legend.engine.server.core.exceptionMappers.JsonInformationExceptionMapper; +import org.finos.legend.engine.server.core.pct.PCT; import org.finos.legend.engine.server.core.session.SessionAttributeBundle; import org.finos.legend.engine.server.core.session.SessionTracker; import org.finos.legend.engine.server.core.session.StoreExecutableManagerSessionListener; @@ -337,6 +338,9 @@ public void run(T serverConfiguration, Environment environment) environment.jersey().register(new ConcurrentExecutionNodeExecutorPoolInfo(Collections.emptyList())); environment.jersey().register(new ParallelGraphFetchExecutionExecutorPoolInfo(parallelGraphFetchExecutionExecutorPool)); + // PCT + environment.jersey().register(new PCT()); + // Protocol environment.jersey().register(new PureProtocol()); diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT.java new file mode 100644 index 00000000000..0167bb1d4bd --- /dev/null +++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT.java @@ -0,0 +1,63 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.server.core.pct; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.finos.legend.pure.m3.pct.aggregate.generation.DocumentationGeneration; +import org.finos.legend.pure.m3.pct.aggregate.model.Documentation; +import org.pac4j.core.profile.CommonProfile; +import org.pac4j.core.profile.ProfileManager; +import org.pac4j.jax.rs.annotations.Pac4JProfileManager; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Api(tags = "PCT") +@Path("pct") +public class PCT +{ + @GET + @Path("html") + @ApiOperation(value = "PCT report in HTML") + @Produces(MediaType.TEXT_HTML) + public Response htmlPCT(@Pac4JProfileManager @ApiParam(hidden = true) ProfileManager pm) + { + return Response.status(200).type(MediaType.TEXT_HTML).entity(PCT_to_SimpleHTML.buildHTML()).build(); + } + + @GET + @Path("json") + @ApiOperation(value = "PCT report in JSON") + @Produces(MediaType.APPLICATION_JSON) + public Response jsonPCT(@Pac4JProfileManager @ApiParam(hidden = true) ProfileManager pm) + { + try + { + Documentation doc = DocumentationGeneration.buildDocumentation(); + return Response.status(200).type(MediaType.APPLICATION_JSON).entity(new ObjectMapper().writeValueAsString(doc)).build(); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT_to_SimpleHTML.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT_to_SimpleHTML.java new file mode 100644 index 00000000000..5b371569ce0 --- /dev/null +++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/core/pct/PCT_to_SimpleHTML.java @@ -0,0 +1,256 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.server.core.pct; + +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.factory.Maps; +import org.eclipse.collections.impl.utility.ListIterate; +import org.finos.legend.pure.m3.pct.aggregate.generation.DocumentationGeneration; +import org.finos.legend.pure.m3.pct.aggregate.model.Documentation; +import org.finos.legend.pure.m3.pct.aggregate.model.FunctionDocumentation; +import org.finos.legend.pure.m3.pct.functions.model.FunctionDefinition; +import org.finos.legend.pure.m3.pct.functions.model.Signature; +import org.finos.legend.pure.m3.pct.reports.model.AdapterKey; +import org.finos.legend.pure.m3.pct.reports.model.FunctionTestResults; +import org.finos.legend.pure.m3.pct.reports.model.TestInfo; +import org.finos.legend.pure.m3.pct.shared.generation.Shared; +import org.finos.legend.shared.stuctures.TreeNode; + +public class PCT_to_SimpleHTML +{ + static MutableMap moduleURLs = Maps.mutable.empty(); + + public static void main(String[] args) throws Exception + { + String html = buildHTML(); + Shared.writeStringToTarget("./target", "ok.html", html); + } + + public static String buildHTML() + { + moduleURLs.put("grammar", "https://github.com/finos/legend-pure/tree/master/legend-pure-core/legend-pure-m3-core/src/main/resources"); + moduleURLs.put("essential", "https://github.com/finos/legend-pure/tree/master/legend-pure-core/legend-pure-m3-core/src/main/resources"); + moduleURLs.put("standard", "https://github.com/finos/legend-engine/tree/master/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-base/legend-engine-pure-functions-standard/src/main/resources/"); + moduleURLs.put("relation", "https://github.com/finos/legend-engine/tree/master/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources"); + + Documentation doc = DocumentationGeneration.buildDocumentation(); + + ListMultimap grouped = Lists.mutable.withAll(doc.adapters).groupBy(x -> x.adapter.group); + MutableList orderedAdapters = grouped.keysView().toSortedList().flatCollect(x -> grouped.get(x).toSortedListBy(z -> z.adapter.name)); + + // Organize by source + MutableListMultimap ordered = Lists.mutable.withAll(doc.functionsDocumentation) + .groupBy(x -> + { + System.out.println(x.functionDefinition.name); + String id = x.functionDefinition.sourceId; + return id.substring(x.reportScope.filePath.length(), id.lastIndexOf("/")); + }); + + + // Build Tree + TreeNode root = new TreeNode("root"); + ordered.keyMultiValuePairsView() + .toSortedListBy(Pair::getOne) + .forEach(x -> + { + TreeNode node = root; + for (String z : x.getOne().split("/")) + { + node = node.createOrReturnChild(z); + } + + for (FunctionDocumentation d : x.getTwo().toSortedListBy(v -> v.functionDefinition.name)) + { + MutableList row = Lists.mutable.empty(); + row.add("
" + d.reportScope.module + "
"); + row.add(printFuncName(d)); + if (!d.functionDefinition.signatures.isEmpty() && d.functionDefinition.signatures.get(0).platformOnly) + { + row.add("
" + d.functionDefinition.testCount + "
Executed outside of PCT
"); + for (int i = 0; i < orderedAdapters.size() - 1; i++) + { + // Should not have any tests... + row.add("
-
"); + } + } + else + { + row.addAll(orderedAdapters.collect(a -> writeTest(d, a))); + } + node.addChild(new TreeNode(row)); + } + } + ); + + return top + + "

\n" + + " \n" + + " \n" + + " \n" + + addGroups(orderedAdapters) + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + addHeaders(orderedAdapters) + "\n" + + " \n" + + root.getChildren().collectWithIndex((n, i) -> addTableRow(n, "", String.valueOf(i), orderedAdapters)).makeString("\n") + + "\n
GroupFunction
\n


\n" + + bottom; + } + + private static String addTableRow(TreeNode node, String tab, String id, MutableList adapters) + { + if (node.getValue() instanceof String) + { + String pos = tab.isEmpty() ? "top" : "bottom"; + String borderLine = "border-" + pos + "-style:solid!important;border-" + pos + "-width:1px!important;" + (tab.equals("") ? "border-" + pos + "-color:#000000;" : "border-" + pos + "-color:#EEEEEE;"); + String emptyCell = " "; + return "" + + "" + tab + " printAllChildrenIds(n, id + "_" + node.getValue(), i)).makeString(", ") + "])\">" + node.getValue() + "" + + emptyCell + + emptyCell + + adapters.collect(c -> emptyCell).makeString("") + + "" + + node.getChildren().collectWithIndex((n, i) -> addTableRow(n, tab + "      ", id + "_" + node.getValue() + "_" + i, adapters)).makeString("\n"); + } + else if (node.getValue() instanceof MutableList) + { + MutableList vals = (MutableList) node.getValue(); + return " " + vals.collect(v -> "" + v + "").makeString("") + ""; + } + else + { + throw new RuntimeException(node.getValue().getClass() + " is not supported!"); + } + } + + private static String printAllChildrenIds(TreeNode node, String parentId, int index) + { + String id = parentId + "_" + index; + return "'" + id + "', " + node.getChildren().collectWithIndex((c, i) -> printAllChildrenIds(c, id + "_" + node.getValue(), i)).makeString(", "); + } + + + private static String writeTest(FunctionDocumentation z, AdapterKey a) + { + FunctionTestResults results = z.functionTestResults.get(a); + if (results != null) + { + MutableList tests = Lists.mutable.withAll(results.tests); + int success = tests.select(t -> t.success).size(); + String color = success == 0 ? "#C70039" : success != tests.size() ? "#FFA500" : "#00C72B"; + return "
" + success + "/" + tests.size() + "
" + testDetail(tests) + "
"; + } + else + { + return "
"; + } + } + + private static String testDetail(MutableList tests) + { + return tests.sortThisBy(x -> x.testName).collect(x -> "" + x.testName + "" + (x.errorMessage == null ? "" : x.errorMessage) + "").makeString("
"); + + } + + private static String printFuncName(FunctionDocumentation functionDocumentation) + { + String module = functionDocumentation.reportScope.module; + FunctionDefinition f = functionDocumentation.functionDefinition; + String color = isPlatformOnly(f) ? "color:#DDDDDD;" : f.name == null ? "color:#79d6db" : "color:#000000;"; + String character = getGrammarCharacter(f); + return (character != null ? "" + character + "  " : "") + "" + (f.name == null ? "composition-tests" : f.name) + ""; + } + + private static String addGroups(MutableList adapterKeys) + { + ListMultimap grouped = adapterKeys.groupBy(x -> x.adapter.group); + return grouped.keysView().toSortedList().collect(x -> "" + x + "").makeString(""); + } + + private static String addHeaders(MutableList adapterKeys) + { + return adapterKeys.collect(c -> c.adapter.name).collect(a -> " " + a + "").makeString("\n"); + } + + public static boolean isPlatformOnly(FunctionDefinition def) + { + return ListIterate.detect(def.signatures, x -> x.platformOnly) != null; + } + + public static String getGrammarCharacter(FunctionDefinition def) + { + Signature signature = ListIterate.detect(def.signatures, x -> x.grammarCharacter != null); + return signature == null ? null : signature.grammarCharacter; + } + + + private static String top = "\n" + + " \n" + + " " + + " \n" + + " \n" + + "\n"; + private static String bottom = + "\n" + + ""; +} diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/GeneratePCTReport.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/GeneratePCTReport.java deleted file mode 100644 index 67002c7cdc1..00000000000 --- a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/GeneratePCTReport.java +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2024 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.server; - -import org.eclipse.collections.api.RichIterable; -import org.eclipse.collections.api.list.MutableList; -import org.eclipse.collections.api.map.MutableMap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Lists; -import org.eclipse.collections.impl.factory.Maps; -import org.eclipse.collections.impl.utility.ListIterate; -import org.finos.legend.pure.m3.pct.aggregate.generation.DocumentationGeneration; -import org.finos.legend.pure.m3.pct.aggregate.model.FunctionDocumentation; -import org.finos.legend.pure.m3.pct.functions.model.FunctionDefinition; -import org.finos.legend.pure.m3.pct.functions.model.Signature; -import org.finos.legend.pure.m3.pct.reports.model.AdapterKey; -import org.finos.legend.pure.m3.pct.reports.model.FunctionTestResults; -import org.finos.legend.pure.m3.pct.reports.model.TestInfo; -import org.finos.legend.pure.m3.pct.shared.generation.Shared; -import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; - -import java.util.Map; - -public class GeneratePCTReport -{ - static MutableMap moduleURLs = Maps.mutable.empty(); - - public static void main(String[] args) throws Exception - { - moduleURLs.put("basic", "https://github.com/finos/legend-pure/tree/master/legend-pure-core/legend-pure-m3-core/src/main/resources"); - moduleURLs.put("grammar", "https://github.com/finos/legend-pure/tree/master/legend-pure-core/legend-pure-m3-core/src/main/resources"); - moduleURLs.put("base", "https://github.com/finos/legend-pure/tree/master/legend-pure-functions/legend-pure-functions-base/legend-pure-m2-functions-base-pure/src/main/resources/"); - moduleURLs.put("relation", "https://github.com/finos/legend-pure/tree/master/legend-pure-functions/legend-pure-functions-relation/legend-pure-m2-functions-relation-pure/src/main/resources"); - - Map f = DocumentationGeneration.buildDocumentation().documentationByName; - - System.out.println("Functions: (" + f.keySet().size() + ") " + f.keySet()); - - System.out.println(""); - - MutableListMultimap ordered = Lists.mutable.withAll(DocumentationGeneration.buildDocumentation().documentationByName.values()).groupBy(x -> x.functionDefinition._package); - - MutableList adapterKeys = PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey).distinct(); - - String html = top + ordered.keyMultiValuePairsView() - .collect(packageAndFunctionDocListPair -> "\n" + - "" + packageAndFunctionDocListPair.getOne() + "\n" + - "

\n" + - " \n" + - " \n" + - " \n" + - addHeaders(adapterKeys) + "\n" + - " \n" + - sortFunctionDef(packageAndFunctionDocListPair.getTwo()).collect(z -> - " \n" + - printFuncName(z.module, z.functionDefinition) + - adapterKeys.collect(a -> writeTest(z, a)).makeString("\n") + "\n" + - " \n" - ).makeString("\n") + - "\n
Name
\n


\n" - ) - .makeString("\n") - + bottom; - - Shared.writeStringToTarget("./target", "ok.html", html); - } - - private static String writeTest(FunctionDocumentation z, AdapterKey a) - { - FunctionTestResults results = z.functionTestResults.get(a); - if (results != null) - { - MutableList tests = Lists.mutable.withAll(results.tests); - int success = tests.select(t -> t.success).size(); - String color = success == 0 ? "#C70039 " : success != tests.size() ? "#FFA500" : "#00C72B"; - return "
" + success + "/" + tests.size() + "
" + testDetail(tests) + "
"; - } - else - { - return " - "; - } - } - - private static String testDetail(MutableList tests) - { - return tests.sortThisBy(x -> x.testName).collect(x -> "" + x.testName + "" + (x.errorMessage == null ? "" : x.errorMessage) + "").makeString("
"); - - } - - private static MutableList sortFunctionDef(RichIterable functionDocumentations) - { - return functionDocumentations.toSortedListBy(funcDoc -> - { - FunctionDefinition funcDef = funcDoc.functionDefinition; - return isPlatformOnly(funcDef) ? "|" + funcDef.name : getGrammarCharacter(funcDef) != null ? "." + funcDef.name : funcDef.name; - }); - } - - private static String printFuncName(String module, FunctionDefinition f) - { - String color = isPlatformOnly(f) ? " style='color:#DDDDDD;text-decoration: line-through;'" : ""; - String character = getGrammarCharacter(f); - return " " + (character != null ? "" + character + "  " + f.name + "" : "" + f.name + "") + "\n"; - } - - private static String addHeaders(MutableList adapterKeys) - { - return adapterKeys.collect(c -> c.adapter.name).collect(a -> " " + a + "").makeString("\n"); - } - - public static boolean isPlatformOnly(FunctionDefinition def) - { - System.out.println(def.name + " " + (ListIterate.detect(def.signatures, x -> x.platformOnly) != null)); - return ListIterate.detect(def.signatures, x -> x.platformOnly) != null; - } - - public static String getDoc(FunctionDefinition def) - { - return ListIterate.detect(def.signatures, x -> x.documentation != null).documentation; - } - - public static String getGrammarCharacter(FunctionDefinition def) - { - Signature signature = ListIterate.detect(def.signatures, x -> x.grammarCharacter != null); - return signature == null ? null : signature.grammarCharacter; - } - - - private static String top = "\n" + - " \n" + - " \n" + - " \n" + - "\n"; - private static String bottom = - "\n" + - ""; -} diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/PrintExtensions.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/PrintExtensions.java index 5fc10a9d2ab..7d6ae2b3a60 100644 --- a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/PrintExtensions.java +++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/test/java/org/finos/legend/engine/server/PrintExtensions.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.list.MutableList; import org.finos.legend.engine.shared.core.extension.Extensions; import org.finos.legend.engine.shared.core.extension.LegendExtension; -import org.finos.legend.engine.shared.core.extension.TreeNode; +import org.finos.legend.shared.stuctures.TreeNode; import org.slf4j.LoggerFactory; public class PrintExtensions diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml index f7cdb8da660..266afea71b8 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml @@ -128,7 +128,7 @@
org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation runtime @@ -137,8 +137,8 @@ legend-pure-runtime-java-engine-compiled
- org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified runtime @@ -150,10 +150,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - @@ -251,8 +247,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ClassMappingThirdPassBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ClassMappingThirdPassBuilder.java index 4f18c3b0fe5..76362a30198 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ClassMappingThirdPassBuilder.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ClassMappingThirdPassBuilder.java @@ -30,7 +30,6 @@ import org.finos.legend.engine.shared.core.operational.Assert; import org.finos.legend.engine.shared.core.operational.errorManagement.EngineException; import org.finos.legend.pure.generated.core_pure_router_operations_router_operations; -import org.finos.legend.pure.generated.platform_functions_meta_getAllTypeGeneralisations; import org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.EnumerationMapping; import org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.InstanceSetImplementation; import org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.Mapping; @@ -49,6 +48,7 @@ import static org.finos.legend.pure.generated.platform_dsl_mapping_functions_Mapping.Root_meta_pure_mapping__classMappingByClass_Mapping_1__Class_1__SetImplementation_MANY_; import static org.finos.legend.pure.generated.platform_dsl_mapping_functions_Mapping.Root_meta_pure_mapping__classMappingByIdRecursive_Mapping_1__String_MANY__SetImplementation_MANY_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_type_getAllTypeGeneralisations.Root_meta_pure_functions_meta_getAllTypeGeneralisations_Type_1__Type_MANY_; public class ClassMappingThirdPassBuilder implements ClassMappingVisitor { @@ -176,7 +176,7 @@ private static void checkPureMappingCompatibility(CompileContext context, Type a private static boolean checkTransformTypeMatchesPropertyType(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property property, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification expression, CompileContext context) { - RichIterable classesTaxonomy = platform_functions_meta_getAllTypeGeneralisations.Root_meta_pure_functions_meta_getAllTypeGeneralisations_Type_1__Type_MANY_(expression._genericType()._rawType(), context.getExecutionSupport()); + RichIterable classesTaxonomy = Root_meta_pure_functions_meta_getAllTypeGeneralisations_Type_1__Type_MANY_(expression._genericType()._rawType(), context.getExecutionSupport()); return classesTaxonomy.contains(property._genericType()._rawType()); } } diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperMappingBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperMappingBuilder.java index 08ad180f774..7638c30b264 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperMappingBuilder.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperMappingBuilder.java @@ -104,7 +104,7 @@ import static org.finos.legend.engine.language.pure.compiler.toPureGraph.HelperModelBuilder.getElementFullPath; import static org.finos.legend.pure.generated.platform_dsl_mapping_functions_Mapping.Root_meta_pure_mapping__allClassMappingsRecursive_Mapping_1__SetImplementation_MANY_; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class HelperMappingBuilder { diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperModelBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperModelBuilder.java index 2e2089fa559..c4384448392 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperModelBuilder.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperModelBuilder.java @@ -41,7 +41,6 @@ import org.finos.legend.pure.generated.Root_meta_pure_metamodel_valuespecification_ClassConstraintValueSpecificationContext_Impl; import org.finos.legend.pure.generated.Root_meta_pure_metamodel_valuespecification_ExpressionSequenceValueSpecificationContext_Impl; import org.finos.legend.pure.generated.Root_meta_pure_metamodel_valuespecification_VariableExpression_Impl; -import org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath; import org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.MilestoningFunctions; import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement; import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PropertyOwner; @@ -67,6 +66,8 @@ import java.util.Objects; import java.util.Optional; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1__String_1_; + public class HelperModelBuilder { private static final Logger LOGGER = LoggerFactory.getLogger(HelperModelBuilder.class); @@ -546,6 +547,6 @@ public static String getElementFullPath(PackageableElement element, String separ return "ModelStore"; } // TODO: we might want to fix a bugs here where if we pass in element without ID/package + name, we might get `cannot cast a collection of multiplicity [0] to [1]` or so - return platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1__String_1_(element, separator, executionSupport); + return Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1__String_1_(element, separator, executionSupport); } } diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationTypeHelper.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationTypeHelper.java index a76aa854999..03627a6a5df 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationTypeHelper.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationTypeHelper.java @@ -42,6 +42,6 @@ public static RelationType convert(org.finos.legend.pure.m3.coreinstance.meta.pu public static org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType convert(RelationType src, ProcessorSupport processorSupport, SourceInformation sourceInformation) { - return _RelationType.build(ListIterate.collect(src.columns, c -> (CoreInstance) _Column.getColumnInstance(c.name, false, null, (GenericType) processorSupport.type_wrapGenericType(_Package.getByUserPath(c.type, processorSupport)), sourceInformation, processorSupport)).toList(), sourceInformation, processorSupport); + return _RelationType.build(ListIterate.collect(src.columns, c -> (CoreInstance) _Column.getColumnInstance(c.name, false, (GenericType) processorSupport.type_wrapGenericType(_Package.getByUserPath(c.type, processorSupport)), sourceInformation, processorSupport)).toList(), sourceInformation, processorSupport); } } diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ValueSpecificationBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ValueSpecificationBuilder.java index d2a50769451..615e098be03 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ValueSpecificationBuilder.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/ValueSpecificationBuilder.java @@ -304,7 +304,7 @@ private ValueSpecification proccessColSpecArray(ColSpecArray value) cols.collect(c -> { Column theCol = ((RelationType) c._genericType()._typeArguments().getLast()._rawType())._columns().getFirst(); - return _Column.getColumnInstance(theCol._name(), false, null, _Column.getColumnType(theCol), null, processorSupport); + return _Column.getColumnInstance(theCol._name(), false, _Column.getColumnType(theCol), null, processorSupport); }), null, processorSupport @@ -365,7 +365,7 @@ else if (colSpec.function2 == null) new Root_meta_pure_metamodel_type_generics_GenericType_Impl("", null, context.pureModel.getClass("meta::pure::metamodel::type::generics::GenericType")) ._rawType( _RelationType.build( - Lists.mutable.with(_Column.getColumnInstance(colSpec.name, false, null, funcReturnType(funcVS, context.pureModel), null, processorSupport)), + Lists.mutable.with(_Column.getColumnInstance(colSpec.name, false, funcReturnType(funcVS, context.pureModel), null, processorSupport)), null, processorSupport ) @@ -405,7 +405,7 @@ else if (colSpec.function2 == null) new Root_meta_pure_metamodel_type_generics_GenericType_Impl("", null, context.pureModel.getClass("meta::pure::metamodel::type::generics::GenericType")) ._rawType( _RelationType.build( - Lists.mutable.with(_Column.getColumnInstance(colSpec.name, false, null, funcReturnType(func2VS, context.pureModel), null, processorSupport)), + Lists.mutable.with(_Column.getColumnInstance(colSpec.name, false, funcReturnType(func2VS, context.pureModel), null, processorSupport)), null, processorSupport ) diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/handlers/Handlers.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/handlers/Handlers.java index 2e175def64f..82f2e4a016a 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/handlers/Handlers.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/handlers/Handlers.java @@ -69,7 +69,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class Handlers { @@ -255,7 +255,7 @@ private static TypeAndMultiplicity getTypeAndMultiplicity(MutableList relType = _RelationType.build( types.flatCollect(RelationTypeAccessor::_columns) - .collect(c -> _Column.getColumnInstance(c._name(), false, null, _Column.getColumnType(c), null, processorSupport)), + .collect(c -> _Column.getColumnInstance(c._name(), false, _Column.getColumnType(c), null, processorSupport)), null, processorSupport ); @@ -295,7 +295,7 @@ public static TypeAndMultiplicity ExtendReturnInference(List Lists.mutable .withAll((RichIterable>) ((RelationType) ps.get(0)._genericType()._typeArguments().getFirst()._rawType())._columns()) .withAll((RichIterable>) ((RelationType) ps.get(1)._genericType()._typeArguments().getLast()._rawType())._columns()) - .collect(c -> (CoreInstance) _Column.getColumnInstance(c._name(), false, null, _Column.getColumnType(c), null, processorSupport)), + .collect(c -> (CoreInstance) _Column.getColumnInstance(c._name(), false, _Column.getColumnType(c), null, processorSupport)), null, processorSupport ); @@ -394,7 +394,7 @@ public static org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation GenericType firstGenericType = new Root_meta_pure_metamodel_type_generics_GenericType_Impl("", null, pureModel.getClass("meta::pure::metamodel::type::generics::GenericType")) ._rawType( _RelationType.build( - Lists.mutable.with(_Column.getColumnInstance(name, false, null, colType, null, ps)), + Lists.mutable.with(_Column.getColumnInstance(name, false, colType, null, ps)), null, ps ) @@ -1106,11 +1106,11 @@ private void registerTDS() { if (c._name().equals(firstCol._name())) { - return (CoreInstance) _Column.getColumnInstance(secondCol._name(), false, null, _Column.getColumnType(c), null, processorSupport); + return (CoreInstance) _Column.getColumnInstance(secondCol._name(), false, _Column.getColumnType(c), null, processorSupport); } else { - return (CoreInstance) _Column.getColumnInstance(c._name(), false, null, _Column.getColumnType(c), null, processorSupport); + return (CoreInstance) _Column.getColumnInstance(c._name(), false, _Column.getColumnType(c), null, processorSupport); } }).toList(), null, diff --git a/legend-engine-core/legend-engine-core-external-format/legend-engine-external-format-language/legend-engine-external-format-generation/src/main/java/org/finos/legend/engine/external/shared/format/model/transformation/Generator.java b/legend-engine-core/legend-engine-core-external-format/legend-engine-external-format-language/legend-engine-external-format-generation/src/main/java/org/finos/legend/engine/external/shared/format/model/transformation/Generator.java index f86c0403eb7..525bfc6c8df 100644 --- a/legend-engine-core/legend-engine-core-external-format/legend-engine-external-format-language/legend-engine-external-format-generation/src/main/java/org/finos/legend/engine/external/shared/format/model/transformation/Generator.java +++ b/legend-engine-core/legend-engine-core-external-format/legend-engine-external-format-language/legend-engine-external-format-generation/src/main/java/org/finos/legend/engine/external/shared/format/model/transformation/Generator.java @@ -19,7 +19,7 @@ import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.externalFormat.Binding; import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class Generator { diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/pom.xml index db4d1da2479..280fdb871f5 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/pom.xml @@ -67,14 +67,19 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-json-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-json-pure + ${project.version} org.finos.legend.pure @@ -111,11 +116,6 @@ legend-pure-m2-store-relational-grammar ${legend.pure.version} - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - @@ -139,13 +139,16 @@ - - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} - org.finos.legend.pure legend-pure-m2-dsl-path-grammar @@ -192,16 +195,17 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json + ${project.version} org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} + @@ -217,10 +221,11 @@ legend-pure-m3-core - - - - + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + + org.finos.legend.pure legend-pure-m2-dsl-store-pure @@ -257,12 +262,11 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-platform-java - org.finos.legend.engine - legend-engine-pure-platform-java + legend-engine-pure-functions-standard-pure org.finos.legend.engine @@ -297,11 +301,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json @@ -344,8 +348,8 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core.definition.json b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core.definition.json index 940efd66c8d..cc98e87c94c 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core.definition.json +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core.definition.json @@ -3,14 +3,14 @@ "pattern": "(meta::json|meta::protocols|meta::external::format::shared|meta::pure|meta::core|meta::external::store::model|meta::alloy|meta::external::format::yaml|meta::legend)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", "platform_dsl_path", "platform_dsl_graph", "platform_dsl_diagram", - "platform_functions_json", "platform_store_relational", - "core_functions" + "core_functions_standard", + "core_functions_unclassified", + "core_functions_json" ] } diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/legend/test/handlersTest.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/legend/test/handlersTest.pure index b15783c4a3e..f9672ce642a 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/legend/test/handlersTest.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/legend/test/handlersTest.pure @@ -219,54 +219,6 @@ Class meta::legend::test::handlers::model::TestAggregation sumIntegers() {$this.integers->sum()}:Integer[1]; } -Class meta::legend::test::handlers::model::StdDev -{ - numbers : Number[*]; - numbersMinOne : Number[1..*]; - floats : Float[*]; - floatsMinOne : Float[1..*]; - integers : Integer[*]; - integersMinOne: Integer[1..*]; - - stdDevPopulationNumber() {$this.numbers->stdDevPopulation()}:Number[1]; - stdDevPopulationNumberMinOne() {$this.numbersMinOne->stdDevPopulation()}:Number[1]; - stdDevPopulationFloat() {$this.floats->stdDevPopulation()}:Number[1]; - stdDevPopulationFloatMinOne() {$this.floatsMinOne->stdDevPopulation()}:Number[1]; - stdDevPopulationInteger() {$this.integers->stdDevPopulation()}:Number[1]; - stdDevPopulationIntegerMinOne() {$this.integersMinOne->stdDevPopulation()}:Number[1]; - - stdDevSampleNumber() {$this.numbers->stdDevSample()}:Number[1]; - stdDevSampleNumberMinOne() {$this.numbersMinOne->stdDevSample()}:Number[1]; - stdDevSampleFloat() {$this.floats->stdDevSample()}:Number[1]; - stdDevSampleFloatMinOne() {$this.floatsMinOne->stdDevSample()}:Number[1]; - stdDevSampleInteger() {$this.integers->stdDevSample()}:Number[1]; - stdDevSampleIntegerMinOne() {$this.integersMinOne->stdDevSample()}:Number[1]; -} - -Class meta::legend::test::handlers::model::Variance -{ - numbers : Number[*]; - numbersMinOne : Number[1..*]; - floats : Float[*]; - floatsMinOne : Float[1..*]; - integers : Integer[*]; - integersMinOne: Integer[1..*]; - - variancePopulationNumber() {$this.numbers->variancePopulation()}:Number[1]; - variancePopulationNumberMinOne() {$this.numbersMinOne->variancePopulation()}:Number[1]; - variancePopulationFloat() {$this.floats->variancePopulation()}:Number[1]; - variancePopulationFloatMinOne() {$this.floatsMinOne->variancePopulation()}:Number[1]; - variancePopulationInteger() {$this.integers->variancePopulation()}:Number[1]; - variancePopulationIntegerMinOne() {$this.integersMinOne->variancePopulation()}:Number[1]; - - varianceSampleNumber() {$this.numbers->varianceSample()}:Number[1]; - varianceSampleNumberMinOne() {$this.numbersMinOne->varianceSample()}:Number[1]; - varianceSampleFloat() {$this.floats->varianceSample()}:Number[1]; - varianceSampleFloatMinOne() {$this.floatsMinOne->varianceSample()}:Number[1]; - varianceSampleInteger() {$this.integers->varianceSample()}:Number[1]; - varianceSampleIntegerMinOne() {$this.integersMinOne->varianceSample()}:Number[1]; -} - Class meta::legend::test::handlers::model::Trigo { number : Number[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/mathExtension.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/mathExtension.pure index 13d8664847d..21c996bf97a 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/mathExtension.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/mathExtension.pure @@ -12,26 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -function meta::pure::functions::math::stdDevSample(numbers:Number[*]):Number[1] -{ - meta::pure::functions::math::stdDev($numbers->toOneMany(), true); -} - -function meta::pure::functions::math::stdDevPopulation(numbers:Number[*]):Number[1] -{ - meta::pure::functions::math::stdDev($numbers->toOneMany(), false); -} - -function meta::pure::functions::math::varianceSample(numbers:Number[*]):Number[1] -{ - pow(stdDevSample($numbers), 2); -} - -function meta::pure::functions::math::variancePopulation(numbers:Number[*]):Number[1] -{ - pow(stdDevPopulation($numbers), 2); -} - function meta::pure::functions::math::pi():Float[1] { 3.141592653589793; @@ -106,15 +86,7 @@ function meta::pure::functions::math::olap::rowNumber(values:Any[*]):Map(); } -function meta::pure::functions::math::stdDevSample(numbers:Number[1..*]):Number[1] -{ - meta::pure::functions::math::stdDev($numbers, true); -} -function meta::pure::functions::math::stdDevPopulation(numbers:Number[1..*]):Number[1] -{ - meta::pure::functions::math::stdDev($numbers, false); -} function meta::pure::functions::math::max(left:Integer[1], right:Integer[1]):Integer[1] { @@ -206,49 +178,20 @@ function meta::pure::functions::math::min(numbers:Number[*]):Number[0..1] $numbers->fold({n, m | min($n, $m->toOne())}, $numbers->first()) } -function meta::pure::functions::math::sum(numbers:Number[*]):Number[1] -{ - $numbers->plus(); -} - -function meta::pure::functions::math::sum(numbers:Integer[*]):Integer[1] -{ - $numbers->plus(); -} - -function meta::pure::functions::math::sum(numbers:Float[*]):Float[1] -{ - $numbers->plus(); -} - -function meta::pure::functions::math::average(numbers:Number[*]):Float[1] -{ - $numbers->mean(); -} - -function meta::pure::functions::math::average(numbers:Integer[*]):Float[1] -{ - $numbers->mean(); -} - -function meta::pure::functions::math::average(numbers:Float[*]):Float[1] -{ - $numbers->mean(); -} function meta::pure::functions::math::mean(numbers:Number[*]):Float[1] { - if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) + $numbers->average(); } function meta::pure::functions::math::mean(numbers:Integer[*]):Float[1] { - if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) + $numbers->average(); } function meta::pure::functions::math::mean(numbers:Float[*]):Float[1] { - if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) + $numbers->average(); } function meta::pure::functions::math::percentile(numbers: Number[*], percentile: Float[1]): Number[0..1] diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/platform/executionPlan/executionPlan_generation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/platform/executionPlan/executionPlan_generation.pure index dd5ec50c7fb..2bc77488c57 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/platform/executionPlan/executionPlan_generation.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/platform/executionPlan/executionPlan_generation.pure @@ -54,7 +54,7 @@ function <> meta::pure::platform::executionPlan::generation::def ^PureExpressionPlatformExecutionNode ( expression = $fe, - resultType = ^ResultType(type=$fe.genericType.rawType->toOne()), + resultType = ^ResultType(type=if($fe.genericType.rawType->isEmpty(),|Any,|$fe.genericType.rawType->toOne())), requiredVariableInputs = $variableExpressionInputs->concatenate($varPlaceHolderInputs), resultSizeRange = $fe.multiplicity, executionNodes = $children, diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/preeval/tests.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/preeval/tests.pure index fa72fb55545..4c90c888fd7 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/preeval/tests.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/preeval/tests.pure @@ -1468,7 +1468,7 @@ function <> meta::pure::router::preeval::tests::testRecursiveSimpleCo if($s == Any, {|[]}, {|$s.properties->concatenate($s.generalizations->map({g|$g.general.rawType->cast(Any) ->toOne() ->hierarchicalProperties()})) - ->removeDuplicates([], [])}) + ->removeDuplicates()}) }; assertRoundTrip($input, $expected); diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/routing/router_routing.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/routing/router_routing.pure index dadff668992..d32bf85d13b 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/routing/router_routing.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/router/routing/router_routing.pure @@ -733,6 +733,7 @@ function meta::pure::router::routing::shouldStopFunctions(extensions:meta::pure: least_X_$1_MANY$__X_1_, variancePopulation_Number_MANY__Number_1_, varianceSample_Number_MANY__Number_1_, + variance_Number_MANY__Boolean_1__Number_1_, makeString_Any_MANY__String_1__String_1_, repeatString_String_$0_1$__Integer_1__String_$0_1$_, agg_FunctionDefinition_1__FunctionDefinition_1__AggregateValue_1_, @@ -756,6 +757,7 @@ function meta::pure::router::routing::shouldStopFunctions(extensions:meta::pure: whenSubType_Any_MANY__T_1__T_MANY_, stdDevSample_Number_MANY__Number_1_, stdDevPopulation_Number_MANY__Number_1_, + stdDev_Number_$1_MANY$__Boolean_1__Number_1_, extend_TabularDataSet_1__BasicColumnSpecification_MANY__TabularDataSet_1_, project_TabularDataSet_1__ColumnSpecification_MANY__TabularDataSet_1_, restrict_TabularDataSet_1__String_MANY__TabularDataSet_1_, @@ -788,6 +790,7 @@ function meta::pure::router::routing::shouldStopFunctions(extensions:meta::pure: typeName_Any_1__String_1_, levenshteinDistance_String_1__String_1__Integer_1_, jaroWinklerSimilarity_String_1__String_1__Float_1_, + meta::pure::tds::extensions::firstNotNull_T_MANY__T_$0_1$_, meta::pure::functions::date::calendar::annualized_Date_1__String_1__Date_1__Number_$0_1$__Number_$0_1$_, meta::pure::functions::date::calendar::cme_Date_1__String_1__Date_1__Number_$0_1$__Number_$0_1$_, @@ -844,7 +847,14 @@ function meta::pure::router::routing::shouldStopFunctions(extensions:meta::pure: meta::pure::functions::math::percentile_Number_MANY__Float_1__Number_$0_1$_, meta::pure::functions::math::percentile_Number_MANY__Float_1__Boolean_1__Boolean_1__Number_$0_1$_, meta::pure::functions::collection::isDistinct_T_MANY__Boolean_1_, - meta::json::toJSON_T_MANY__LambdaFunction_MANY__String_1_ + meta::json::toJSON_T_MANY__LambdaFunction_MANY__String_1_, + removeDuplicates_T_MANY__T_MANY_, + removeDuplicates_T_MANY__Function_1__T_MANY_, + removeDuplicatesBy_T_MANY__Function_1__T_MANY_, + sort_T_m__T_m_, + sort_T_m__Function_$0_1$__T_m_, + sortBy_T_m__Function_$0_1$__T_m_, + sort_T_m__Function_$0_1$__Function_$0_1$__T_m_ ]->concatenate($extensions.routerExtensions().shouldStopRouting) } diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/serialization/toPureGrammar.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/serialization/toPureGrammar.pure index 92da5639d54..8d562764d87 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/serialization/toPureGrammar.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/serialization/toPureGrammar.pure @@ -130,7 +130,7 @@ function meta::pure::metamodel::serialization::grammar::printFunctionExpression( if($functionExpression.parametersValues->isEmpty(), |$name->toOne()+'()', |if ($name == 'getAll', - | $functionExpression.parametersValues->at(0)->cast(@InstanceValue).values->at(0)->cast(@Class)->elementToPath() + '.all()', + |$functionExpression.parametersValues->at(0)->cast(@InstanceValue).genericType.typeArguments->at(0).rawType->toOne()->cast(@Class)->elementToPath() + '.all()';, |let m = special(); if ($m->get($name)->isEmpty(), | let firstParam = $functionExpression.parametersValues->head()->toOne(); diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider deleted file mode 100644 index c803fab7574..00000000000 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider +++ /dev/null @@ -1 +0,0 @@ -org.finos.legend.pure.code.core.CoreCoreFunctionsCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/pom.xml new file mode 100644 index 00000000000..b5aaf3923a6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/pom.xml @@ -0,0 +1,93 @@ + + + + + + org.finos.legend.engine + legend-engine-pure-code-functions-json + 4.50.2-SNAPSHOT + + 4.0.0 + + Legend Pure - Base - M2 Functions - JSON - Pure + legend-engine-pure-functions-json-pure + jar + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + compile + compile + + compile + + + + default-compile + process-classes + + + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.finos.legend.pure + legend-pure-maven-generation-par + + src/main/resources + ${legend.pure.version} + + ${project.basedir}/src/main/resources/core_functions_json.definition.json + + + + + + generate-sources + + build-pure-jar + + + + + + + + + + org.finos.legend.pure + legend-pure-m3-core + + + + junit + junit + + + org.finos.legend.pure + legend-pure-m3-core + test + test-jar + + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/java/org/finos/legend/pure/code/core/CoreCoreFunctionsCodeRepositoryProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/java/org/finos/legend/pure/code/core/JsonCodeRepositoryProvider.java similarity index 82% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/java/org/finos/legend/pure/code/core/CoreCoreFunctionsCodeRepositoryProvider.java rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/java/org/finos/legend/pure/code/core/JsonCodeRepositoryProvider.java index c566e7d36b6..b706a0a5c1c 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/java/org/finos/legend/pure/code/core/CoreCoreFunctionsCodeRepositoryProvider.java +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/java/org/finos/legend/pure/code/core/JsonCodeRepositoryProvider.java @@ -1,4 +1,4 @@ -// Copyright 2023 Goldman Sachs +// Copyright 2021 Goldman Sachs // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; -public class CoreCoreFunctionsCodeRepositoryProvider implements CodeRepositoryProvider +public class JsonCodeRepositoryProvider implements CodeRepositoryProvider { @Override public CodeRepository repository() { - return GenericCodeRepository.build("core_functions.definition.json"); + return GenericCodeRepository.build("core_functions_json.definition.json"); } } diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..2d443698228 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.JsonCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json.definition.json b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json.definition.json new file mode 100644 index 00000000000..4c52df6c3c4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json.definition.json @@ -0,0 +1,5 @@ +{ + "name" : "core_functions_json", + "pattern" : "(meta::json|meta::pure::functions)(::.*)?", + "dependencies" : ["platform"] +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json/json.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json/json.pure new file mode 100644 index 00000000000..bef2a929985 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/main/resources/core_functions_json/json.pure @@ -0,0 +1,99 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::json::*; + +native function meta::json::escape(string:String[1]):String[1]; + +native function meta::json::parseJSON(string:String[1]):meta::json::JSONElement[1]; + +native function meta::json::fromJson(string:String[1], clazz:Class[1], config:JSONDeserializationConfig[1]):T[1]; + +native function meta::json::fromJsonDeprecated(string:String[1], clazz:Class[1], config:JSONDeserializationConfig[1]):T[1]; + +native function meta::json::toJsonBeta(instance: Any[*], config: JSONSerializationConfig[1]):String[1]; + +// This function checks that 2 JSON strings represent semantically same object when deserialized despite having +// different order of key-value pairs because of JSON objects being unordered sets of key/value pairs +native function meta::pure::functions::boolean::equalJsonStrings(left:String[1], right:String[1]):Boolean[1]; + +// JSON model +Class meta::json::JSONElement +{ +} + +Class meta::json::JSONBoolean extends JSONElement +{ + <> value : Boolean[1]; +} + +Class meta::json::JSONString extends JSONElement +{ + <> value : String[1]; +} + +Class meta::json::JSONNumber extends JSONElement +{ + <> value : Number[1]; +} + +Class meta::json::JSONNull extends JSONElement +{ + <> value : Nil[0]; +} + +Class meta::json::JSONArray extends JSONElement +{ + <> values : JSONElement[*]; +} + +Class meta::json::JSONObject extends JSONElement +{ + <> keyValuePairs : JSONKeyValue[*]; +} + +Class meta::json::JSONKeyValue +{ + <> key : JSONString[1]; + <> value : JSONElement[1]; +} + +Class meta::json::JSONConfig +{ + typeKeyName : String[1]; + typeLookup : Pair[*]; +} + +Class meta::json::JSONDeserializationConfig extends JSONConfig +{ + retainTypeField: Boolean[0..1]; + failOnUnknownProperties : Boolean[1]; + constraintsHandler: ConstraintsOverride[0..1]; +} + +Class meta::json::JSONSerializationConfig extends JSONConfig +{ + includeType: Boolean[0..1]; + fullyQualifiedTypePath: Boolean[0..1]; + //This only allows serializing 0 argument qualified properties + serializeQualifiedProperties: Boolean[0..1]; + dateTimeFormat: String[0..1]; + serializePackageableElementName: Boolean[0..1]; + removePropertiesWithEmptyValues: Boolean[0..1]; + serializeMultiplicityAsNumber: Boolean[0..1]; + encryptionKey: String[0..1]; + encryptionStereotypes: Stereotype[*]; + decryptionKey: String[0..1]; + decryptionStereotypes: Stereotype[*]; +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/json/TestFunctionsJsonCompiledStateStrategy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/json/TestFunctionsJsonCompiledStateStrategy.java new file mode 100644 index 00000000000..2cc43504b61 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-functions-json-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/json/TestFunctionsJsonCompiledStateStrategy.java @@ -0,0 +1,27 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.json; + +import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; +import org.junit.BeforeClass; + +public class TestFunctionsJsonCompiledStateStrategy extends AbstractCompiledStateIntegrityTest +{ + @BeforeClass + public static void initialize() + { + initialize("core_functions_json"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/pom.xml new file mode 100644 index 00000000000..c45e6e4f196 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/pom.xml @@ -0,0 +1,185 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-json + 4.50.2-SNAPSHOT + ../pom.xml + + + legend-engine-pure-runtime-java-extension-compiled-functions-json + jar + Legend Pure - Runtime - Java Extension - Compiled - Functions - JSON + + + + + maven-compiler-plugin + + + pre-compile + generate-sources + + compile + + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + true + modular + true + + core_functions_json + + + + + + + org.finos.legend.engine + legend-engine-pure-functions-json-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json + ${project.version} + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.engine + legend-engine-pure-functions-json-pure + runtime + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-conversion + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + org.apache.commons + commons-lang3 + + + + com.googlecode.json-simple + json-simple + + + + org.finos.legend.engine + legend-engine-pure-platform-java + ${project.version} + + + + junit + junit + runtime + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + test-jar + test + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + test + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/CompiledJsonExtraTypeProcessor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/CompiledJsonExtraTypeProcessor.java new file mode 100644 index 00000000000..f9ff8867884 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/CompiledJsonExtraTypeProcessor.java @@ -0,0 +1,32 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.PureMap; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonExtraTypeProcessor; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationContext; + +public class CompiledJsonExtraTypeProcessor implements JsonExtraTypeProcessor +{ + @Override + public Object process(Object pureObject, JsonSerializationContext jsonSerializationContext) + { + if (pureObject instanceof PureMap) + { + return PureMapSerializer.toJson((PureMap) pureObject, jsonSerializationContext); + } + return null; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonExtensionCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonExtensionCompiled.java new file mode 100644 index 00000000000..3dd1b9d978b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonExtensionCompiled.java @@ -0,0 +1,196 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled; + +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.runtime.java.compiled.compiler.StringJavaSource; +import org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.EqualJsonStrings; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.Escape; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.FromJson; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.FromJsonDeprecated; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.ParseJSON; +import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.ToJsonBeta; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonParser; + +import java.util.List; + +public class JsonExtensionCompiled implements CompiledExtension +{ + static + { + JsonParser.processor = new CompiledJsonExtraTypeProcessor(); + } + + @Override + public List getExtraJavaSources() + { + return Lists.fixedSize.with(StringJavaSource.newStringJavaSource("org.finos.legend.pure.generated", "JsonGen", + "package org.finos.legend.pure.generated;\n" + + "\n" + + "import org.eclipse.collections.api.RichIterable;\n" + + "import org.eclipse.collections.impl.list.mutable.FastList;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.functions.collection.Pair;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.ConstraintsOverride;\n" + + "import org.finos.legend.pure.m3.exception.PureExecutionException;\n" + + "import org.finos.legend.pure.m3.execution.ExecutionSupport;\n" + + "import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\n" + + "import org.finos.legend.pure.m4.coreinstance.CoreInstance;\n" + + "import org.finos.legend.pure.m4.coreinstance.SourceInformation;\n" + + "import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.JavaPackageAndImportBuilder;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.CompiledSupport;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.Pure;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.measureUnit.UnitProcessor;\n" + + "import org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.JsonParserHelper;\n" + + "import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializationCache;\n" + + "import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializationContext;\n" + + "import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializer;\n" + + "import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ObjectFactory;\n" + + "\n" + + "import java.lang.reflect.Method;\n" + + "import java.util.HashMap;\n" + + "import java.util.Map;\n" + + "\n" + + "public class JsonGen\n" + + "{\n" + + " @Deprecated\n" + + " public static T fromJsonDeprecated(String json, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class clazz, Root_meta_json_JSONDeserializationConfig config, SourceInformation si, ExecutionSupport es)\n" + + " {\n" + + " java.lang.Class c = ((CompiledExecutionSupport) es).getClassCache().getIfAbsentPutInterfaceForType(clazz);\n" + + " T obj = (T) JsonParserHelper.fromJson(json, c, \"\", \"\", ((CompiledExecutionSupport) es).getMetadataAccessor(), ((CompiledExecutionSupport) es).getClassLoader(), si, config._typeKeyName(), config._failOnUnknownProperties(), config._constraintsHandler(), es);\n" + + " return (T) Pure.handleValidation(true, obj, si, es);\n" + + " }\n" + + "\n" + + " public static String toJson(Object pureObject, Root_meta_json_JSONSerializationConfig jsonConfig, final SourceInformation si, final ExecutionSupport es)\n" + + " {\n" + + " return toJson(CompiledSupport.toPureCollection(pureObject), jsonConfig, si, es);\n" + + " }\n" + + "\n" + + " private static String toJson(RichIterable pureObject, Root_meta_json_JSONSerializationConfig jsonConfig, final SourceInformation si, final ExecutionSupport es)\n" + + " {\n" + + " String typeKeyName = jsonConfig._typeKeyName();\n" + + " boolean includeType = jsonConfig._includeType() != null ? jsonConfig._includeType() : false;\n" + + " boolean fullyQualifiedTypePath = jsonConfig._fullyQualifiedTypePath() != null ? jsonConfig._fullyQualifiedTypePath() : false;\n" + + " boolean serializeQualifiedProperties = jsonConfig._serializeQualifiedProperties() != null ? jsonConfig._serializeQualifiedProperties() : false;\n" + + " String dateTimeFormat = jsonConfig._dateTimeFormat();\n" + + " boolean serializePackageableElementName = jsonConfig._serializePackageableElementName() != null ? jsonConfig._serializePackageableElementName() : false;\n" + + " boolean removePropertiesWithEmptyValues = jsonConfig._removePropertiesWithEmptyValues() != null ? jsonConfig._removePropertiesWithEmptyValues() : false;\n" + + " boolean serializeMultiplicityAsNumber = jsonConfig._serializeMultiplicityAsNumber() != null ? jsonConfig._serializeMultiplicityAsNumber() : false;\n" + + " String encryptionKey = jsonConfig._encryptionKey();\n" + + " String decryptionKey = jsonConfig._decryptionKey();\n" + + " RichIterable encryptionStereotypes = jsonConfig._encryptionStereotypes();\n" + + " RichIterable decryptionStereotypes = jsonConfig._decryptionStereotypes();\n" + + "\n" + + " return org.finos.legend.pure.runtime.java.extension.external.json.compiled.JsonNativeImplementation._toJson(pureObject, si, es, typeKeyName, includeType, fullyQualifiedTypePath, serializeQualifiedProperties, dateTimeFormat, serializePackageableElementName, removePropertiesWithEmptyValues, serializeMultiplicityAsNumber, encryptionKey, decryptionKey, encryptionStereotypes, decryptionStereotypes);\n" + + " }\n" + + "\n" + + " public static T fromJson(String json, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class clazz, Root_meta_json_JSONDeserializationConfig config, final SourceInformation si, final ExecutionSupport es)\n" + + " {\n" + + " final ConstraintsOverride constraintsHandler = config._constraintsHandler();\n" + + " final RichIterable> _typeLookup = config._typeLookup();\n" + + " return _fromJson(json, clazz, config._typeKeyName(), config._failOnUnknownProperties(), si, es, constraintsHandler, _typeLookup);\n" + + " }\n" + + "\n" + + " public static T _fromJson(String json, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class clazz, String _typeKeyName, boolean _failOnUnknownProperties, final SourceInformation si, final ExecutionSupport es, final ConstraintsOverride constraintsHandler, RichIterable> _typeLookup)\n" + + " {\n" + + " java.lang.Class c;\n" + + " String targetClassName = null;\n" + + " try\n" + + " {\n" + + " targetClassName = JavaPackageAndImportBuilder.platformJavaPackage() + \".Root_\" + Pure.elementToPath(clazz, \"_\");\n" + + " c = ((CompiledExecutionSupport) es).getClassLoader().loadClass(targetClassName);\n" + + " }\n" + + " catch (ClassNotFoundException e)\n" + + " {\n" + + " throw new RuntimeException(\"Unable to find class \" + targetClassName, e);\n" + + " }\n" + + "\n" + + "\n" + + " Map typeLookup = new HashMap();\n" + + " for (Pair pair : _typeLookup)\n" + + " {\n" + + " typeLookup.put(pair._first(), ((CompiledExecutionSupport) es).getMetadataAccessor().getClass(\"Root::\" + pair._second()));\n" + + " }\n" + + "\n" + + " return (T) JsonDeserializer.fromJson(json, (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class) clazz, new JsonDeserializationContext(new JsonDeserializationCache(), si, ((CompiledExecutionSupport) es).getProcessorSupport(), _typeKeyName, typeLookup, _failOnUnknownProperties, new ObjectFactory()\n" + + " {\n" + + " public U newObject(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class clazz, Map> properties)\n" + + " {\n" + + " FastList keyValues = new FastList<>();\n" + + " for (Map.Entry> property : properties.entrySet())\n" + + " {\n" + + " Root_meta_pure_functions_lang_KeyValue keyValue = new Root_meta_pure_functions_lang_KeyValue_Impl(\"Anonymous\");\n" + + " keyValue._key(property.getKey());\n" + + " for (Object value : property.getValue())\n" + + " {\n" + + " keyValue._valueAdd(value);\n" + + " }\n" + + " keyValues.add(keyValue);\n" + + " }\n" + + " U result = (U) org.finos.legend.pure.generated.CoreGen.newObject(clazz, keyValues, null, null, null, null, null, null, es);\n" + + " result._elementOverride(constraintsHandler);\n" + + " return (U) Pure.handleValidation(true, result, si, es);\n" + + " }\n" + + "\n" + + " public T newUnitInstance(CoreInstance propertyType, String unitTypeString, Number unitValue) throws Exception\n" + + " {\n" + + " CoreInstance unitRetrieved = ((CompiledExecutionSupport) es).getProcessorSupport().package_getByUserPath(unitTypeString);\n" + + " if (!((CompiledExecutionSupport) es).getProcessorSupport().type_subTypeOf(unitRetrieved, propertyType))\n" + + " {\n" + + " throw new PureExecutionException(\"Cannot match unit type: \" + unitTypeString + \" as subtype of type: \" + PackageableElement.getUserPathForPackageableElement(propertyType));\n" + + " }\n" + + "\n" + + " String unitClassName = UnitProcessor.convertToJavaCompatibleClassName(JavaPackageAndImportBuilder.buildImplUnitInstanceClassNameFromType(unitRetrieved));\n" + + "\n" + + " java.lang.Class c = ((CompiledExecutionSupport) es).getClassLoader().loadClass(\"org.finos.legend.pure.generated.\" + unitClassName);\n" + + "\n" + + " java.lang.Class paramClasses[] = new java.lang.Class[]{String.class, ExecutionSupport.class};\n" + + " Method method = c.getMethod(\"_val\", Number.class);\n" + + " Object classInstance = c.getConstructor(paramClasses).newInstance(\"Anonymous_NoCounter\", es);\n" + + " method.invoke(classInstance, unitValue);\n" + + " return (T) classInstance;\n" + + " }\n" + + " }));\n" + + " }\n" + + "}\n", false)); + } + + @Override + public List getExtraNatives() + { + return Lists.fixedSize.with( + new EqualJsonStrings(), + new Escape(), + new FromJson(), + new FromJsonDeprecated(), + new ParseJSON(), + new ToJsonBeta() + ); + } + + @Override + public String getRelatedRepository() + { + return "core_functions_json"; + } + + public static CompiledExtension extension() + { + return new JsonExtensionCompiled(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonNativeImplementation.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonNativeImplementation.java new file mode 100644 index 00000000000..c4861fa0469 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/JsonNativeImplementation.java @@ -0,0 +1,102 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.PureMap; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationCache; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationContext; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializer; + +import java.lang.reflect.Method; +import java.util.Stack; + +public class JsonNativeImplementation +{ + public static String _toJson(RichIterable pureObject, SourceInformation si, ExecutionSupport es, String typeKeyName, boolean includeType, boolean fullyQualifiedTypePath, boolean serializeQualifiedProperties, String dateTimeFormat, boolean serializePackageableElementName, boolean removePropertiesWithEmptyValues, boolean serializeMultiplicityAsNumber, String encryptionKey, String decryptionKey, RichIterable encryptionStereotypes, RichIterable decryptionStereotypes) + { + return JsonSerializer.toJson(pureObject, ((CompiledExecutionSupport)es).getProcessorSupport(), new JsonSerializationContext(new JsonSerializationCache(), si, ((CompiledExecutionSupport)es).getProcessorSupport(), new Stack(), typeKeyName, includeType, fullyQualifiedTypePath, serializeQualifiedProperties, dateTimeFormat, serializePackageableElementName, removePropertiesWithEmptyValues, serializeMultiplicityAsNumber, encryptionKey, encryptionStereotypes, decryptionKey, decryptionStereotypes) + { + @Override + protected Object extractPrimitiveValue(Object potentiallyWrappedPrimitive) + { + return potentiallyWrappedPrimitive; + } + + @Override + protected RichIterable getValueForProperty(Any pureObject, Property property, String className) + { + return this.findAndInvokePropertyMethod(pureObject, property.getName(), className, false); + } + + @Override + protected Object evaluateQualifiedProperty(Any pureObject, QualifiedProperty qualifiedProperty, Type type, Multiplicity multiplicity, String propertyName) + { + return this.findAndInvokePropertyMethod(pureObject, propertyName, pureObject.getName(), true); + } + + @Override + protected CoreInstance getClassifier(Any pureObject) + { + return ((CompiledExecutionSupport)es).getProcessorSupport().getClassifier(pureObject); + } + + @Override + protected RichIterable getMapKeyValues(Any pureObject) + { + return ((PureMap)pureObject).getMap().keyValuesView(); + } + + private RichIterable findAndInvokePropertyMethod(Any pureObject, String propertyName, String className, boolean isQualified) + { + Method propertyGetter = null; + try + { + Object value; + if (isQualified) + { + propertyGetter = pureObject.getClass().getMethod(propertyName, ExecutionSupport.class); + value = propertyGetter.invoke(pureObject, es); + } + else + { + propertyGetter = pureObject.getClass().getMethod("_" + propertyName); + value = propertyGetter.invoke(pureObject); + } + return value instanceof RichIterable ? (RichIterable)value : Lists.immutable.of(value); + } + catch (NoSuchMethodException e) + { + throw new PureExecutionException(si, "Error retrieving value of a property: " + propertyName + " from the class " + className + ". Property might not exist", e); + } + catch (Exception e) + { + throw new PureExecutionException(si, "Error serializing property: " + propertyName, e); + } + } + }, si); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/PureMapSerializer.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/PureMapSerializer.java new file mode 100644 index 00000000000..42d39b7a24e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/PureMapSerializer.java @@ -0,0 +1,67 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled; + +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.eclipse.collections.api.block.procedure.Procedure2; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.TypeCoreInstanceWrapper; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.PureMap; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; + +public class PureMapSerializer +{ + public static JSONObject toJson(PureMap pureMap, final JsonSerializationContext context) + { + final JSONObject result = new JSONObject(); + pureMap.getMap().forEachKeyValue(new Procedure2() + { + @Override + public void value(Object key, Object value) + { + if (!(key instanceof String)) + { + throw new PureExecutionException("Only String-key map conversions are supported, found key: " + key); + } + result.put(key, toJson(value, context)); + } + }); + return result; + } + + private static Object toJson(Object value, JsonSerializationContext context) + { + if (value instanceof CoreInstance) + { + CoreInstance valueCoreInstance = (CoreInstance)value; + CoreInstance valueClassifier = context.getProcessorSupport().getClassifier(valueCoreInstance); + Conversion valConcreteConversion = (Conversion)context.getConversionCache().getConversion(TypeCoreInstanceWrapper.toType(valueClassifier), context); + return valConcreteConversion.apply(value, context); + } + if (value instanceof PureMap) + { + return toJson((PureMap)value, context); + } + if (value instanceof String) + { + return JSONValue.escape((String)value); + } + // non-string primitive type (hopefully) + return value; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/EqualJsonStrings.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/EqualJsonStrings.java new file mode 100644 index 00000000000..c66b21da374 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/EqualJsonStrings.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.CompiledSupport; + +public class EqualJsonStrings extends AbstractNativeFunctionGeneric +{ + public EqualJsonStrings() + { + super(AbstractNativeFunctionGeneric.getMethod(CompiledSupport.class, "jsonStringEquals"), + true, false, false, "equalJsonStrings_String_1__String_1__Boolean_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/Escape.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/Escape.java new file mode 100644 index 00000000000..74b773437a2 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/Escape.java @@ -0,0 +1,26 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.CompiledSupport; + +public class Escape extends AbstractNativeFunctionGeneric +{ + public Escape() + { + super(AbstractNativeFunctionGeneric.getMethod(CompiledSupport.class, "escapeJSON"), "escape_String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJson.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJson.java new file mode 100644 index 00000000000..71a3dd1aea6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJson.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class FromJson extends AbstractNativeFunctionGeneric +{ + public FromJson() + { + super("org.finos.legend.pure.generated.JsonGen.fromJson", + new Object[]{String.class, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class.class, "org.finos.legend.pure.generated.Root_meta_json_JSONDeserializationConfig", SourceInformation.class, ExecutionSupport.class}, + true, true, false, "fromJson_String_1__Class_1__JSONDeserializationConfig_1__T_1_"); + } + + @Override + protected String buildM4SourceInformation(SourceInformation si) + { + return NativeFunctionProcessor.buildM4SourceInformation(si); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJsonDeprecated.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJsonDeprecated.java new file mode 100644 index 00000000000..372f3eb040c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/FromJsonDeprecated.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class FromJsonDeprecated extends AbstractNativeFunctionGeneric +{ + public FromJsonDeprecated() + { + super("org.finos.legend.pure.generated.JsonGen.fromJsonDeprecated", new Object[]{String.class, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class.class, "org.finos.legend.pure.generated.Root_meta_json_JSONDeserializationConfig", SourceInformation.class, ExecutionSupport.class}, + true, true, false, "fromJsonDeprecated_String_1__Class_1__JSONDeserializationConfig_1__T_1_"); + } + + @Override + protected String buildM4SourceInformation(SourceInformation si) + { + return NativeFunctionProcessor.buildM4SourceInformation(si); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/JsonParserHelper.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/JsonParserHelper.java new file mode 100644 index 00000000000..5a42313aba4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/JsonParserHelper.java @@ -0,0 +1,341 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.apache.commons.lang3.reflect.MethodUtils; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.ConstraintsOverride; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateTime; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.compiled.generation.JavaPurePrimitiveTypeMapping; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; +import org.finos.legend.pure.runtime.java.compiled.metadata.MetadataAccessor; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Map; + +/* Helper class use by the generated code to deserialize JSON. + */ +@SuppressWarnings("unused") +public class JsonParserHelper +{ + public static final String JSON_FACTORY = "_JsonFactory"; + + /** + * Ensures a given JSON array meets the multiplicity requirements of the PURE class. + * + * @param array The JSON array in question. + * @param lowerBound The lower bound of the property's multiplicity + * @param upperBound The upper bound of the property's multiplicity, -1 if multiplicity has no upper bound + */ + public static void multiplicityIsInRange(JSONArray array, int lowerBound, int upperBound, String humanReadableMultiplicity, SourceInformation si) + { + boolean outsideLowerBound = array.size() < lowerBound; + boolean outsideUpperBound = upperBound != -1 && array.size() > upperBound; + + if (outsideLowerBound || outsideUpperBound) + { + throw new PureExecutionException(si, "Expected value(s) of multiplicity " + humanReadableMultiplicity + ", found " + array.size() + " value(s)."); + } + } + + /** + * Checks the multiplicity of a "to one" property field. + * + * @param object The object in question, null if does not occur in source JSONObject + * @param lowerBound The lower bound of the property's multiplicity + * @param upperBound The upper bound of the property's multiplicity, -1 if the multiplicity has no upper bound + */ + public static void multiplicityIsInRange(Object object, int lowerBound, int upperBound, String humanReadableMultiplicity, SourceInformation si) + { + boolean outsideLowerBound = (object == null && lowerBound == 1) || lowerBound > 1; + boolean outsideUpperBound = object != null && upperBound == 0; + + String errorMsg = object == null ? "0" : "1"; + + if (outsideLowerBound || outsideUpperBound) + { + throw new PureExecutionException(si, "Expected value(s) of multiplicity " + humanReadableMultiplicity + ", found " + errorMsg + " value(s)."); + } + } + + /*This method is invoked by the native function.*/ + @SuppressWarnings("unused") + public static T fromJson(String jsonString, Class clazz, String fullClassName, String fullUserPath, MetadataAccessor metadata, ClassLoader classLoader, + SourceInformation si, String typeKey, boolean failOnUnknownProperties, ConstraintsOverride constraintsOverride, ExecutionSupport es) + { + JSONParser parser = new JSONParser(); + try + { + JSONObject root = (JSONObject) parser.parse(jsonString); + return fromJson(root, clazz, fullClassName, fullUserPath, metadata, classLoader, si, typeKey, failOnUnknownProperties, constraintsOverride, es, ""); + } + catch (ParseException e) + { + throw new RuntimeException("Unable to parse json string " + jsonString, e); + } + } + + /** + * Checks that the value being extracted from the JSON (actualValue) is of the expected type. + * + * @param actualValue The value extracted from the JSON. + * @param expectedJavaType The expected Java type of the value. + * @param expectedPureType The expected Pure type. + * @param sourceInfo Source information for an exception message. + * @throws PureExecutionException Exception information describes property on class being assigned, as well as the expected and actual types. For example, + * "Error populating property 'testField' on class 'meta::pure::functions::json::tests::testClass': Expected class java.lang.Boolean, found String" + */ + private static void typeCheck(Object actualValue, Class expectedJavaType, String expectedPureType, SourceInformation sourceInfo) + { + if (!expectedJavaType.isInstance(actualValue)) + { + String actualType; + if (actualValue instanceof Map) + { + actualType = "JSON object"; + } + else if (actualValue instanceof List) + { + actualType = "JSON array"; + } + else + { + actualType = JavaPurePrimitiveTypeMapping.getPureM3TypeFromJavaPrimitivesAndDates(actualValue); + if (actualType == null) + { + actualType = actualValue.getClass().getSimpleName(); + } + } + throw new PureExecutionException("Expected " + expectedPureType + ", found " + actualType); + } + } + + @SuppressWarnings({"unused", "unchecked"}) + public static T fromJson(Object value, Class resultType, String fullClassName, String fullUserPath, MetadataAccessor metadata, ClassLoader classLoader, SourceInformation si, String typeKey, boolean failOnUnknownProperties, ConstraintsOverride constraintsOverride, ExecutionSupport es, String parentClass) + { + if (value == null) + { + return null; + } + + // Is value a Primitive type? + if (String.class.equals(resultType)) + { + typeCheck(value, String.class, fullClassName, si); + return (T) jsonToString(value); + } + if (Integer.class.equals(resultType)) + { + typeCheck(value, Integer.class, fullClassName, si); + return (T) jsonToInteger(value); + } + if (Long.class.equals(resultType)) + { + typeCheck(value, Long.class, fullClassName, si); + return (T) jsonToLong(value); + } + if (Boolean.class.equals(resultType)) + { + typeCheck(value, Boolean.class, fullClassName, si); + return (T) jsonToBoolean(value); + } + if (Double.class.equals(resultType)) + { + typeCheck(value, Number.class, fullClassName, si); + return (T) jsonToDouble(value); + } + // Is value a Date ? + if (PureDate.class.isAssignableFrom(resultType)) + { + typeCheck(value, String.class, fullClassName, si); + return (T) DateFunctions.parsePureDate((String) value); + } + if (DateTime.class.isAssignableFrom(resultType)) + { + typeCheck(value, String.class, fullClassName, si); + return (T) DateFunctions.parsePureDate((String) value); + } + // Is value an Enum type? + try + { + if (getPureEnumParent(resultType).isAssignableFrom(resultType)) + { + typeCheck(value, String.class, fullClassName, si); + + String enumString = (String) value; + int dotIndex = enumString.lastIndexOf('.'); + String enumName; + String enumerationFullUserPath = fullUserPath; + if (dotIndex == -1) + { + enumName = enumString; + } + else + { + enumName = enumString.substring(dotIndex + 1); + enumerationFullUserPath = enumString.substring(0, dotIndex); + if (!fullClassName.regionMatches(5, enumerationFullUserPath.replace("::", "_"), 0, fullClassName.length() - 5)) + { + throw new PureExecutionException(si, "Expected enum of type " + fullClassName + "; got: " + enumString); + } + } + T result = (T) metadata.getEnum(enumerationFullUserPath, enumName); + if (result == null) + { + throw new PureExecutionException(si, "Unknown enum: " + fullClassName + "." + enumName); + } + return result; + } + } + catch (NullPointerException e) + { + System.out.println("Unable to read the value of [" + value + "] because of NullPointerException"); + return null; + } + + if (!(value instanceof JSONObject)) + { + //value is a not a JSON object but number or string, a reference to another object. + // Currently this should be ignored. + return null; + } + + JSONObject jsonObject = (JSONObject) value; + try + { + Class implementationClass = resolveFactoryClass(resultType); + return (T) MethodUtils.invokeExactStaticMethod(implementationClass, "fromJson", + new Object[]{value, metadata, classLoader, si, typeKey, failOnUnknownProperties, constraintsOverride, es, parentClass}, new Class[]{JSONObject.class, MetadataAccessor.class, ClassLoader.class, SourceInformation.class, String.class, boolean.class, ConstraintsOverride.class, ExecutionSupport.class, String.class}); + } + catch (ClassNotFoundException | IllegalAccessException | NoSuchMethodException e) + { + throw new RuntimeException("Unable to call fromJson() method", e); + } + catch (InvocationTargetException e) + { + Throwable targetException = e.getTargetException(); + if (targetException instanceof RuntimeException) + { + throw (RuntimeException) targetException; + } + throw new RuntimeException("Error calling fromJSON() method", e); + } + } + + /* + * + * @return Base class for enumeration. It is used to see if current type is an enum. + */ + private static Class getPureEnumParent(Class resultType) + { + Class result; + try + { + result = resultType.getClassLoader().loadClass(FullJavaPaths.Enum); + } + catch (ClassNotFoundException e) + { + throw new IllegalStateException("Unable to load PURE enum parent", e); + } + + return result; + } + + /* Helpers for standard java types*/ + private static String jsonToString(Object value) + { + if (value == null) + { + return null; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + private static Integer jsonToInteger(Object value) + { + if (value == null) + { + return null; + } + if (value instanceof Integer) + { + return (Integer) value; + } + return Integer.parseInt(value.toString()); + } + + private static Long jsonToLong(Object value) + { + if (value == null) + { + return null; + } + + if (value instanceof Long) + { + return (Long) value; + } + return Long.parseLong(value.toString()); + } + + private static Double jsonToDouble(Object value) + { + // Some double values are being parsed as long by the parser + if (value == null) + { + return null; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + return Double.parseDouble(value.toString()); + } + + private static Boolean jsonToBoolean(Object value) + { + if (value == null) + { + return null; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + return Boolean.valueOf(value.toString()); + } + + /*The generated factory has the same name as the class with a suffix _JsonFactory. + * Use the same classloader to load the factory class.*/ + private static Class resolveFactoryClass(Class typeFromClassMetadata) throws ClassNotFoundException + { + ClassLoader classLoader = typeFromClassMetadata.getClassLoader(); + String defaultFactory = typeFromClassMetadata.getName() + JSON_FACTORY; + return classLoader.loadClass(defaultFactory); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ParseJSON.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ParseJSON.java new file mode 100644 index 00000000000..86b6aec05f4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ParseJSON.java @@ -0,0 +1,51 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.JavaPackageAndImportBuilder; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class ParseJSON extends AbstractNative +{ + public ParseJSON() + { + super("parseJSON_String_1__JSONElement_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return "((" + JavaPackageAndImportBuilder.buildInterfaceReferenceFromUserPath("meta::json::JSONElement") + ")new org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonParser(((CompiledExecutionSupport)es).getProcessorSupport()).toPureJson(" + transformedParams.get(0) + "))"; + } + + @Override + public String buildBody() + { + final String jsonElement = JavaPackageAndImportBuilder.buildInterfaceReferenceFromUserPath("meta::json::JSONElement"); + return "new DefendedPureFunction1()\n" + + " {\n" + + " @Override\n" + + " public " + jsonElement + " value(String url, ExecutionSupport es)\n" + + " {\n" + + " return (" + jsonElement + ")new org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonParser(((CompiledExecutionSupport)es).getProcessorSupport()).toPureJson(url);" + + " }\n" + + " }"; + } + +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ToJsonBeta.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ToJsonBeta.java new file mode 100644 index 00000000000..fe78ceb2fb3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/ToJsonBeta.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class ToJsonBeta extends AbstractNativeFunctionGeneric +{ + public ToJsonBeta() + { + super("org.finos.legend.pure.generated.JsonGen.toJson", new Object[]{Object.class, "org.finos.legend.pure.generated.Root_meta_json_JSONSerializationConfig", SourceInformation.class, ExecutionSupport.class}, + true, true, false, "toJsonBeta_Any_MANY__JSONSerializationConfig_1__String_1_"); + } + + @Override + protected String buildM4SourceInformation(SourceInformation si) + { + return NativeFunctionProcessor.buildM4SourceInformation(si); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension new file mode 100644 index 00000000000..b93e8356b7f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.json.compiled.JsonExtensionCompiled \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestAssertJsonStringsEqual.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestAssertJsonStringsEqual.java new file mode 100644 index 00000000000..818a0912a7c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestAssertJsonStringsEqual.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.asserts.AbstractTestAssertJsonStringsEqual; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestAssertJsonStringsEqual extends AbstractTestAssertJsonStringsEqual +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestFromJsonCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestFromJsonCompiled.java new file mode 100644 index 00000000000..a53ff65c8b4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestFromJsonCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.json.AbstractTestFromJson; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestFromJsonCompiled extends AbstractTestFromJson +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestParseJson.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestParseJson.java new file mode 100644 index 00000000000..37660b0a943 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestParseJson.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.json.AbstractTestParseJson; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestParseJson extends AbstractTestParseJson +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestToJsonCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestToJsonCompiled.java new file mode 100644 index 00000000000..1ece2e4008a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-compiled-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/compiled/natives/test/TestToJsonCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.compiled.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.json.AbstractTestToJson; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestToJsonCompiled extends AbstractTestToJson +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), JavaModelFactoryRegistryLoader.loader(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/pom.xml new file mode 100644 index 00000000000..9d0fc00570a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/pom.xml @@ -0,0 +1,97 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-json + 4.50.2-SNAPSHOT + ../pom.xml + + + legend-engine-pure-runtime-java-extension-interpreted-functions-json + jar + Legend Pure - Runtime - Java Extension - Interpreted - Functions - JSON + + + + org.finos.legend.pure + legend-pure-m4 + + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.engine + legend-engine-pure-functions-json-pure + runtime + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-conversion + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-interpreted + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + com.googlecode.json-simple + json-simple + + + + junit + junit + runtime + + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/JsonExtensionInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/JsonExtensionInterpreted.java new file mode 100644 index 00000000000..ccfe5a94d78 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/JsonExtensionInterpreted.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted; + +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.Escape; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.FromJson; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.FromJsonDeprecated; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.JsonStringsEqual; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.ParseJSON; +import org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.ToJson; +import org.finos.legend.pure.runtime.java.interpreted.extension.BaseInterpretedExtension; +import org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension; + +public class JsonExtensionInterpreted extends BaseInterpretedExtension +{ + public JsonExtensionInterpreted() + { + super(Tuples.pair("escape_String_1__String_1_", Escape::new), + Tuples.pair("parseJSON_String_1__JSONElement_1_", ParseJSON::new), + Tuples.pair("equalJsonStrings_String_1__String_1__Boolean_1_", JsonStringsEqual::new), + Tuples.pair("fromJson_String_1__Class_1__JSONDeserializationConfig_1__T_1_", FromJson::new), + Tuples.pair("fromJsonDeprecated_String_1__Class_1__JSONDeserializationConfig_1__T_1_", FromJsonDeprecated::new), + Tuples.pair("toJsonBeta_Any_MANY__JSONSerializationConfig_1__String_1_", ToJson::new) + ); + } + + public static InterpretedExtension extension() + { + return new JsonExtensionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/Escape.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/Escape.java new file mode 100644 index 00000000000..0e6434623e1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/Escape.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.json.simple.JSONObject; + +import java.util.Stack; + +public class Escape extends NativeFunction +{ + private final ModelRepository repository; + + public Escape(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String str = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(JSONObject.escape(str), processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJson.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJson.java new file mode 100644 index 00000000000..d9690b17f1a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJson.java @@ -0,0 +1,175 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.factory.Maps; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.ConstraintsOverride; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.EnumInstance; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.navigation.measure.Measure; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.BooleanCoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializationCache; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializationContext; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonDeserializer; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ObjectFactory; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.DefaultConstraintHandler; +import org.finos.legend.pure.runtime.java.interpreted.natives.DeserializationUtils; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.NumericUtilities; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.lang.unit.NewUnit; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.math.BigDecimal; +import java.util.Map; +import java.util.Stack; + +public class FromJson extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + private final ModelRepository repository; + + public FromJson(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + SourceInformation si = functionExpressionToUseInStack.getSourceInformation(); + + Class startingClass = (Class) Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + CoreInstance config = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + String typeKeyName = PrimitiveUtilities.getStringValue(config.getValueForMetaPropertyToOne("typeKeyName")); + Map keyLookup = Maps.mutable.empty(); + for (CoreInstance o : config.getValueForMetaPropertyToMany("typeLookup")) + { + keyLookup.put(o.getValueForMetaPropertyToOne("first").getName(), (Class) _Package.getByUserPath(o.getValueForMetaPropertyToOne("second").getName(), functionExecution.getProcessorSupport())); + } + Boolean failOnUnknownProperties = ((BooleanCoreInstance) config.getValueForMetaPropertyToOne("failOnUnknownProperties")).getValue(); + ConstraintsOverride constraintsOverride = (ConstraintsOverride) config.getValueForMetaPropertyToOne("constraintsHandler"); + + String jsonText = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport)); + return JsonDeserializer.fromJson(jsonText, startingClass, new JsonDeserializationContext(new JsonDeserializationCache(), si, processorSupport, typeKeyName, keyLookup, failOnUnknownProperties, new ObjectFactory() + { + @Override + public T newObject(Class clazz, Map> properties) + { + CoreInstance instance = FromJson.this.repository.newEphemeralAnonymousCoreInstance(functionExpressionToUseInStack.getSourceInformation(), clazz); + properties.forEach((key, values) -> Instance.setValuesForProperty(instance, key, values.collect(value -> convertValue(key, value, processorSupport, si), Lists.mutable.empty()), processorSupport)); + DeserializationUtils.replaceReverseProperties(instance, processorSupport, si); + + CoreInstance override = processorSupport.newAnonymousCoreInstance(si, M3Paths.ConstraintsGetterOverride); + if (constraintsOverride != null) + { + Instance.addValueToProperty(override, M3Properties.constraintsManager, constraintsOverride._constraintsManager(), processorSupport); + Instance.addValueToProperty(instance, M3Properties.elementOverride, override, processorSupport); + } + CoreInstance value = ValueSpecificationBootstrap.wrapValueSpecification(instance, true, processorSupport); + + return (T) DefaultConstraintHandler.handleConstraints(clazz, value, si, functionExecution, resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + } + + public T newUnitInstance(CoreInstance propertyType, String unitTypeString, Number unitValue) + { + CoreInstance retrievedUnit = processorSupport.package_getByUserPath(unitTypeString); + if (!processorSupport.type_subTypeOf(retrievedUnit, propertyType)) + { + throw new PureExecutionException("Cannot match unit type: " + unitTypeString + " as subtype of type: " + PackageableElement.getUserPathForPackageableElement(propertyType)); + } + + ListIterable params = Lists.immutable.with( + ValueSpecificationBootstrap.wrapValueSpecification(retrievedUnit, false, processorSupport), + NumericUtilities.toPureNumberValueExpression(unitValue, false, repository, processorSupport)); + return (T) new NewUnit(functionExecution, repository).execute(params, resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, context, processorSupport); + } + })); + } + + private CoreInstance convertValue(String key, Object value, ProcessorSupport processorSupport, SourceInformation sourceInfo) + { + if (value instanceof String) + { + return this.repository.newStringCoreInstance((String) value); + } + if (value instanceof Boolean) + { + return this.repository.newBooleanCoreInstance((Boolean) value); + } + if (value instanceof Integer) + { + this.repository.newIntegerCoreInstance((Integer) value); + } + if (value instanceof Long) + { + return this.repository.newIntegerCoreInstance((Long) value); + } + if (value instanceof BigDecimal) + { + return this.repository.newDecimalCoreInstance((BigDecimal) value); + } + if (value instanceof Double) + { + return this.repository.newFloatCoreInstance(BigDecimal.valueOf((Double) value)); + } + if (value instanceof Number) + { + this.repository.newFloatCoreInstance(new BigDecimal(value.toString())); + } + if (value instanceof PureDate) + { + return this.repository.newDateCoreInstance((PureDate) value); + } + if (value instanceof InstanceValue) + { + InstanceValue asInstanceValue = (InstanceValue) value; + if (Measure.isUnitOrMeasureInstance(asInstanceValue, processorSupport)) + { + return asInstanceValue; + } + return (CoreInstance) asInstanceValue._values().getFirst(); + } + if (value instanceof EnumInstance) + { + return (CoreInstance) value; + } + throw new PureExecutionException(sourceInfo, "Unknown type from output of JsonDeserializer for property: " + key); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJsonDeprecated.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJsonDeprecated.java new file mode 100644 index 00000000000..221d1b9afd5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/FromJsonDeprecated.java @@ -0,0 +1,70 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonParser; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +/** + * @deprecated use {@link FromJson} instead. + */ +@Deprecated +public class FromJsonDeprecated extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + + public FromJsonDeprecated(FunctionExecutionInterpreted functionExecution, ModelRepository modelRepository) + { + this.functionExecution = functionExecution; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + // This is a temporary solution as it should not be referring to the other existing implementation which is in the model + // space. It either needs its own native implementation or a function inside the platform. + + CoreInstance json = params.get(0); + CoreInstance startingclass = params.get(1); + CoreInstance config = params.get(2); + + String jsonText = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(json, M3Properties.values, processorSupport)); + CoreInstance jsonElement = new JsonParser(processorSupport).toPureJson(jsonText); + CoreInstance fromContractStoreJSONFunction = processorSupport.package_getByUserPath("apps::model::contractFlow::fromJSON::fromContractStoreJSON_JSONElement_1__Class_1__JSONDeserializationConfig_1__Any_MANY_"); + + ListIterable functionParameters = Lists.immutable.with(ValueSpecificationBootstrap.wrapValueSpecification(jsonElement, true, processorSupport), startingclass, config); + + return this.functionExecution.executeLambdaFromNative(fromContractStoreJSONFunction, functionParameters, resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/JsonStringsEqual.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/JsonStringsEqual.java new file mode 100644 index 00000000000..5bfba7fe442 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/JsonStringsEqual.java @@ -0,0 +1,62 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativePredicate; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import java.util.Stack; + +public class JsonStringsEqual extends NativePredicate +{ + public JsonStringsEqual(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected boolean executeBoolean(Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, ListIterable params, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance left = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport); + CoreInstance right = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + JSONParser jsonParser = new JSONParser(); + try + { + Object rightDeserialized = jsonParser.parse(PrimitiveUtilities.getStringValue(right)); + Object leftDeserialized = jsonParser.parse(PrimitiveUtilities.getStringValue(left)); + return leftDeserialized.equals(rightDeserialized); + } + catch (ParseException e) + { + //ParseException implementation returns human readable error message from toString() method and getMessage() returns null + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Failed to parse JSON string. Invalid JSON string. " + e.toString(), e); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ParseJSON.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ParseJSON.java new file mode 100644 index 00000000000..d54f0f00ab2 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ParseJSON.java @@ -0,0 +1,55 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonParser; + +import java.util.Stack; + +public class ParseJSON extends NativeFunction +{ + private final ModelRepository repository; + private final FunctionExecutionInterpreted functionExecution; + + public ParseJSON(FunctionExecutionInterpreted functionExecution, ModelRepository modelRepository) + { + this.repository = modelRepository; + this.functionExecution = functionExecution; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String txt = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport)); + return ValueSpecificationBootstrap.wrapValueSpecification(new JsonParser(processorSupport).toPureJson(txt), true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ToJson.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ToJson.java new file mode 100644 index 00000000000..71f2e30e96e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/ToJson.java @@ -0,0 +1,136 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.AnyCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.FloatCoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance; +import org.finos.legend.pure.m4.coreinstance.simple.SimpleCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationCache; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializationContext; +import org.finos.legend.pure.runtime.java.extension.external.json.shared.JsonSerializer; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.collection.anonymous.map.KeyValues; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.math.BigDecimal; +import java.util.Stack; + +public class ToJson extends NativeFunction +{ + private final ModelRepository repository; + private final FunctionExecutionInterpreted functionExecution; + + public ToJson(FunctionExecutionInterpreted functionExecution, ModelRepository modelRepository) + { + this.repository = modelRepository; + this.functionExecution = functionExecution; + } + + @Override + public CoreInstance execute(ListIterable params, final Stack> resolvedTypeParameters, final Stack> resolvedMultiplicityParameters, final VariableContext variableContext, final CoreInstance functionExpressionToUseInStack, final Profiler profiler, final InstantiationContext instantiationContext, final ExecutionSupport executionSupport, Context context, final ProcessorSupport processorSupport) throws PureExecutionException + { + ListIterable pureObjects = Instance.getValueForMetaPropertyToManyResolved(params.get(0), M3Properties.values, processorSupport); + if (pureObjects.getFirst() instanceof SimpleCoreInstance && !"Map".equals(pureObjects.getFirst().getClassifier().getName())) + { + pureObjects = pureObjects.collect(AnyCoreInstanceWrapper::toAny); + } + CoreInstance jsonConfig = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + String typeKeyName = PrimitiveUtilities.getStringValue(jsonConfig.getValueForMetaPropertyToOne("typeKeyName")); + boolean includeType = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("includeType"), false); + boolean fullyQualifiedTypePath = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("fullyQualifiedTypePath"), false); + boolean serializeQualifiedProperties = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("serializeQualifiedProperties"), false); + String dateTimeFormat = PrimitiveUtilities.getStringValue(jsonConfig.getValueForMetaPropertyToOne("dateTimeFormat"), null); + boolean serializePackageableElementName = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("serializePackageableElementName"), false); + boolean removePropertiesWithEmptyValues = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("removePropertiesWithEmptyValues"), false); + boolean serializeMultiplicityAsNumber = PrimitiveUtilities.getBooleanValue(jsonConfig.getValueForMetaPropertyToOne("serializeMultiplicityAsNumber"), false); + String encryptionKey = PrimitiveUtilities.getStringValue(jsonConfig.getValueForMetaPropertyToOne("encryptionKey"), null); + String decryptionKey = PrimitiveUtilities.getStringValue(jsonConfig.getValueForMetaPropertyToOne("decryptionKey"), null); + ListIterable encryptionStereotypes = jsonConfig.getValueForMetaPropertyToMany("encryptionStereotypes"); + ListIterable decryptionStereotypes = jsonConfig.getValueForMetaPropertyToMany("decryptionStereotypes"); + + String json = JsonSerializer.toJson(pureObjects, processorSupport, new JsonSerializationContext(new JsonSerializationCache(), functionExpressionToUseInStack.getSourceInformation(), processorSupport, new Stack<>(), typeKeyName, includeType, fullyQualifiedTypePath, serializeQualifiedProperties, dateTimeFormat, serializePackageableElementName, removePropertiesWithEmptyValues, serializeMultiplicityAsNumber, encryptionKey, encryptionStereotypes, decryptionKey, decryptionStereotypes) + { + @Override + protected Object extractPrimitiveValue(Object potentiallyWrappedPrimitive) + { + Object val = potentiallyWrappedPrimitive instanceof PrimitiveCoreInstance ? ((PrimitiveCoreInstance) potentiallyWrappedPrimitive).getValue() : potentiallyWrappedPrimitive; + val = potentiallyWrappedPrimitive instanceof FloatCoreInstance && val instanceof BigDecimal ? ((BigDecimal) val).doubleValue() : val; + return val; + } + + @Override + protected Object getValueForProperty(CoreInstance pureObject, Property property, String className) + { + CoreInstance res = ToJson.this.functionExecution.executeProperty(property, true, resolvedTypeParameters, resolvedMultiplicityParameters, getParentOrEmptyVariableContext(variableContext), profiler, Lists.immutable.with(ValueSpecificationBootstrap.wrapValueSpecification(pureObject, true, processorSupport)), functionExpressionToUseInStack, instantiationContext, executionSupport); + + if (res instanceof InstanceValue) + { + RichIterable values = ((InstanceValue) res)._values(); + return (values.getFirst() instanceof SimpleCoreInstance && !"Map".equals(((SimpleCoreInstance) values.getFirst()).getClassifier().getName())) ? values.collect(v -> AnyCoreInstanceWrapper.toAny((CoreInstance) v)) : values; + } + return res; + } + + @Override + protected Object evaluateQualifiedProperty(CoreInstance pureObject, QualifiedProperty qualifiedProperty, Type type, Multiplicity multiplicity, String propertyName) + { + CoreInstance res = ToJson.this.functionExecution.executeFunction(false, qualifiedProperty, Lists.immutable.with(ValueSpecificationBootstrap.wrapValueSpecification(pureObject, true, processorSupport)), new Stack<>(), new Stack<>(), getParentOrEmptyVariableContextForLambda(variableContext, qualifiedProperty), functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + if (res instanceof InstanceValue) + { + return ((InstanceValue) res)._values(); + } + return res; + } + + @Override + protected CoreInstance getClassifier(CoreInstance pureObject) + { + return pureObject.getClassifier(); + } + + @Override + protected RichIterable getMapKeyValues(CoreInstance pureObject) + { + ListIterable newPureObjects = Lists.immutable.with(ValueSpecificationBootstrap.wrapValueSpecification(pureObject, true, processorSupport)); + return KeyValues.executeMap(repository, newPureObjects, processorSupport); + } + + }, functionExpressionToUseInStack.getSourceInformation()); + return ValueSpecificationBootstrap.newStringLiteral(this.repository, json, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension new file mode 100644 index 00000000000..62684d0ff1e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.json.interpreted.JsonExtensionInterpreted \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestAssertJsonStringsEqual.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestAssertJsonStringsEqual.java new file mode 100644 index 00000000000..efef9eace41 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestAssertJsonStringsEqual.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.asserts.AbstractTestAssertJsonStringsEqual; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestAssertJsonStringsEqual extends AbstractTestAssertJsonStringsEqual +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestFromJsonInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestFromJsonInterpreted.java new file mode 100644 index 00000000000..b3ce51780a8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestFromJsonInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.json.AbstractTestFromJson; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestFromJsonInterpreted extends AbstractTestFromJson +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestToJsonInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestToJsonInterpreted.java new file mode 100644 index 00000000000..86f2e75b16d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-interpreted-functions-json/src/test/java/org/finos/legend/pure/runtime/java/extension/external/json/interpreted/natives/test/TestToJsonInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.interpreted.natives.test; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.json.AbstractTestToJson; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestToJsonInterpreted extends AbstractTestToJson +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/pom.xml new file mode 100644 index 00000000000..ff799946543 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/pom.xml @@ -0,0 +1,53 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-json + 4.50.2-SNAPSHOT + ../pom.xml + + + legend-engine-pure-runtime-java-extension-shared-functions-conversion + jar + Legend Pure - Runtime - Java Extension - Shared - Function - Conversion + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ClassConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ClassConversion.java new file mode 100644 index 00000000000..f17fac2fe05 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ClassConversion.java @@ -0,0 +1,127 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.predicate.Predicate; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; + +public abstract class ClassConversion implements Conversion +{ + protected final org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class clazz; + protected RichIterable> propertyConversions; + + /** + * Serialized PURE objects do not contain the properties inherited from Any, and as such those properties should be filtered out. + */ + private static final Predicate> PROPERTY_FILTER = new Predicate>() + { + @Override + public boolean accept(Property objectProperty) + { + return !"meta::pure::metamodel::type::Any".equals(PackageableElement.getUserPathForPackageableElement(objectProperty._owner())); + } + }; + + public ClassConversion(Class clazz) + { + this.clazz = clazz; + this.propertyConversions = null; + } + + @Override + public String pureTypeAsString() + { + return PackageableElement.getUserPathForPackageableElement(this.clazz); + } + + /** + * Completes the initialisation of a ClassConversion by populating all of its properties. This cannot be done until the + * ClassConversion has been added to the conversion cache otherwise the act of getting a conversion from the cache for a + * property can cause an infinite loop when the type of the property is that of its owner (or some other similar recursive class structure). + */ + protected void completeInitialisation(ConversionContext context) + { + this.propertyConversions = this.computePropertyConversions(context); + } + + private RichIterable> computePropertyConversions(ConversionContext context) + { + FastList> propertyConversions = new FastList<>(); + RichIterable> properties = this.getProperties(context.getProcessorSupport()).select(PROPERTY_FILTER); + for (Property property : properties) + { + Type type = property._genericType()._rawType(); + Conversion conversion = context.getConversionCache().getConversion(type, context); + + if (property._multiplicity()._multiplicityParameter() != null) + { + propertyConversions.add(this.newMultiplicityParameterisedConversion(property, conversion, type)); + } + else + { + Long upperBound = property._multiplicity()._upperBound()._value(); + if (upperBound == null) + { + propertyConversions.add(this.newMultiplicityManyConversion(property, conversion, type)); + } + else + { + Long lowerBound = property._multiplicity()._lowerBound()._value(); + if (lowerBound == 1 && upperBound == 1) + { + propertyConversions.add(this.newMultiplicityOneConversion(property, conversion, type)); + } + else if (lowerBound == 0 && upperBound == 1) + { + propertyConversions.add(this.newMultiplicityOptionalConversion(property, conversion, type)); + } + else + { + propertyConversions.add(this.newMultiplicityRangeConversion(property, conversion, type)); + } + } + } + } + return propertyConversions; + } + + protected RichIterable> getProperties(ProcessorSupport processorSupport) + { + return (RichIterable)processorSupport.class_getSimpleProperties(this.clazz); + } + + protected RichIterable> getQualifiedProperties(ProcessorSupport processorSupport) + { + return (RichIterable)processorSupport.class_getQualifiedProperties(this.clazz); + } + + protected abstract PropertyConversion newMultiplicityOneConversion(AbstractProperty abstractProperty, Conversion conversion, Type type); + + protected abstract PropertyConversion newMultiplicityManyConversion(AbstractProperty abstractProperty, Conversion conversion, Type type); + + protected abstract PropertyConversion newMultiplicityParameterisedConversion(AbstractProperty abstractProperty, Conversion conversion, Type type); + + protected abstract PropertyConversion newMultiplicityOptionalConversion(AbstractProperty abstractProperty, Conversion conversion, Type type); + + protected abstract PropertyConversion newMultiplicityRangeConversion(AbstractProperty abstractProperty, Conversion conversion, Type type); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/Conversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/Conversion.java new file mode 100644 index 00000000000..a31e32ac092 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/Conversion.java @@ -0,0 +1,22 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +public interface Conversion +{ + T apply(F value, ConversionContext context); + + String pureTypeAsString(); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionCache.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionCache.java new file mode 100644 index 00000000000..897af05c972 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionCache.java @@ -0,0 +1,111 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Measure; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Unit; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; + +import java.util.HashMap; +import java.util.Map; + +public abstract class ConversionCache +{ + protected final Map> cache; + private final Map> primitiveConversionMap; + + public ConversionCache() + { + this.cache = new HashMap<>(); + this.primitiveConversionMap = this.constructPrimitiveConversions(); + } + + public Conversion getConversion(Type type, ConversionContext context) + { + if (this.cache.containsKey(type)) + { + return this.cache.get(type); + } + return this.newConversion(type, context); + } + + private Conversion newConversion(Type type, ConversionContext context) + { + if (type instanceof Class) + { + if (type.getName().equals("Map")) // Maps do not contain properties, need to handle separately for entries' conversions + { + MapConversion mapConversion = this.newMapConversion(context); + this.cache.put(type, mapConversion); + return mapConversion; + } + else if (type.getName().equals("Any")) + { + Conversion anyTypeConversion = this.newGenericAndAnyTypeConversion(true, context); + this.cache.put(type, anyTypeConversion); + return anyTypeConversion; + } + else + { + ClassConversion classConversion = this.newClassConversion((Class)type, context); + this.cache.put(type, classConversion); + classConversion.completeInitialisation(context); // reasoning for this is explained at completeInitialisation's definition + return classConversion; + } + } + if (type instanceof Enumeration) + { + EnumerationConversion enumerationConversion = this.newEnumerationConversion((Enumeration)type, context); + this.cache.put(type, enumerationConversion); + return enumerationConversion; + } + if (type instanceof Unit || type instanceof Measure) + { + UnitConversion unitConversion = this.newUnitConversion(type, context); + this.cache.put(type, unitConversion); + return unitConversion; + } + if (type instanceof PrimitiveType) + { + return this.newPrimitiveConversion((PrimitiveType)type, context); + } + if (type == null) + { + return this.newGenericAndAnyTypeConversion(false, context); + } + throw new IllegalArgumentException("Unknown type."); + } + + private Conversion newPrimitiveConversion(PrimitiveType type, ConversionContext context) + { + return this.primitiveConversionMap.get(PrimitiveConversion.PurePrimitive.valueOf(type.getName())); + } + + protected abstract Map> constructPrimitiveConversions(); + + protected abstract ClassConversion newClassConversion(Class type, ConversionContext context); + + protected abstract MapConversion newMapConversion(ConversionContext context); + + protected abstract EnumerationConversion newEnumerationConversion(Enumeration type, ConversionContext context); + + protected abstract UnitConversion newUnitConversion(CoreInstance type, ConversionContext context); + + protected abstract Conversion newGenericAndAnyTypeConversion(boolean isExplicitAny, ConversionContext context); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionContext.java new file mode 100644 index 00000000000..c91296256bd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ConversionContext.java @@ -0,0 +1,47 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; + +public class ConversionContext +{ + private final ConversionCache conversionCache; + private final SourceInformation sourceInformation; + private final ProcessorSupport processorSupport; + + public ConversionContext(ConversionCache conversionCache, SourceInformation sourceInformation, ProcessorSupport processorSupport) + { + this.conversionCache = conversionCache; + this.sourceInformation = sourceInformation; + this.processorSupport = processorSupport; + } + + public ConversionCache getConversionCache() + { + return this.conversionCache; + } + + public SourceInformation getSourceInformation() + { + return this.sourceInformation; + } + + public ProcessorSupport getProcessorSupport() + { + return this.processorSupport; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/DeserializationContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/DeserializationContext.java new file mode 100644 index 00000000000..59fa8b23851 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/DeserializationContext.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; + +public class DeserializationContext extends ConversionContext +{ + private final ObjectFactory objectFactory; + + public DeserializationContext(ConversionCache conversionCache, SourceInformation sourceInformation, ProcessorSupport processorSupport, ObjectFactory objectFactory) + { + super(conversionCache, sourceInformation, processorSupport); + this.objectFactory = objectFactory; + } + + public ObjectFactory getObjectFactory() + { + return this.objectFactory; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/EnumerationConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/EnumerationConversion.java new file mode 100644 index 00000000000..254d43c6b50 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/EnumerationConversion.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; + +import java.util.HashMap; +import java.util.Map; + +public abstract class EnumerationConversion implements Conversion +{ + protected final Enumeration enumeration; + protected Map valueMap; + + public EnumerationConversion(Enumeration enumeration) + { + this.enumeration = enumeration; + this.generateEnumValueMap(); + } + + protected String enumerationName() + { + return PackageableElement.getUserPathForPackageableElement(this.enumeration); + } + + private void generateEnumValueMap() + { + this.valueMap = new HashMap<>(); + for (Object eachValue : this.enumeration._values()) + { + this.valueMap.put(((CoreInstance)eachValue).getName(), (CoreInstance)eachValue); + } + } + + @Override + public String pureTypeAsString() + { + return PackageableElement.getUserPathForPackageableElement(this.enumeration); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/GenericAndAnyTypeNotSupportedConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/GenericAndAnyTypeNotSupportedConversion.java new file mode 100644 index 00000000000..0f907e39574 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/GenericAndAnyTypeNotSupportedConversion.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.exception.PureExecutionException; + +public class GenericAndAnyTypeNotSupportedConversion implements Conversion +{ + public static final GenericAndAnyTypeNotSupportedConversion GENERIC_AND_ANY_TYPE_NOT_SUPPORTED_CONVERSION = new GenericAndAnyTypeNotSupportedConversion(); + + @Override + public T apply(Object value, ConversionContext context) + { + throw new PureExecutionException("Deserialization of generics currently not supported!"); + } + + @Override + public String pureTypeAsString() + { + //TODO probably return something more indicative that this is generic type.... + return "T"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/MapConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/MapConversion.java new file mode 100644 index 00000000000..4aae2a3d0d1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/MapConversion.java @@ -0,0 +1,28 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +public abstract class MapConversion implements Conversion +{ + public MapConversion() + { + } + + @Override + public String pureTypeAsString() + { + return "Map"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ObjectFactory.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ObjectFactory.java new file mode 100644 index 00000000000..0c2909d684a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/ObjectFactory.java @@ -0,0 +1,29 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; + +import java.util.Map; + +public interface ObjectFactory +{ + T newObject(Class clazz, Map> properties); + + T newUnitInstance(CoreInstance unit, String unitTypeString, Number unitValue) throws Exception; +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PrimitiveConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PrimitiveConversion.java new file mode 100644 index 00000000000..2657904f064 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PrimitiveConversion.java @@ -0,0 +1,85 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; + +import java.util.HashMap; +import java.util.Map; + +public abstract class PrimitiveConversion implements Conversion +{ + public enum PurePrimitive + { + String, Boolean, Integer, Float, Decimal, Number, Date, DateTime, StrictDate, LatestDate + } + + private static final Map TO_PURE_PRIMITIVE_NAME_MAPPING = initToPurePrimitiveNameMapping(); + + private static Map initToPurePrimitiveNameMapping() + { + Map map = new HashMap<>(); + map.put(String.class, M3Paths.String); + map.put(Boolean.class, M3Paths.Boolean); + map.put(boolean.class, M3Paths.Boolean); + map.put(Long.class, M3Paths.Integer); + map.put(long.class, M3Paths.Integer); + map.put(Double.class, M3Paths.Float); + map.put(double.class, M3Paths.Float); + map.put(Number.class, M3Paths.Number); + return map; + } + + public static String toPurePrimitiveName(Class javaClass) + { + String purePrimitiveName = TO_PURE_PRIMITIVE_NAME_MAPPING.get(javaClass); + if (purePrimitiveName == null) + { + throw new IllegalArgumentException("Unknown primitive: " + javaClass); + } + return purePrimitiveName; + } + + protected String potentiallyFormatDateTime(PureDate pureObject, String format) + { + return format != null ? pureObject.format(format) : pureObject.toString(); + } + + /** + * Generates a primitive conversion that does nothing but checks that the passed data is of the correct type + */ + public static PrimitiveConversion noOpConversion(final java.lang.Class primitiveJavaClass, final String pureTypeName, final boolean validateType) + { + return new PrimitiveConversion() + { + @Override + public T apply(T value, ConversionContext context) + { + if (validateType && !primitiveJavaClass.isInstance(value)) + { + throw new IllegalArgumentException("Invalid value."); + } + return value; + } + + @Override + public String pureTypeAsString() + { + return pureTypeName; + } + }; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyConversion.java new file mode 100644 index 00000000000..d00f6e6a72f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyConversion.java @@ -0,0 +1,57 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; + +public abstract class PropertyConversion implements Conversion +{ + protected final AbstractProperty property; + protected final String name; + protected final boolean isFromAssociation; + protected final Conversion conversion; + protected final Type type; + + public PropertyConversion(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + this.property = property; + this.name = property.getName(); + this.isFromAssociation = isFromAssociation; + this.conversion = conversion; + this.type = type; + } + + public AbstractProperty getProperty() + { + return this.property; + } + + public String getName() + { + return this.name; + } + + public boolean isFromAssociation() + { + return this.isFromAssociation; + } + + @Override + public String pureTypeAsString() + { + return this.conversion != null ? this.conversion.pureTypeAsString() : null; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyDeserialization.java new file mode 100644 index 00000000000..403593e1688 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertyDeserialization.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; + +public abstract class PropertyDeserialization extends PropertyConversion> +{ + public PropertyDeserialization(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertySerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertySerialization.java new file mode 100644 index 00000000000..2c429280418 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/PropertySerialization.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; + +public abstract class PropertySerialization extends PropertyConversion, T> +{ + public PropertySerialization(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/SerializationContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/SerializationContext.java new file mode 100644 index 00000000000..5b3dc400174 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/SerializationContext.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; + +import java.util.Stack; + +public class SerializationContext extends ConversionContext +{ + private final Stack visitedInstances; + + public SerializationContext(ConversionCache conversionCache, SourceInformation sourceInformation, ProcessorSupport processorSupport, Stack visitedInstances) + { + super(conversionCache, sourceInformation, processorSupport); + this.visitedInstances = visitedInstances; + } + + public Stack getVisitedInstances() + { + return this.visitedInstances; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/UnitConversion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/UnitConversion.java new file mode 100644 index 00000000000..551d8a297ce --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-conversion/src/main/java/org/finos/legend/pure/runtime/java/extension/external/shared/conversion/UnitConversion.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.shared.conversion; + +import org.finos.legend.pure.m4.coreinstance.CoreInstance; + +public abstract class UnitConversion implements Conversion +{ + protected final CoreInstance type; + protected final String unitKeyName = "unit"; + protected final String valueKeyName = "value"; + + public UnitConversion(CoreInstance type) + { + this.type = type; + } + + @Override + public String pureTypeAsString() + { + return "Unit"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/pom.xml new file mode 100644 index 00000000000..f95f2ac4f3b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/pom.xml @@ -0,0 +1,98 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-json + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-shared-functions-json + jar + Legend Pure - Runtime - Java Extension - Shared - Functions - JSON + + + + org.finos.legend.pure + legend-pure-m4 + + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.engine + legend-engine-pure-functions-json-pure + runtime + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-conversion + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + com.googlecode.json-simple + json-simple + + + + junit + junit + runtime + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + test-jar + test + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/DefaultJsonExtraTypeProcessor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/DefaultJsonExtraTypeProcessor.java new file mode 100644 index 00000000000..a0e9368f309 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/DefaultJsonExtraTypeProcessor.java @@ -0,0 +1,24 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +public class DefaultJsonExtraTypeProcessor implements JsonExtraTypeProcessor +{ + @Override + public Object process(Object pureObject, JsonSerializationContext jsonSerializationContext) + { + return null; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonAnyTypeDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonAnyTypeDeserialization.java new file mode 100644 index 00000000000..bfb30dcf4ff --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonAnyTypeDeserialization.java @@ -0,0 +1,48 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PrimitiveConversion; + +public class JsonAnyTypeDeserialization implements Conversion +{ + static final JsonAnyTypeDeserialization JSON_ANY_TYPE_DESERIALIZATION = new JsonAnyTypeDeserialization(); + + @Override + public Object apply(Object value, ConversionContext context) + { + try + { + String primitiveTypeName = PrimitiveConversion.toPurePrimitiveName(value.getClass()); + PrimitiveType primitiveType = (PrimitiveType) context.getProcessorSupport().repository_getTopLevel(primitiveTypeName); + Conversion conversion = context.getConversionCache().getConversion(primitiveType, context); + return conversion.apply(value, context); + } + catch (IllegalArgumentException e) + { + throw new PureExecutionException("Deserialization of Any currently only supported on primitive values!", e); + } + } + + @Override + public String pureTypeAsString() + { + return "Any"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassDeserialization.java new file mode 100644 index 00000000000..2189e4f6b60 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassDeserialization.java @@ -0,0 +1,191 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.function.Function; +import org.eclipse.collections.api.block.predicate.Predicate; +import org.eclipse.collections.impl.utility.LazyIterate; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ObjectFactory; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PrimitiveConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PropertyConversion; +import org.json.simple.JSONObject; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class JsonClassDeserialization extends ClassConversion +{ + private Predicate isUnknownJsonProperty; + + private static final Function PROPERTY_NAME_FUNC = new Function() + { + @Override + public String valueOf(Property property) + { + return property.getName(); + } + }; + + public JsonClassDeserialization(Class clazz) + { + super(clazz); + this.isUnknownJsonProperty = null; + } + + @Override + protected void completeInitialisation(ConversionContext context) + { + super.completeInitialisation(context); + this.isUnknownJsonProperty = this.createUnknownJsonPropertyTest((JsonDeserializationContext)context); + } + + private Predicate createUnknownJsonPropertyTest(JsonDeserializationContext context) + { + final Set knownJsonProperties = this.getProperties(context.getProcessorSupport()).collect(PROPERTY_NAME_FUNC).toSet(); + knownJsonProperties.add(context.getTypeKeyName()); + return new Predicate() + { + @Override + public boolean accept(String name) + { + return !knownJsonProperties.contains(name); + } + }; + } + + @Override + protected PropertyConversion newMultiplicityOneConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonDeserializationMultiplicityOne(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityManyConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonDeserializationMultiplicityMany(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityParameterisedConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonDeserializationMultiplicityParameterised(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityOptionalConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonDeserializationMultiplicityOptional(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityRangeConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonDeserializationMultiplicityRange(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type, abstractProperty._multiplicity()); + } + + @Override + public T apply(Object input, ConversionContext context) + { + if (input instanceof JSONObject) + { + JsonDeserializationContext deserializationContext = (JsonDeserializationContext)context; + ObjectFactory objectFactory = deserializationContext.getObjectFactory(); + + JSONObject jsonObject = (JSONObject)input; + Map> propertyKeyValues = this.keyValueProperties(jsonObject, deserializationContext); + try + { + return (T)objectFactory.newObject(this.clazz, propertyKeyValues); + } + catch (PureExecutionException e) + { + throw new PureExecutionException(deserializationContext.getSourceInformation(), "Could not create new instance of " + this.pureTypeAsString() + ": \n" + e.getInfo()); + } + } + else + { + // value is a not a JSON object but number or string, a reference to another object. + // Currently this should be ignored. + return null; + } + } + + /** + * Generates a mapping of property name to a collection of values which describe the properties of the newly instantiated object. + */ + private Map> keyValueProperties(JSONObject jsonObject, JsonDeserializationContext context) + { + this.failOnUnknownProperties(jsonObject, context); + Map> keyValues = new HashMap<>(); + for (Conversion propertyConversion : this.propertyConversions) + { + JsonPropertyDeserialization jsonPropertyDeserialization = (JsonPropertyDeserialization)propertyConversion; + Object jsonValue = jsonObject.get(jsonPropertyDeserialization.getName()); + try + { + RichIterable values = jsonPropertyDeserialization.apply(jsonValue, context); + if (!values.isEmpty()) // can't create new objects from properties that have an empty collection of values, instead the property should just be ignored + { + keyValues.put(jsonPropertyDeserialization.getName(), values); + } + } + catch (PureExecutionException e) + { + throw new PureExecutionException(context.getSourceInformation(), "Error populating property '" + jsonPropertyDeserialization.getName() + "' on class '" + this.pureTypeAsString() + "': \n" + e.getInfo()); + } + catch (ClassCastException | IllegalArgumentException e) + { + String foundType = jsonValue instanceof JSONObject ? "JSON Object" : PrimitiveConversion.toPurePrimitiveName(jsonValue.getClass()); + throw new PureExecutionException(context.getSourceInformation(), "Error populating property '" + jsonPropertyDeserialization.getName() + "' on class '" + this.pureTypeAsString() + "': \nExpected " + jsonPropertyDeserialization.pureTypeAsString() + ", found " + foundType); + } + } + return keyValues; + } + + /** + * If the failOnUnknownProperties flag is set in the JSONDeserializationConfig (and as a result in the JsonDeserializationContext), + * then ensure that no additional data is provided in the JSONObjects modelling instances of PURE classes. + * This is relatively expensive to compute but the flag is rarely set. + */ + private void failOnUnknownProperties(JSONObject jsonValue, JsonDeserializationContext context) + { + if (context.isFailOnUnknownProperties()) + { + RichIterable unknownProperties = LazyIterate.select((Set)jsonValue.keySet(), this.isUnknownJsonProperty); + if (!unknownProperties.isEmpty()) + { + StringBuilder errorMsg = new StringBuilder(); + for (String unknownProperty : unknownProperties) + { + errorMsg.append(String.format("Property '%s' can't be found in class %s. ", unknownProperty, PackageableElement.getUserPathForPackageableElement(this.clazz))); + } + throw new PureExecutionException(context.getSourceInformation(), errorMsg.toString()); + } + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassSerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassSerialization.java new file mode 100644 index 00000000000..dbb27c1a6d5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonClassSerialization.java @@ -0,0 +1,193 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PropertyConversion; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +public class JsonClassSerialization extends ClassConversion +{ + protected RichIterable> qualifiedPropertySerializations; + + public JsonClassSerialization(Class clazz) + { + super(clazz); + } + + @Override + protected PropertyConversion newMultiplicityOneConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonSerializationMultiplicityOne(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityManyConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonSerializationMultiplicityMany(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityParameterisedConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonSerializationMultiplicityParameterised(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityOptionalConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonSerializationMultiplicityOptional(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type); + } + + @Override + protected PropertyConversion newMultiplicityRangeConversion(AbstractProperty abstractProperty, Conversion conversion, Type type) + { + return new JsonSerializationMultiplicityRange(abstractProperty, abstractProperty._owner() instanceof Association, conversion, type, abstractProperty._multiplicity()); + } + + @Override + protected void completeInitialisation(ConversionContext context) + { + super.completeInitialisation(context); + if (((JsonSerializationContext) context).isSerializeQualifiedProperties()) + { + this.qualifiedPropertySerializations = this.computeQualifiedPropertyConverters((JsonSerializationContext) context); + } + } + + private RichIterable> computeQualifiedPropertyConverters(JsonSerializationContext context) + { + MutableList> qualifiedPropertyConversions = Lists.mutable.empty(); + RichIterable> qualifiedProperties = this.getQualifiedProperties(context.getProcessorSupport()); + for (QualifiedProperty qualifiedProperty : qualifiedProperties) + { + FunctionType functionType = (FunctionType) context.getProcessorSupport().function_getFunctionType(qualifiedProperty); + if (functionType._parameters().size() <= 1) + { + Type returnType = functionType._returnType()._rawType(); + Multiplicity returnMultiplicity = functionType._returnMultiplicity(); + Conversion conversion = context.getConversionCache().getConversion(returnType, context); + Long upperBound = returnMultiplicity._upperBound()._value(); + Conversion multiplicityConversion; + if (upperBound == null) + { + multiplicityConversion = new JsonSerializationMultiplicityMany(qualifiedProperty, false, conversion, returnType); + } + else + { + Long lowerBound = returnMultiplicity._lowerBound()._value(); + if (lowerBound == 1 && upperBound == 1) + { + multiplicityConversion = new JsonSerializationMultiplicityOne(qualifiedProperty, false, conversion, returnType); + } + else if (lowerBound == 0 && upperBound == 1) + { + multiplicityConversion = new JsonSerializationMultiplicityOptional(qualifiedProperty, false, conversion, returnType); + } + else + { + multiplicityConversion = new JsonSerializationMultiplicityRange(qualifiedProperty, false, conversion, returnType, returnMultiplicity); + } + } + qualifiedPropertyConversions.add(new JsonQualifiedPropertySerialization(qualifiedProperty, qualifiedProperty._name(), returnType, returnMultiplicity, multiplicityConversion)); + } + } + return qualifiedPropertyConversions; + } + + @Override + public Object apply(T pureObject, ConversionContext context) + { + JsonSerializationContext jsonSerializationContext = (JsonSerializationContext) context; + if (this.isExactType(pureObject, context.getProcessorSupport())) + { + return this.serializeProperties(pureObject, jsonSerializationContext); + } + else + { + Conversion correctTypeClassConversion = this.resolveTypeAndGetConverter(pureObject, jsonSerializationContext); + return correctTypeClassConversion.apply(pureObject, jsonSerializationContext); + } + } + + private Object serializeProperties(T pureObject, JsonSerializationContext jsonSerializationContext) + { + if ((jsonSerializationContext.isSerializePackageableElementName() && pureObject instanceof org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement) || MetamodelSerializationOverrides.shouldSerializeAsElementToPath(pureObject)) + { + return MetamodelSerializationOverrides.serializePackageableElement(pureObject, jsonSerializationContext.isSerializeMultiplicityAsNumber()); + } + jsonSerializationContext.getVisitedInstances().push(pureObject); + JSONObject json = new JSONObject(); + if (jsonSerializationContext.isIncludeType()) + { + json.put(jsonSerializationContext.getTypeKeyName(), this.pureTypeAsString()); + } + boolean shouldApplyMetamodelPropertyFilter = MetamodelSerializationOverrides.applyMetamodelPropertyFilter(this.clazz); + if (shouldApplyMetamodelPropertyFilter) + { + this.propertyConversions = this.propertyConversions.select(MetamodelSerializationOverrides.computeMetamodelPropertyFilter(this.pureTypeAsString())); + } + for (PropertyConversion propertyConversion : this.propertyConversions) + { + Object values = jsonSerializationContext.getValueForProperty(pureObject, (Property) propertyConversion.getProperty(), this.clazz._name()); + Object serializedValues = propertyConversion.apply(values, jsonSerializationContext); + if (this.doNotDropKeyValue(jsonSerializationContext, serializedValues)) + { + json.put(propertyConversion.getName(), serializedValues); + } + } + if (jsonSerializationContext.isSerializeQualifiedProperties()) + { + for (JsonQualifiedPropertySerialization jsonQualifiedPropertySerialization : this.qualifiedPropertySerializations) + { + json.put(jsonQualifiedPropertySerialization.getName(), jsonQualifiedPropertySerialization.apply(pureObject, jsonSerializationContext)); + } + } + jsonSerializationContext.getVisitedInstances().pop(); + return json; + } + + private boolean doNotDropKeyValue(JsonSerializationContext jsonSerializationContext, Object serializedValues) + { + return !(jsonSerializationContext.isRemovePropertiesWithEmptyValues() && serializedValues instanceof JSONArray && ((JSONArray) serializedValues).isEmpty() + || serializedValues == JsonPropertySerialization.CYCLE_DETECTED); + } + + private boolean isExactType(T pureObject, ProcessorSupport processorSupport) + { + return processorSupport.getClassifier(pureObject).equals(this.clazz); + } + + private Conversion resolveTypeAndGetConverter(T pureObject, JsonSerializationContext jsonSerializationContext) + { + return jsonSerializationContext.getConversionCache().getConversion((Type) jsonSerializationContext.getProcessorSupport().getClassifier(pureObject), jsonSerializationContext); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonContext.java new file mode 100644 index 00000000000..d83cd31b4bc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonContext.java @@ -0,0 +1,22 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +public interface JsonContext +{ + String getTypeKeyName(); + + boolean computeQualifiedPropertyConverters(); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationCache.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationCache.java new file mode 100644 index 00000000000..97b5dfb86e1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationCache.java @@ -0,0 +1,172 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateTime; +import org.finos.legend.pure.m4.coreinstance.primitive.date.LatestDate; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionCache; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.EnumerationConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.GenericAndAnyTypeNotSupportedConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.MapConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PrimitiveConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.UnitConversion; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +public class JsonDeserializationCache extends ConversionCache +{ + @Override + protected Map> constructPrimitiveConversions() + { + Map> primitiveConverters = new HashMap<>(); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Integer, PrimitiveConversion.noOpConversion(Long.class, "Integer", true)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.String, PrimitiveConversion.noOpConversion(String.class, "String", true)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Number, PrimitiveConversion.noOpConversion(Number.class, "Number", true)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Boolean, PrimitiveConversion.noOpConversion(Boolean.class, "Boolean", true)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Float, new PrimitiveConversion() + { + @Override + public Double apply(Number value, ConversionContext context) + { + return value.doubleValue(); + } + + @Override + public String pureTypeAsString() + { + return "Number"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Decimal, new PrimitiveConversion() + { + @Override + public BigDecimal apply(Number value, ConversionContext context) + { + return new BigDecimal(value.toString()); + } + + @Override + public String pureTypeAsString() + { + return "Number"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Date, new PrimitiveConversion() + { + @Override + public PureDate apply(String value, ConversionContext context) + { + return DateFunctions.parsePureDate(value); + } + + @Override + public String pureTypeAsString() + { + return "Date"; + } + + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.DateTime, new PrimitiveConversion() + { + @Override + public DateTime apply(String value, ConversionContext context) + { + return (DateTime)DateFunctions.parsePureDate(value); + } + + @Override + public String pureTypeAsString() + { + return "DateTime"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.StrictDate, new PrimitiveConversion() + { + @Override + public PureDate apply(String value, ConversionContext context) + { + return DateFunctions.parsePureDate(value); + } + + @Override + public String pureTypeAsString() + { + return "StrictDate"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.LatestDate, new PrimitiveConversion() + { + @Override + public LatestDate apply(String value, ConversionContext context) + { + return LatestDate.instance; + } + + @Override + public String pureTypeAsString() + { + return "LatestDate"; + } + }); + return primitiveConverters; + } + + @Override + protected ClassConversion newClassConversion(Class clazz, ConversionContext context) + { + return new JsonClassDeserialization<>(clazz); + } + + @Override + protected MapConversion newMapConversion(ConversionContext context) + { + return new JsonMapDeserialization<>(); + } + + @Override + protected EnumerationConversion newEnumerationConversion(Enumeration enumeration, ConversionContext context) + { + return new JsonEnumerationDeserialization<>(enumeration); + } + + @Override + protected UnitConversion newUnitConversion(CoreInstance type, ConversionContext context) + { + return new JsonUnitDeserialization<>(type); + } + + @Override + protected Conversion newGenericAndAnyTypeConversion(boolean isExplicitAny, ConversionContext context) + { + if (isExplicitAny) + { + return JsonAnyTypeDeserialization.JSON_ANY_TYPE_DESERIALIZATION; + } + else + { + return GenericAndAnyTypeNotSupportedConversion.GENERIC_AND_ANY_TYPE_NOT_SUPPORTED_CONVERSION; + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationContext.java new file mode 100644 index 00000000000..dc5bfda1cb6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationContext.java @@ -0,0 +1,53 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionCache; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.DeserializationContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ObjectFactory; + +import java.util.Map; + +public class JsonDeserializationContext extends DeserializationContext +{ + private final boolean failOnUnknownProperties; + private final String typeKeyName; + private final Map typeLookup; + + public JsonDeserializationContext(ConversionCache conversionCache, SourceInformation sourceInformation, ProcessorSupport processorSupport, String typeKeyName, Map typeLookup, Boolean failOnUnknownProperties, ObjectFactory objectFactory) + { + super(conversionCache, sourceInformation, processorSupport, objectFactory); + this.failOnUnknownProperties = failOnUnknownProperties; + this.typeKeyName = typeKeyName; + this.typeLookup = typeLookup; + } + + public boolean isFailOnUnknownProperties() + { + return this.failOnUnknownProperties; + } + + public String getTypeKeyName() + { + return this.typeKeyName; + } + + public Map getTypeLookup() + { + return this.typeLookup; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityMany.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityMany.java new file mode 100644 index 00000000000..8e797848fe9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityMany.java @@ -0,0 +1,46 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonDeserializationMultiplicityMany extends JsonPropertyDeserialization +{ + public JsonDeserializationMultiplicityMany(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public RichIterable apply(Object jsonValue, ConversionContext context) + { + JsonDeserializationContext jsonDeserializationContext = (JsonDeserializationContext) context; + if (jsonValue == null) + { + return Lists.immutable.empty(); + } + if (jsonValue instanceof JSONArray) + { + return applyConversion((JSONArray) jsonValue, jsonDeserializationContext); + } + return applyConversion(jsonValue, jsonDeserializationContext); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOne.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOne.java new file mode 100644 index 00000000000..0ff8189c486 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOne.java @@ -0,0 +1,61 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonDeserializationMultiplicityOne extends JsonPropertyDeserialization +{ + public JsonDeserializationMultiplicityOne(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public RichIterable apply(Object jsonValue, ConversionContext context) + { + JsonDeserializationContext jsonDeserializationContext = (JsonDeserializationContext) context; + if (jsonValue == null) + { + if (!isFromAssociation()) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity [1], found 0 value(s)."); + } + return Lists.immutable.empty(); + } + if (jsonValue instanceof JSONArray) + { + JSONArray jsonValues = (JSONArray) jsonValue; + if (jsonValues.size() > 1) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity [1], found " + jsonValues.size() + " value(s)."); + } + if (jsonValues.isEmpty() && !isFromAssociation()) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity [1], found 0 value(s)."); + } + Object value = ((JSONArray) jsonValue).get(0); + return applyConversion(value, jsonDeserializationContext); + } + return applyConversion(jsonValue, jsonDeserializationContext); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOptional.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOptional.java new file mode 100644 index 00000000000..463c11d9272 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityOptional.java @@ -0,0 +1,56 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonDeserializationMultiplicityOptional extends JsonPropertyDeserialization +{ + public JsonDeserializationMultiplicityOptional(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public RichIterable apply(Object jsonValue, ConversionContext context) + { + JsonDeserializationContext jsonDeserializationContext = (JsonDeserializationContext) context; + if (jsonValue == null) + { + return Lists.immutable.empty(); + } + if (jsonValue instanceof JSONArray) + { + JSONArray jsonValues = (JSONArray) jsonValue; + if (jsonValues.size() > 1) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity [0..1], found " + jsonValues.size() + " value(s)."); + } + if (jsonValues.isEmpty()) + { + return Lists.immutable.empty(); + } + return applyConversion(jsonValues.get(0), jsonDeserializationContext); + } + return applyConversion(jsonValue, jsonDeserializationContext); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityParameterised.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityParameterised.java new file mode 100644 index 00000000000..26d12fdec58 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityParameterised.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; + +public class JsonDeserializationMultiplicityParameterised extends JsonPropertyDeserialization +{ + public JsonDeserializationMultiplicityParameterised(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public RichIterable apply(Object value, ConversionContext context) + { + throw new PureExecutionException("Deserialization of properties with parameterised multiplicity not supported. Tried to deserialize: "); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityRange.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityRange.java new file mode 100644 index 00000000000..0281ee2cef5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializationMultiplicityRange.java @@ -0,0 +1,71 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonDeserializationMultiplicityRange extends JsonPropertyDeserialization +{ + private final Long lowerBound; + private final Long upperBound; + private final String humanReadableMultiplicity; + + public JsonDeserializationMultiplicityRange(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type, Multiplicity multiplicity) + { + super(property, isFromAssociation, conversion, type); + this.upperBound = multiplicity._upperBound()._value(); + this.lowerBound = multiplicity._lowerBound()._value(); + this.humanReadableMultiplicity = org.finos.legend.pure.m3.navigation.multiplicity.Multiplicity.print(multiplicity); + } + + @Override + public RichIterable apply(Object jsonValue, ConversionContext context) + { + JsonDeserializationContext jsonDeserializationContext = (JsonDeserializationContext) context; + if (jsonValue == null) + { + if (!isFromAssociation() && (this.lowerBound > 0)) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity " + this.humanReadableMultiplicity + ", found 0 value(s)."); + } + return Lists.immutable.empty(); + } + if (jsonValue instanceof JSONArray) + { + JSONArray jsonValues = (JSONArray) jsonValue; + if ((jsonValues.size() < this.lowerBound) || (jsonValues.size() > this.upperBound)) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity " + this.humanReadableMultiplicity + ", found " + jsonValues.size() + " value(s)."); + } + return applyConversion((JSONArray) jsonValue, jsonDeserializationContext); + } + else + { + if ((this.lowerBound > 1) || (this.upperBound < 1)) + { + throw new PureExecutionException(jsonDeserializationContext.getSourceInformation(), "Expected value(s) of multiplicity " + this.humanReadableMultiplicity + ", found 1 value(s)."); + } + return this.applyConversion(jsonValue, jsonDeserializationContext); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializer.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializer.java new file mode 100644 index 00000000000..b3c38afa31e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonDeserializer.java @@ -0,0 +1,127 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.set.MutableSet; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionCache; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Map; + +/** + * Utility class for parsing JSON + */ +public class JsonDeserializer +{ + /** + * If the passed object extracted from the JSON is a JSONObject (i.e. describes a class) then any ambiguity in which + * class is being described, typically because the model simply states the type as some superclass, is resolved by + * using the TypeKey property of the JSONObject. This property has a default key of "@type", but can be configured + * in the JSON Deserialization Config, and is then stored in the JsonConverterContext when fromJson is called. + * + * @param typeFromPropertyDefinition The assumed type from either being passed into the fromJson call, or from the + * model on recursive calls. + * @param obj The Object derived from the JSON; either some native type, JSONArray, or JSONObject. + * @param typeKeyName Override of the TypeKey property. + */ + static Type resolveType(Type typeFromPropertyDefinition, Object obj, String typeKeyName, Map lookup, SourceInformation si) + { + if (!(obj instanceof JSONObject) || !(typeFromPropertyDefinition instanceof Class)) + { + return typeFromPropertyDefinition; + } + JSONObject jsonObject = (JSONObject) obj; + Class classFromPropertyDefinition = (Class) typeFromPropertyDefinition; + String specifiedType = (String) jsonObject.get(typeKeyName); + if (lookup != null && lookup.get(specifiedType) != null) + { + return lookup.get(specifiedType); + } + if (typeKeyName == null || specifiedType == null || classFromPropertyDefinition.getName().equals(specifiedType)) + { + return classFromPropertyDefinition; + } + Deque deque = new ArrayDeque<>(classFromPropertyDefinition._specializations().toSet()); + MutableSet set = Sets.mutable.ofAll(classFromPropertyDefinition._specializations()); + while (!deque.isEmpty()) + { + Type type = deque.poll()._specific(); + if (specifiedType.equals(type.getName())) + { + return type; + } + for (Generalization g : type._specializations()) + { + if (!set.contains(g)) + { + set.add(g); + deque.addLast(g); + } + } + } + throw new PureExecutionException(si, String.format("Could not find a sub-type of \"%s\" with name \"%s\".", PackageableElement.getUserPathForPackageableElement(classFromPropertyDefinition), specifiedType)); + } + + @SuppressWarnings("unchecked") + // as resolvedType is a Class (because all root JSON structures must be a PURE class), only ClassConverters, or in case of a Map, MapConverters, can be returned by the ConverterCache + public static T fromJson(String json, Class clazz, JsonDeserializationContext context) + { + try + { + ConversionCache cache = new JsonDeserializationCache(); + JSONObject jsonObject = (JSONObject) new JSONParser().parse(json); + Class resolvedType = (Class) resolveType(clazz, jsonObject, context.getTypeKeyName(), context.getTypeLookup(), context.getSourceInformation()); + if (resolvedType.getName().equals("Map")) + { + JsonMapDeserialization conversion = (JsonMapDeserialization) cache.getConversion(resolvedType, context); // Map is of Class type but has no properties, thus using a separate deserialization strategy + return conversion.apply(jsonObject, context); + } + else + { + JsonClassDeserialization conversion = (JsonClassDeserialization) cache.getConversion(resolvedType, context); + return conversion.apply(jsonObject, context); + } + } + catch (ParseException e) + { + throw new IllegalArgumentException("Illegal JSON."); + } + catch (ClassCastException e) + { + String java11runtime = "class org.json.simple.JSONArray cannot be cast to class org.json.simple.JSONObject (org.json.simple.JSONArray and org.json.simple.JSONObject are in unnamed module of loader 'app')"; + String java7runtime = "org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject"; + if (java7runtime.equals(e.getMessage()) || java11runtime.equals(e.getMessage())) + { + throw new PureExecutionException(context.getSourceInformation(), "Can only deserialize root-level JSONObjects i.e. serialized single instances of PURE classes. Cannot deserialize collections of multiple PURE objects."); + } + else + { + throw e; + } + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationDeserialization.java new file mode 100644 index 00000000000..7bd99db91f1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationDeserialization.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.EnumerationConversion; + +public class JsonEnumerationDeserialization extends EnumerationConversion +{ + public JsonEnumerationDeserialization(Enumeration enumeration) + { + super(enumeration); + } + + @Override + public T apply(String jsonValue, ConversionContext context) + { + int dotIndex = jsonValue.lastIndexOf('.'); + String enumName = dotIndex == -1 ? jsonValue : jsonValue.substring(dotIndex + 1); + T value = (T) this.valueMap.get(enumName); + if (value == null) + { + throw new PureExecutionException(context.getSourceInformation(), "Unknown enum: " + this.enumerationName() + "." + enumName); + } + return value; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationSerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationSerialization.java new file mode 100644 index 00000000000..74134b9a6c9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonEnumerationSerialization.java @@ -0,0 +1,37 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enum; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.EnumerationConversion; + + +public class JsonEnumerationSerialization extends EnumerationConversion +{ + public JsonEnumerationSerialization(Enumeration enumeration) + { + super(enumeration); + } + + @Override + public String apply(T value, ConversionContext context) + { + return ((Enum)value)._name(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonExtraTypeProcessor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonExtraTypeProcessor.java new file mode 100644 index 00000000000..65623a379db --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonExtraTypeProcessor.java @@ -0,0 +1,20 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +public interface JsonExtraTypeProcessor +{ + Object process(Object pureObject, JsonSerializationContext jsonSerializationContext); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonGenericAndAnyTypeSerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonGenericAndAnyTypeSerialization.java new file mode 100644 index 00000000000..b1043f718de --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonGenericAndAnyTypeSerialization.java @@ -0,0 +1,56 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; + +public class JsonGenericAndAnyTypeSerialization implements Conversion +{ + static final JsonGenericAndAnyTypeSerialization JSON_GENERIC_AND_ANY_TYPE_SERIALIZATION = new JsonGenericAndAnyTypeSerialization(); + + @Override + public Object apply(T pureObject, ConversionContext context) + { + JsonSerializationContext jsonSerializationContext = (JsonSerializationContext) context; + if (pureObject instanceof CoreInstance) + { + Type type = (Type) jsonSerializationContext.getClassifier(pureObject); + Conversion concreteConversion = (Conversion) jsonSerializationContext.getConversionCache().getConversion(type, jsonSerializationContext); + if (type instanceof PrimitiveType) + { + return concreteConversion.apply((T) jsonSerializationContext.extractPrimitiveValue(pureObject), jsonSerializationContext); + } + return concreteConversion.apply(pureObject, jsonSerializationContext); + } + //JSON Simple library can handle stringifying and correct escaping of all other primitive (Java) types except PureDate as it's our custom one + // so we need to explicitly convert it to String ourselves before handing over to JSON library + if (pureObject instanceof PureDate) + { + return pureObject.toString(); + } + return pureObject; + } + + @Override + public String pureTypeAsString() + { + return "T"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapDeserialization.java new file mode 100644 index 00000000000..555f47abb0d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapDeserialization.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.MapConversion; + +public class JsonMapDeserialization extends MapConversion +{ + public JsonMapDeserialization() + { + + } + + @Override + public T apply(Object input, ConversionContext context) + { + throw new PureExecutionException("Map deserialization is not currently supported."); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapSerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapSerialization.java new file mode 100644 index 00000000000..d7c9e65473a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonMapSerialization.java @@ -0,0 +1,74 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.impl.map.mutable.UnifiedMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.TypeCoreInstanceWrapper; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.MapConversion; + +import java.util.Map; + +public class JsonMapSerialization extends MapConversion +{ + public JsonMapSerialization() + { + } + + // Apply conversion and transform Pure Map to Java Map. + @Override + public Map apply(T pureObject, ConversionContext context) + { + Map resultMap = UnifiedMap.newMap(); + JsonSerializationContext jsonSerializationContext = (JsonSerializationContext)context; + RichIterable keyValuePairs = jsonSerializationContext.getMapKeyValues(pureObject); + for (CoreInstance keyValuePair : keyValuePairs) + { + resultMap.put(getKey(keyValuePair, jsonSerializationContext), getValue(keyValuePair, jsonSerializationContext)); + } + return resultMap; + } + + private static String getKey(CoreInstance keyValuePair, JsonSerializationContext context) + { + CoreInstance key = Instance.getValueForMetaPropertyToOneResolved(keyValuePair, M3Properties.first, context.getProcessorSupport()); + CoreInstance type = context.getClassifier(key); + if (!((type instanceof PrimitiveType) && ModelRepository.STRING_TYPE_NAME.equals(type.getName()))) + { + StringBuilder builder = new StringBuilder("Only String-key map conversions are supported, found key type: "); + PackageableElement.writeUserPathForPackageableElement(builder, type); + throw new PureExecutionException(builder.toString()); + } + Conversion keyConcreteConversion = (Conversion)context.getConversionCache().getConversion(TypeCoreInstanceWrapper.toType(type), context); + return keyConcreteConversion.apply(context.extractPrimitiveValue(key), context); + } + + private static Object getValue(CoreInstance keyValuePair, JsonSerializationContext context) + { + CoreInstance value = Instance.getValueForMetaPropertyToOneResolved(keyValuePair, M3Properties.second, context.getProcessorSupport()); + CoreInstance type = context.getClassifier(value); + Conversion valConcreteConversion = (Conversion)context.getConversionCache().getConversion(TypeCoreInstanceWrapper.toType(type), context); + return (type instanceof PrimitiveType) ? valConcreteConversion.apply(context.extractPrimitiveValue(value), context) : valConcreteConversion.apply(value, context); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonParser.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonParser.java new file mode 100644 index 00000000000..fde2e1397a1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonParser.java @@ -0,0 +1,206 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.block.factory.Predicates; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + +import java.io.IOException; +import java.io.Reader; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Map; +import java.util.Set; + +public final class JsonParser +{ + public static JsonExtraTypeProcessor processor = new DefaultJsonExtraTypeProcessor(); + private static final String JSONKeyValue = "meta::json::JSONKeyValue"; + private static final String JSONString = "meta::json::JSONString"; + private static final String JSONNumber = "meta::json::JSONNumber"; + private static final String JSONBoolean = "meta::json::JSONBoolean"; + private static final String JSONArray = "meta::json::JSONArray"; + private static final String JSONObject = "meta::json::JSONObject"; + private static final String JSONNull = "meta::json::JSONNull"; + + private static final String key = "key"; + private static final String value = "value"; + private static final String values = "values"; + private static final String keyValuePairs = "keyValuePairs"; + private final ProcessorSupport processorSupport; + + + public JsonParser(ProcessorSupport processorSupport) + { + this.processorSupport = processorSupport; + } + + public CoreInstance toPureJson(String input) + { + try + { + Object object = new JSONParser().parse(input); + return this.createJsonElement(object); + } + catch (ParseException e) + { + throw new RuntimeException("Failed to parse input: " + e.getMessage(), e); + } + } + + public CoreInstance toPureJson(Reader input) throws IOException + { + try + { + Object object = new JSONParser().parse(input); + return this.createJsonElement(object); + } + catch (ParseException e) + { + throw new RuntimeException("Failed to parse input: " + e.getMessage(), e); + } + } + + public CoreInstance createJsonElement(Object object) + { + if (object == null) + { + return this.createJsonNull(); + } + else if (object instanceof org.json.simple.JSONObject) + { + return this.createJsonObject((org.json.simple.JSONObject)object); + } + else if (object instanceof String) + { + return this.createJsonString((String)object); + } + else if (object instanceof Number) + { + return this.createJsonNumber((Number)object); + } + else if (object instanceof Boolean) + { + return this.createJsonBoolean((Boolean)object); + } + else if (object instanceof org.json.simple.JSONArray) + { + return this.createJsonArray((org.json.simple.JSONArray)object); + } + else + { + throw new RuntimeException("Unexpected JSON Element with class " + object.getClass().getName()); + } + } + + private CoreInstance createJsonArray(org.json.simple.JSONArray jsonArray) + { + MutableList results = Lists.mutable.of(); + + for (Object val : jsonArray) + { + results.add(this.createJsonElement(val)); + } + + CoreInstance instance = this.createCoreInstance(JSONArray); + Instance.setValuesForProperty(instance, values, results, this.processorSupport); + return instance; + } + + private CoreInstance createJsonObject(org.json.simple.JSONObject jsonObject) + { + MutableList results = Lists.mutable.of(); + + for (Map.Entry entry : ((Set)jsonObject.entrySet())) + { + String entryKey = (String)entry.getKey(); + + CoreInstance jsonKeyValue = this.createCoreInstance(JSONKeyValue); + Instance.setValuesForProperty(jsonKeyValue, key, Lists.immutable.of(this.createJsonString(entryKey)), this.processorSupport); + Instance.setValuesForProperty(jsonKeyValue, value, Lists.immutable.of(this.createJsonElement(entry.getValue())), this.processorSupport); + results.add(jsonKeyValue); + } + + CoreInstance instance = this.createCoreInstance(JSONObject); + Instance.setValuesForProperty(instance, keyValuePairs, results, this.processorSupport); + return instance; + } + + + private CoreInstance createJsonString(String value) + { + CoreInstance coreInstance = this.createCoreInstance(JSONString); + CoreInstance stringInstance = this.processorSupport.newCoreInstance(value, M3Paths.String, null); + Instance.setValuesForProperty(coreInstance, M3Properties.value, Lists.immutable.of(stringInstance), this.processorSupport); + return coreInstance; + } + + + private CoreInstance createJsonNumber(Number value) + { + ListIterable integerTypes = FastList.newListWith(Integer.class, Long.class, BigInteger.class); + ListIterable floatTypes = FastList.newListWith(Float.class, Double.class, BigDecimal.class); + + String m3NumberType; + + if (integerTypes.anySatisfy(Predicates.equal(value.getClass()))) + { + m3NumberType = M3Paths.Integer; + } + else if (floatTypes.anySatisfy(Predicates.equal(value.getClass()))) + { + m3NumberType = M3Paths.Float; + } + else + { + throw new RuntimeException("Json value is not compatible with supported primitive types: Integer Types: " + integerTypes + " Float Types: " + floatTypes); + } + + CoreInstance coreInstance = this.createCoreInstance(JSONNumber); + CoreInstance numberInstance = this.processorSupport.newCoreInstance(value.toString(), m3NumberType, null); + Instance.setValuesForProperty(coreInstance, M3Properties.value, Lists.immutable.of(numberInstance), this.processorSupport); + return coreInstance; + } + + private CoreInstance createJsonBoolean(Boolean value) + { + CoreInstance coreInstance = this.createCoreInstance(JSONBoolean); + CoreInstance booleanInstance = this.processorSupport.newCoreInstance(value.toString(), M3Paths.Boolean, null); + Instance.setValuesForProperty(coreInstance, M3Properties.value, Lists.immutable.of(booleanInstance), this.processorSupport); + return coreInstance; + } + + private CoreInstance createJsonNull() + { + return this.createCoreInstance(JSONNull); + } + + private CoreInstance createCoreInstance(String type) + { + ProcessorSupport processorSupport = this.processorSupport; + return processorSupport.newEphemeralAnonymousCoreInstance(type); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertyDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertyDeserialization.java new file mode 100644 index 00000000000..efa697c47aa --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertyDeserialization.java @@ -0,0 +1,60 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.impl.utility.Iterate; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PropertyDeserialization; +import org.json.simple.JSONArray; + +public abstract class JsonPropertyDeserialization extends PropertyDeserialization +{ + public JsonPropertyDeserialization(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @SuppressWarnings("unchecked") + protected RichIterable applyConversion(JSONArray jsonValue, JsonDeserializationContext context) + { + return Iterate.flatCollect(jsonValue, v -> applyConversion(v, context), Lists.mutable.empty()); + } + + protected RichIterable applyConversion(Object jsonValue, JsonDeserializationContext context) + { + Conversion conversion = this.getConversion(jsonValue, context); + T output = conversion.apply(jsonValue, context); + return (output == null) ? Lists.immutable.empty() : Lists.immutable.with(output); + } + + @SuppressWarnings("unchecked") + private Conversion getConversion(Object jsonValue, JsonDeserializationContext context) + { + if (this.conversion instanceof ClassConversion) + { + Type resolvedType = JsonDeserializer.resolveType(this.type, jsonValue, context.getTypeKeyName(), context.getTypeLookup(), context.getSourceInformation()); + if (!resolvedType.equals(this.type)) + { + return (Conversion) context.getConversionCache().getConversion(resolvedType, context); + } + } + return this.conversion; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertySerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertySerialization.java new file mode 100644 index 00000000000..74af7ffd5af --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonPropertySerialization.java @@ -0,0 +1,154 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Stereotype; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PropertySerialization; +import org.finos.legend.pure.runtime.java.extension.functions.shared.cipher.AESCipherUtil; + +public abstract class JsonPropertySerialization extends PropertySerialization +{ + static final Object CYCLE_DETECTED = new Object(); + + private Boolean hasCipherStereotype; + private Boolean hasDecipherStereotype; + + public JsonPropertySerialization(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + Object serialize(T pureObject, JsonSerializationContext jsonSerializationContext) + { + if (jsonSerializationContext.isEnableEncryption()) + { + return this.potentiallyEncryptSerializedValue(this.applyConversion(pureObject, jsonSerializationContext), jsonSerializationContext); + } + else if (jsonSerializationContext.isEnableDecryption()) + { + return this.potentiallyDecryptSerializedValue(this.applyConversion(pureObject, jsonSerializationContext), jsonSerializationContext); + } + else + { + return this.applyConversion(pureObject, jsonSerializationContext); + } + } + + private Object applyConversion(T pureObject, JsonSerializationContext jsonSerializationContext) + { + if (this.type != null && this.type.equals(jsonSerializationContext.getProcessorSupport().type_TopType())) + { + /* processorSupport.type_TopType() returns Any - if property is defined in the graph as type Any we need to + * resolve its concrete type from the instance at runtime as we do with generic type properties so invoking GenericAndAnyTypeConverter + * which provides this functionality + */ + return JsonGenericAndAnyTypeSerialization.JSON_GENERIC_AND_ANY_TYPE_SERIALIZATION.apply(pureObject, jsonSerializationContext); + } + else + { + if (this.type instanceof PrimitiveType) + { + return this.conversion.apply((T) jsonSerializationContext.extractPrimitiveValue(pureObject), jsonSerializationContext); + } + if (this.conversion instanceof ClassConversion && jsonSerializationContext.getVisitedInstances().contains(pureObject)) + { + return CYCLE_DETECTED; + } + if (this.getName().equals(M3Properties.rawType) && this.conversion.pureTypeAsString().equals(M3Paths.Type)) + { + return MetamodelSerializationOverrides.serializePackageableElement((Any) pureObject, false); + } + Object res = JsonParser.processor.process(pureObject, jsonSerializationContext); + if (res != null) + { + return res; + } + if (!(pureObject instanceof CoreInstance)) + { + return pureObject; // pureObject as compiled mode object + } + return this.conversion.apply(pureObject, jsonSerializationContext); + } + } + + private Object potentiallyEncryptSerializedValue(Object serialized, JsonSerializationContext jsonSerializationContext) + { + if (this.hasEncryptStereotype(jsonSerializationContext.getEncryptionStereotypes())) + { + try + { + return new String(AESCipherUtil.encrypt(jsonSerializationContext.getEncryptionKey(), serialized.toString().getBytes())); + } + catch (Exception e) + { + throw new PureExecutionException("Failed to encrypt serialized json property: " + this.getName() + "\nwith key: " + jsonSerializationContext.getEncryptionKey(), e); + } + } + return serialized; + } + + private Object potentiallyDecryptSerializedValue(Object serialized, JsonSerializationContext jsonSerializationContext) + { + if (this.hasDecryptStereotype(jsonSerializationContext.getDecryptionStereotypes())) + { + try + { + return new String(AESCipherUtil.decrypt(jsonSerializationContext.getDecryptionKey(), serialized.toString().getBytes())); + } + catch (Exception e) + { + throw new PureExecutionException("Failed to decrypt serialized json property: " + this.getName() + "\nwith key: " + jsonSerializationContext.getDecryptionKey(), e); + } + } + return serialized; + } + + private boolean hasEncryptStereotype(final RichIterable encryptionStereotypes) + { + if (this.hasCipherStereotype == null) + { + this.hasCipherStereotype = this.property._stereotypes().anySatisfy(stereotype -> encryptionStereotypes.isEmpty() ? "Cipher".equals(stereotype._value()) : encryptionStereotypes.anySatisfy(st -> stereotypesEqual(st, stereotype))); + } + return this.hasCipherStereotype; + } + + private boolean hasDecryptStereotype(final RichIterable decryptionStereotypes) + { + if (this.hasDecipherStereotype == null) + { + this.hasDecipherStereotype = this.property._stereotypes().anySatisfy(stereotype -> decryptionStereotypes.isEmpty() ? "Decipher".equals(stereotype._value()) : decryptionStereotypes.anySatisfy(st -> stereotypesEqual(st, stereotype))); + } + return this.hasDecipherStereotype; + } + + private static boolean stereotypesEqual(CoreInstance each, Stereotype stereotype) + { + Stereotype eachStereotype = (Stereotype) each; + return eachStereotype._value().equals(stereotype._value()) && + PackageableElement.getUserPathForPackageableElement(eachStereotype._profile()).equals(PackageableElement.getUserPathForPackageableElement(stereotype._profile())); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonQualifiedPropertySerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonQualifiedPropertySerialization.java new file mode 100644 index 00000000000..d82870e4535 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonQualifiedPropertySerialization.java @@ -0,0 +1,58 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; + +public class JsonQualifiedPropertySerialization implements Conversion +{ + private final QualifiedProperty qualifiedProperty; + private final String name; + private final Type type; + private final Multiplicity multiplicity; + private final Conversion conversion; + + public JsonQualifiedPropertySerialization(QualifiedProperty qualifiedProperty, String name, Type type, Multiplicity multiplicity, Conversion conversion) + { + this.qualifiedProperty = qualifiedProperty; + this.name = name; + this.type = type; + this.multiplicity = multiplicity; + this.conversion = conversion; + } + + @Override + public Object apply(T pureObject, ConversionContext context) + { + JsonSerializationContext jsonSerializationContext = (JsonSerializationContext)context; + Object evaluatedProperty = jsonSerializationContext.evaluateQualifiedProperty(pureObject, this.qualifiedProperty, this.type, this.multiplicity, this.name); + return this.conversion.apply(evaluatedProperty, jsonSerializationContext); + } + + @Override + public String pureTypeAsString() + { + return this.type.getName(); + } + + public String getName() + { + return this.name; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationCache.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationCache.java new file mode 100644 index 00000000000..59959724f62 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationCache.java @@ -0,0 +1,163 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateTime; +import org.finos.legend.pure.m4.coreinstance.primitive.date.LatestDate; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ClassConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionCache; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.EnumerationConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.MapConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PrimitiveConversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.UnitConversion; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +public class JsonSerializationCache extends ConversionCache +{ + @Override + protected Map> constructPrimitiveConversions() + { + Map> primitiveConverters = new HashMap<>(); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Integer, PrimitiveConversion.noOpConversion(Long.class, "Integer", false)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.String, PrimitiveConversion.noOpConversion(String.class, "String", false)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Number, PrimitiveConversion.noOpConversion(Number.class, "Number", false)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Boolean, PrimitiveConversion.noOpConversion(Boolean.class, "Boolean", false)); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Float, new PrimitiveConversion() + { + @Override + public Double apply(Double value, ConversionContext context) + { + return value; + } + + @Override + public String pureTypeAsString() + { + return "Number"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Decimal, new PrimitiveConversion() + { + @Override + public BigDecimal apply(BigDecimal value, ConversionContext context) + { + return value; + } + + @Override + public String pureTypeAsString() + { + return "Number"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.Date, new PrimitiveConversion() + { + @Override + public String apply(PureDate value, ConversionContext context) + { + return value.toString(); + } + + @Override + public String pureTypeAsString() + { + return "Date"; + } + + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.DateTime, new PrimitiveConversion() + { + @Override + public String apply(DateTime value, ConversionContext context) + { + return this.potentiallyFormatDateTime(value, ((JsonSerializationContext)context).getDateTimeFormat()); + } + + @Override + public String pureTypeAsString() + { + return "DateTime"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.StrictDate, new PrimitiveConversion() + { + @Override + public String apply(PureDate value, ConversionContext context) + { + return value.toString(); + } + + @Override + public String pureTypeAsString() + { + return "StrictDate"; + } + }); + primitiveConverters.put(PrimitiveConversion.PurePrimitive.LatestDate, new PrimitiveConversion() + { + @Override + public String apply(LatestDate value, ConversionContext context) + { + return "%latest"; + } + + @Override + public String pureTypeAsString() + { + return "LatestDate"; + } + }); + return primitiveConverters; + } + + @Override + protected ClassConversion newClassConversion(Class clazz, ConversionContext context) + { + return new JsonClassSerialization<>(clazz); + } + + @Override + protected MapConversion newMapConversion(ConversionContext context) + { + return new JsonMapSerialization<>(); + } + + @Override + protected EnumerationConversion newEnumerationConversion(Enumeration enumeration, ConversionContext context) + { + return new JsonEnumerationSerialization<>(enumeration); + } + + @Override + protected UnitConversion newUnitConversion(CoreInstance type, ConversionContext context) + { + return new JsonUnitSerialization<>(type); + } + + @Override + protected Conversion newGenericAndAnyTypeConversion(boolean isExplicitAny, ConversionContext context) + { + return JsonGenericAndAnyTypeSerialization.JSON_GENERIC_AND_ANY_TYPE_SERIALIZATION; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationContext.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationContext.java new file mode 100644 index 00000000000..e2adb424710 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationContext.java @@ -0,0 +1,148 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.QualifiedProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionCache; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.SerializationContext; + +import java.util.Stack; + +public abstract class JsonSerializationContext extends SerializationContext +{ + private final String typeKeyName; + private final boolean includeType; + private final boolean fullyQualifiedTypePath; + private final boolean serializeQualifiedProperties; + private final String dateTimeFormat; + private final boolean serializePackageableElementName; + private final boolean removePropertiesWithEmptyValues; + private final boolean serializeMultiplicityAsNumber; + private final boolean enableEncryption; + private final String encryptionKey; + private final RichIterable encryptionStereotypes; + private final boolean enableDecryption; + private final String decryptionKey; + private final RichIterable decryptionStereotypes; + + public JsonSerializationContext(ConversionCache conversionCache, SourceInformation sourceInformation, ProcessorSupport processorSupport, Stack visitedInstances, + String typeKeyName, boolean includeType, boolean fullyQualifiedTypePath, boolean serializeQualifiedProperties, + String dateTimeFormat, boolean serializePackageableElementName, boolean removePropertiesWithEmptyValues, + boolean serializeMultiplicityAsNumber, String encryptionKey, RichIterable encryptionStereotypes, String decryptionKey, RichIterable decryptionStereotypes) + { + super(conversionCache, sourceInformation, processorSupport, visitedInstances); + this.typeKeyName = typeKeyName; + this.includeType = includeType; + this.fullyQualifiedTypePath = fullyQualifiedTypePath; + this.serializeQualifiedProperties = serializeQualifiedProperties; + this.dateTimeFormat = dateTimeFormat; + this.serializePackageableElementName = serializePackageableElementName; + this.removePropertiesWithEmptyValues = removePropertiesWithEmptyValues; + this.serializeMultiplicityAsNumber = serializeMultiplicityAsNumber; + this.enableEncryption = encryptionKey != null; + this.encryptionKey = encryptionKey; + this.encryptionStereotypes = encryptionStereotypes; + this.enableDecryption = decryptionKey != null; + this.decryptionKey = decryptionKey; + this.decryptionStereotypes = decryptionStereotypes; + } + + protected abstract Object extractPrimitiveValue(Object potentiallyWrappedPrimitive); + + protected abstract Object getValueForProperty(F pureObject, Property property, String className); + + protected abstract Object evaluateQualifiedProperty(F pureObject, QualifiedProperty qualifiedProperty, Type type, Multiplicity multiplicity, String propertyName); + + protected abstract CoreInstance getClassifier(F pureObject); + + protected abstract RichIterable getMapKeyValues(F pureObject); + + public String getTypeKeyName() + { + return this.typeKeyName; + } + + public boolean isIncludeType() + { + return this.includeType; + } + + public boolean isFullyQualifiedTypePath() + { + return this.fullyQualifiedTypePath; + } + + public boolean isSerializeQualifiedProperties() + { + return this.serializeQualifiedProperties; + } + + public String getDateTimeFormat() + { + return this.dateTimeFormat; + } + + public boolean isSerializePackageableElementName() + { + return this.serializePackageableElementName; + } + + public boolean isRemovePropertiesWithEmptyValues() + { + return this.removePropertiesWithEmptyValues; + } + + public boolean isSerializeMultiplicityAsNumber() + { + return this.serializeMultiplicityAsNumber; + } + + public boolean isEnableEncryption() + { + return this.enableEncryption; + } + + public String getEncryptionKey() + { + return this.encryptionKey; + } + + public RichIterable getEncryptionStereotypes() + { + return this.encryptionStereotypes; + } + + public boolean isEnableDecryption() + { + return this.enableDecryption; + } + + public String getDecryptionKey() + { + return this.decryptionKey; + } + + public RichIterable getDecryptionStereotypes() + { + return this.decryptionStereotypes; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityMany.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityMany.java new file mode 100644 index 00000000000..1fb0eb48556 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityMany.java @@ -0,0 +1,45 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonSerializationMultiplicityMany extends JsonPropertySerialization +{ + public JsonSerializationMultiplicityMany(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public Object apply(RichIterable pureObject, ConversionContext context) + { + JSONArray jsonArray = new JSONArray(); + for (T value : pureObject) + { + Object serializedValue = this.serialize(value, (JsonSerializationContext) context); + if (serializedValue != CYCLE_DETECTED) + { + jsonArray.add(serializedValue); + } + } + return jsonArray; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOne.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOne.java new file mode 100644 index 00000000000..5ae8767ebef --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOne.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; + +public class JsonSerializationMultiplicityOne extends JsonPropertySerialization +{ + public JsonSerializationMultiplicityOne(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public Object apply(RichIterable pureObject, ConversionContext context) + { + return this.serialize(pureObject.getFirst(), (JsonSerializationContext) context); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOptional.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOptional.java new file mode 100644 index 00000000000..d2d7cd3df2a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityOptional.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonSerializationMultiplicityOptional extends JsonPropertySerialization +{ + public JsonSerializationMultiplicityOptional(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public Object apply(RichIterable pureObject, ConversionContext context) + { + return pureObject.isEmpty() || pureObject.getFirst() == null ? new JSONArray() : this.serialize(pureObject.getFirst(), (JsonSerializationContext) context); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityParameterised.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityParameterised.java new file mode 100644 index 00000000000..c762b457a21 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityParameterised.java @@ -0,0 +1,45 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonSerializationMultiplicityParameterised extends JsonPropertySerialization +{ + public JsonSerializationMultiplicityParameterised(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public Object apply(RichIterable pureObject, ConversionContext context) + { + JSONArray jsonArray = new JSONArray(); + for (T val : pureObject) + { + Object serializedValue = this.serialize(val, (JsonSerializationContext) context); + if (serializedValue != CYCLE_DETECTED) + { + jsonArray.add(serializedValue); + } + } + return jsonArray; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityRange.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityRange.java new file mode 100644 index 00000000000..d845cf1947f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializationMultiplicityRange.java @@ -0,0 +1,46 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.json.simple.JSONArray; + +public class JsonSerializationMultiplicityRange extends JsonPropertySerialization +{ + public JsonSerializationMultiplicityRange(AbstractProperty property, boolean isFromAssociation, Conversion conversion, Type type, Multiplicity multiplicity) + { + super(property, isFromAssociation, conversion, type); + } + + @Override + public Object apply(RichIterable pureObject, ConversionContext context) + { + JSONArray jsonArray = new JSONArray(); + for (T value : pureObject) + { + Object serializedValue = this.serialize(value, (JsonSerializationContext) context); + if (serializedValue != CYCLE_DETECTED) + { + jsonArray.add(serializedValue); + } + } + return jsonArray; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializer.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializer.java new file mode 100644 index 00000000000..160dad3831e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonSerializer.java @@ -0,0 +1,78 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.RichIterable; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.PrimitiveType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.measure.Measure; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.Conversion; +import org.json.simple.JSONArray; +import org.json.simple.JSONValue; + +import java.util.Iterator; + +public class JsonSerializer +{ + private JsonSerializer() + { + } + + public static String toJson(RichIterable pureObjectCollection, ProcessorSupport processorSupport, JsonSerializationContext jsonSerializationContext, SourceInformation sourceInformation) + { + if (pureObjectCollection.isEmpty()) + { + return new JSONArray().toString(); + } + //Using iterator to avoid asserting collection size which would break DB stream if we try to serialize result streamed from DB to json + Iterator collectionIterator = pureObjectCollection.iterator(); + Object firstInstance = collectionIterator.next(); + Object serializedFirstInstance = toJson(firstInstance, processorSupport, jsonSerializationContext, sourceInformation); + if (!collectionIterator.hasNext()) + { + return JSONValue.toJSONString(serializedFirstInstance); + } + + JSONArray jsonArray = new JSONArray(); + jsonArray.add(serializedFirstInstance); + while (collectionIterator.hasNext()) + { + jsonArray.add(toJson(collectionIterator.next(), processorSupport, jsonSerializationContext, sourceInformation)); + } + return jsonArray.toString(); + } + + private static Object toJson(Object pureObject, ProcessorSupport processorSupport, JsonSerializationContext jsonSerializationContext, SourceInformation sourceInformation) + { + if (pureObject instanceof CoreInstance) + { + Type baseClassType = (pureObject instanceof InstanceValue && Measure.isUnitOrMeasureInstance((CoreInstance) pureObject, processorSupport)) ? (Type) Instance.getValueForMetaPropertyToOneResolved((CoreInstance) pureObject, M3Properties.genericType, M3Properties.rawType, processorSupport) : (Type) processorSupport.getClassifier((CoreInstance) pureObject); + Conversion conversion = jsonSerializationContext.getConversionCache().getConversion(baseClassType, jsonSerializationContext); + return conversion.apply((baseClassType instanceof PrimitiveType) ? jsonSerializationContext.extractPrimitiveValue(pureObject) : pureObject, jsonSerializationContext); + } + Object res = JsonParser.processor.process(pureObject, jsonSerializationContext); + if (res != null) + { + return res; + } + return pureObject; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitDeserialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitDeserialization.java new file mode 100644 index 00000000000..b24fc4ea944 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitDeserialization.java @@ -0,0 +1,80 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ObjectFactory; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.UnitConversion; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +public class JsonUnitDeserialization extends UnitConversion +{ + public JsonUnitDeserialization(CoreInstance type) + { + super(type); + } + + @Override + public T apply(Object value, ConversionContext context) + { + String unitTypeString; + Number unitTypeExponent; + boolean isComposite; + JSONArray unitsJsonArray; + try + { + unitsJsonArray = (JSONArray) ((JSONObject) value).get(this.unitKeyName); + unitTypeString = ((JSONObject) unitsJsonArray.get(0)).get("unitId").toString(); + unitTypeExponent = (Number) ((JSONObject) unitsJsonArray.get(0)).get("exponentValue"); + } + catch (Exception e) + { + throw new PureExecutionException("Mal-formatted Json for unit."); + } + isComposite = 1 != unitsJsonArray.size(); + if (isComposite) + { + throw new PureExecutionException("Currently composite units are not supported."); + } + if (!Long.valueOf(1).equals(unitTypeExponent)) + { + throw new PureExecutionException("Currently non-one exponent for unit is not supported. Got: " + unitTypeExponent.toString() + "."); + } + Number unitValue; + try + { + unitValue = (Number) ((JSONObject) value).get(this.valueKeyName); + } + catch (ClassCastException cce) + { + throw new PureExecutionException("Value from unitValue field must be of Number type, getting " + ((JSONObject) value).get(this.valueKeyName).getClass().getName() + " type instead."); + } + JsonDeserializationContext deserializationContext = (JsonDeserializationContext) context; + ObjectFactory objectFactory = deserializationContext.getObjectFactory(); + + try + { + return (T) objectFactory.newUnitInstance(this.type, unitTypeString, unitValue); + } + catch (Exception e) + { + throw new PureExecutionException(deserializationContext.getSourceInformation(), "Could not create new instance of " + this.pureTypeAsString()); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitSerialization.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitSerialization.java new file mode 100644 index 00000000000..e0a1ade9f89 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/JsonUnitSerialization.java @@ -0,0 +1,69 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.factory.Maps; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.ConversionContext; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.UnitConversion; + +public class JsonUnitSerialization extends UnitConversion +{ + public JsonUnitSerialization(CoreInstance type) + { + super(type); + } + + @Override + public Object apply(T pureObject, ConversionContext context) + { + CoreInstance processedPureObject = pureObject; + Object value; + String typeString; + ProcessorSupport processorSupport = context.getProcessorSupport(); + + if (null == pureObject.getValueForMetaPropertyToOne("genericType")) + { + processedPureObject = ValueSpecificationBootstrap.wrapValueSpecification(pureObject, false, context.getProcessorSupport()); + value = Long.valueOf(processedPureObject.getValueForMetaPropertyToOne("values").getValueForMetaPropertyToOne("values").getName()); + try + { + typeString = ((String) pureObject.getClass().getMethod("getFullSystemPath").invoke(pureObject)).substring(6); + } + catch (Exception e) + { + throw new PureExecutionException("Cannot find full path name for the designated unit type."); + } + } + else + { + CoreInstance numericInArray = processedPureObject.getValueForMetaPropertyToOne("values"); + value = numericInArray instanceof PrimitiveCoreInstance ? ((PrimitiveCoreInstance) numericInArray).getValue() : ((PrimitiveCoreInstance) numericInArray.getValueForMetaPropertyToOne("values")).getValue(); + typeString = PackageableElement.getUserPathForPackageableElement(Instance.getValueForMetaPropertyToOneResolved(processedPureObject, M3Properties.genericType, M3Properties.rawType, processorSupport)); + } + + return Maps.mutable.with( + this.unitKeyName, Lists.mutable.with(Maps.mutable.with("unitId", typeString, "exponentValue", 1)), + this.valueKeyName, value); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/MetamodelSerializationOverrides.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/MetamodelSerializationOverrides.java new file mode 100644 index 00000000000..7adf85f526b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/legend-engine-pure-runtime-java-extension-shared-functions-json/src/main/java/org/finos/legend/pure/runtime/java/extension/external/json/shared/MetamodelSerializationOverrides.java @@ -0,0 +1,92 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.json.shared; + +import org.eclipse.collections.api.block.predicate.Predicate; +import org.eclipse.collections.api.list.ImmutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.coreinstance.Package; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Profile; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.multiplicity.Multiplicity; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.shared.conversion.PropertyConversion; + +import java.util.HashMap; +import java.util.Map; + +class MetamodelSerializationOverrides +{ + private static final Map> CLASS_PROPERTIES; + + static + { + CLASS_PROPERTIES = new HashMap<>(); + CLASS_PROPERTIES.put(M3Paths.Property, Lists.immutable.of(M3Properties.name, M3Properties.aggregation, M3Properties.multiplicity, M3Properties.genericType, M3Properties.stereotypes, M3Properties.taggedValues)); + CLASS_PROPERTIES.put(M3Paths.GenericType, Lists.immutable.of(M3Properties.typeParameters, M3Properties.rawType, M3Properties.typeArguments)); + CLASS_PROPERTIES.put(M3Paths.Stereotype, Lists.immutable.of(M3Properties.profile, M3Properties.value)); + CLASS_PROPERTIES.put(M3Paths.TaggedValue, Lists.immutable.of(M3Properties.tag, M3Properties.value)); + CLASS_PROPERTIES.put(M3Paths.TypeParameter, Lists.immutable.of(M3Properties.name)); + CLASS_PROPERTIES.put(M3Paths.Generalization, Lists.immutable.of(M3Properties.general)); + CLASS_PROPERTIES.put(M3Paths.QualifiedProperty, Lists.immutable.of(M3Properties.name, M3Properties.multiplicity, M3Properties.parameters, M3Properties.genericType, M3Properties.stereotypes, M3Properties.taggedValues)); + CLASS_PROPERTIES.put(M3Paths.Tag, Lists.immutable.of(M3Properties.profile, M3Properties.value)); + CLASS_PROPERTIES.put(M3Paths.Association, Lists.immutable.of(M3Properties._package, M3Properties.name, M3Properties.properties, M3Properties.qualifiedProperties, M3Properties.stereotypes, M3Properties.taggedValues)); + CLASS_PROPERTIES.put(M3Paths.FunctionDefinition, Lists.immutable.of(M3Properties.name)); + CLASS_PROPERTIES.put(M3Paths.Class, Lists.immutable.of(M3Properties.name, M3Properties.typeParameters, M3Properties.generalizations, M3Properties.properties, M3Properties.qualifiedProperties, M3Properties.stereotypes, M3Properties.taggedValues)); + CLASS_PROPERTIES.put(M3Paths.Enum, Lists.immutable.of(M3Properties.name)); + CLASS_PROPERTIES.put(M3Paths.Enumeration, Lists.immutable.of(M3Properties.name, M3Properties._package, M3Properties.values)); + CLASS_PROPERTIES.put(M3Paths.VariableExpression, Lists.immutable.of(M3Properties.name, M3Properties.genericType, M3Properties.multiplicity)); + } + + private MetamodelSerializationOverrides() + { + } + + static Predicate> computeMetamodelPropertyFilter(String className) + { + final ImmutableList filteredProperties = CLASS_PROPERTIES.get(className); + return new Predicate>() + { + @Override + public boolean accept(PropertyConversion propertyConversion) + { + return filteredProperties != null && filteredProperties.contains(propertyConversion.getName()); + } + }; + } + + static boolean applyMetamodelPropertyFilter(Class classifier) + { + return CLASS_PROPERTIES.containsKey(PackageableElement.getUserPathForPackageableElement(classifier)); + } + + static boolean shouldSerializeAsElementToPath(CoreInstance instance) + { + return instance instanceof Package || instance instanceof Multiplicity || instance instanceof Profile; + } + + private static Object serializeMultiplicityAsNumber(Multiplicity multiplicity) + { + return org.finos.legend.pure.m3.navigation.multiplicity.Multiplicity.print(multiplicity, false); + } + + static Object serializePackageableElement(CoreInstance pureObject, boolean serializeMultiplicityAsNumber) + { + return serializeMultiplicityAsNumber && pureObject instanceof Multiplicity ? serializeMultiplicityAsNumber((Multiplicity)pureObject) : PackageableElement.getUserPathForPackageableElement(pureObject); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/pom.xml new file mode 100644 index 00000000000..503fa359bdc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-json/pom.xml @@ -0,0 +1,36 @@ + + + + + org.finos.legend.engine + legend-engine-core-pure + 4.50.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-code-functions-json + pom + Legend Engine - Pure - Code - Core - Functions - JSON + + + legend-engine-pure-functions-json-pure + legend-engine-pure-runtime-java-extension-compiled-functions-json + legend-engine-pure-runtime-java-extension-interpreted-functions-json + legend-engine-pure-runtime-java-extension-shared-functions-json + legend-engine-pure-runtime-java-extension-shared-functions-conversion + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/pom.xml similarity index 59% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/pom.xml rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/pom.xml index 58aae54da2a..dfd823bfa5d 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/pom.xml @@ -21,24 +21,45 @@ org.finos.legend.engine - legend-engine-core-pure + legend-engine-pure-code-functions-relation 4.50.2-SNAPSHOT - legend-engine-pure-code-compiled-functions + Legend Pure - Base - M2 Functions - Relation - Pure + legend-engine-pure-functions-relation-pure jar - Legend Engine - Pure - Code - Core - Functions - PAR/JAVA + + org.apache.maven.plugins + maven-compiler-plugin + + + compile + compile + + compile + + + + default-compile + process-classes + + + + ${maven.compiler.source} + ${maven.compiler.target} + + org.finos.legend.pure legend-pure-maven-generation-par - src/main/resources + ${project.basedir}/src/main/resources ${legend.pure.version} - ${project.basedir}/src/main/resources/core_functions.definition.json + ${project.basedir}/src/main/resources/core_functions_relation.definition.json @@ -52,93 +73,82 @@ org.finos.legend.pure - legend-pure-m2-functions-base-pure + legend-pure-m2-dsl-tds-grammar ${legend.pure.version} + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + org.finos.legend.pure - legend-pure-maven-generation-java + legend-pure-maven-generation-pct - compile + process-classes - build-pure-compiled-jar + generate-pct-functions - - true - true - modular - true - - core_functions - - + + ${project.build.directory}/classes/pct-reports/ + org.finos.legend.pure.code.core.RelationCodeRepositoryProvider.relationFunctions + org.finos.legend.pure - legend-pure-m2-functions-base-pure + legend-pure-m2-dsl-tds-grammar ${legend.pure.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - - - org.finos.legend.pure - legend-pure-m4 - org.finos.legend.pure legend-pure-m3-core - org.finos.legend.pure - legend-pure-runtime-java-engine-compiled - - - - org.finos.legend.engine - legend-engine-pure-platform-java + legend-pure-m2-dsl-tds-grammar + runtime org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-functions-unclassified-pure + runtime org.eclipse.collections - eclipse-collections-api + eclipse-collections org.eclipse.collections - eclipse-collections + eclipse-collections-api - - junit junit + test org.finos.legend.pure legend-pure-m3-core - test-jar test + test-jar - - + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/RelationCodeRepositoryProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/RelationCodeRepositoryProvider.java new file mode 100644 index 00000000000..1e1e40da8a8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/RelationCodeRepositoryProvider.java @@ -0,0 +1,36 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class RelationCodeRepositoryProvider implements CodeRepositoryProvider +{ + public static final ReportScope relationFunctions = new ReportScope( + "relation", + "meta::pure::functions::relation", + "/core_functions_relation/" + ); + + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("core_functions_relation.definition.json"); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/Relation_Functions_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/Relation_Functions_PCTReportProvider.java new file mode 100644 index 00000000000..c94352d50f6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/java/org/finos/legend/pure/code/core/Relation_Functions_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Relation_Functions_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return PCTReportProviderTool.load(Thread.currentThread().getContextClassLoader(), Functions.class, + "pct-reports/FUNCTIONS_relation.json" + ); + } + + @Override + public MutableList getAdapterReports() + { + return Lists.mutable.empty(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..a446bf7991c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.Relation_Functions_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..d8a97e874d8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.RelationCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation.definition.json b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation.definition.json new file mode 100644 index 00000000000..ca8612dbb7e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation.definition.json @@ -0,0 +1,8 @@ +{ + "name": "core_functions_relation", + "pattern": "(meta::pure::functions::relation)(::.*)?", + "dependencies": [ + "platform", + "platform_dsl_tds" + ] +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/columns.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/columns.pure new file mode 100644 index 00000000000..9be5e9554a4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/columns.pure @@ -0,0 +1,32 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::metamodel::relation::*; + +native function meta::pure::functions::relation::columns(rel:Relation[1]):Column[*]; + +function <> meta::pure::functions::relation::tests::columns::testSimpleColumns():Boolean[1] +{ + let t = #TDS + val, other, txt + 1, 2, aa + 2, 3, ee + 3, 2, eewe + #; + + assertEquals(['val','other','txt'], $t->columns().name); + + let cols = $t->columns(); + assertEquals('1,2,aa\n2,3,ee\n3,2,eewe', $t->map(x|$cols->map(c|$c->eval($x)->toOne()->toString())->joinStrings(','))->joinStrings('\n')); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/concatenate.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/concatenate.pure new file mode 100644 index 00000000000..0a16e96bfd9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/concatenate.pure @@ -0,0 +1,50 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::concatenate(rel1:Relation[1], rel2:Relation[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::concatenate::testSimpleConcatenateShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + # + ->concatenate + ( + #TDS + val, str + 5, qwea + 6, eeewe + 7, qqwew + #); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str\n'+ + ' 1,a\n'+ + ' 3,ewe\n'+ + ' 4,qw\n'+ + ' 5,qwea\n'+ + ' 6,eeewe\n'+ + ' 7,qqwew\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/distinct.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/distinct.pure new file mode 100644 index 00000000000..8b0a7451ace --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/distinct.pure @@ -0,0 +1,32 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::metamodel::relation::*; +import meta::pure::test::pct::*; + +native function meta::pure::functions::relation::distinct(rel:Relation[1], columns:ColSpecArray[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::distinct::testSimpleDistinct():Boolean[1] +{ + let res = #TDS + val, str + 1, a + 3, ewe + 1, qw + 5, wwe + 5, weq + #->distinct(~[val]); + assertEquals(3, $res->size()); + assertEquals('135', $res->map(c|$c.val->toOne()->toString())->joinStrings('')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/drop.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/drop.pure new file mode 100644 index 00000000000..1e6cce9f0d4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/drop.pure @@ -0,0 +1,40 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::drop(rel:Relation[1], size:Integer[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::drop::testSimpleDropShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->drop(3) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str\n'+ + ' 5,wwe\n'+ + ' 6,weq\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/extend.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/extend.pure new file mode 100644 index 00000000000..20408134e6c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/extend.pure @@ -0,0 +1,121 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::extend(r:Relation[1], f:FuncColSpec<{T[1]->Any[0..1]},Z>[1]):Relation[1]; + +native function <> meta::pure::functions::relation::extend(r:Relation[1], fs:FuncColSpecArray<{T[1]->Any[*]},Z>[1]):Relation[1]; + + +function <> meta::pure::functions::relation::tests::extend::testSimpleExtendStrShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->extend(~name:c|$c.str->toOne() + $c.val->toOne()->toString()) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str,name\n'+ + ' 1,a,a1\n'+ + ' 3,ewe,ewe3\n'+ + ' 4,qw,qw4\n'+ + ' 5,wwe,wwe5\n'+ + ' 6,weq,weq6\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::extend::testSimpleExtendInt(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->extend(~name:c|$c.val->toOne() + 1) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str,name\n'+ + ' 1,a,2\n'+ + ' 3,ewe,4\n'+ + ' 4,qw,5\n'+ + ' 5,wwe,6\n'+ + ' 6,weq,7\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::extend::testSimpleExtendFloat(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, doub + 1, 1.2 + 3, 2.3 + 4, 4.2 + 5, 4.2 + 6, 4.5 + #->extend(~name:c|$c.doub->toOne() + 1.0) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,doub,name\n'+ + ' 1,1.2,2.2\n'+ + ' 3,2.3,3.3\n'+ + ' 4,4.2,5.2\n'+ + ' 5,4.2,5.2\n'+ + ' 6,4.5,5.5\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::extend::testSimpleMultipleColumns(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->extend(~[name:c|$c.val->toOne() + 1, other:x|$x.str->toOne()+'_ext']) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str,name,other\n'+ + ' 1,a,2,a_ext\n'+ + ' 3,ewe,4,ewe_ext\n'+ + ' 4,qw,5,qw_ext\n'+ + ' 5,wwe,6,wwe_ext\n'+ + ' 6,weq,7,weq_ext\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/filter.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/filter.pure new file mode 100644 index 00000000000..e08a439da54 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/filter.pure @@ -0,0 +1,38 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::filter(rel:Relation[1], f:Function<{T[1]->Boolean[1]}>[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::filter::testSimpleFilterShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + val + 1 + 3 + 4 + #->filter(x|$x.val > 1) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val\n'+ + ' 3\n'+ + ' 4\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/groupBy.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/groupBy.pure new file mode 100644 index 00000000000..891a5198ba0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/groupBy.pure @@ -0,0 +1,149 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::groupBy(r:Relation[1], cols:ColSpecArray[1], agg:meta::pure::metamodel::relation::AggColSpec<{T[1]->K[0..1]},{K[*]->V[1]}, R>[1]):Relation[1]; + +native function <> meta::pure::functions::relation::groupBy(r:Relation[1], cols:ColSpec[1], agg:meta::pure::metamodel::relation::AggColSpec<{T[1]->K[0..1]},{K[*]->V[1]}, R>[1]):Relation[1]; + +native function <> meta::pure::functions::relation::groupBy(r:Relation[1], cols:ColSpecArray[1], agg:meta::pure::metamodel::relation::AggColSpecArray<{T[1]->K[0..1]},{K[*]->V[1]}, R>[1]):Relation[1]; + +native function <> meta::pure::functions::relation::groupBy(r:Relation[1], cols:ColSpec[1], agg:meta::pure::metamodel::relation::AggColSpecArray<{T[1]->K[0..1]},{K[*]->V[1]}, R>[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::groupBy::testSimpleGroupBySingleSingle(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, grp, name + 1, 2, A + 2, 1, B + 3, 3, C + 4, 4, D + 5, 2, E + 6, 1, F + 7, 3, G + 8, 1, H + 9, 5, I + 10, 0, J + #->groupBy(~grp, ~newCol : x | $x.name : y | $y->joinStrings('')) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' grp,newCol\n'+ + ' 0,J\n'+ + ' 1,BFH\n'+ + ' 2,AE\n'+ + ' 3,CG\n'+ + ' 4,D\n'+ + ' 5,I\n'+ + '#', $res->sort(~grp->ascending())->toString()); +} + + +function <> meta::pure::functions::relation::tests::groupBy::testSimpleGroupByMultipleSingle(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, grp, name + 1, 2, A + 2, 1, B + 3, 3, C + 4, 4, D + 5, 2, E + 6, 1, F + 7, 3, G + 8, 1, H + 9, 5, I + 10, 0, J + #->groupBy(~[grp], ~newCol : x | $x.name : y | $y->joinStrings('')) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' grp,newCol\n'+ + ' 0,J\n'+ + ' 1,BFH\n'+ + ' 2,AE\n'+ + ' 3,CG\n'+ + ' 4,D\n'+ + ' 5,I\n'+ + '#', $res->sort(~grp->ascending())->toString()); +} + +function <> meta::pure::functions::relation::tests::groupBy::testSimpleGroupBySingleMultiple(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, grp, name + 1, 2, A + 2, 1, B + 3, 3, C + 4, 4, D + 5, 2, E + 6, 1, F + 7, 3, G + 8, 1, H + 9, 5, I + 10, 0, J + #->groupBy(~grp, ~[newCol : x | $x.name : y | $y->joinStrings(''), YoCol : x | $x.id : y | $y->plus()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' grp,newCol,YoCol\n'+ + ' 0,J,10\n'+ + ' 1,BFH,16\n'+ + ' 2,AE,6\n'+ + ' 3,CG,10\n'+ + ' 4,D,4\n'+ + ' 5,I,9\n'+ + '#', $res->sort(~grp->ascending())->toString()); +} + +function <> meta::pure::functions::relation::tests::groupBy::testSimpleGroupByMultipleMultiple(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, grp, name + 1, 2, A + 2, 1, B + 3, 3, C + 4, 4, D + 5, 2, E + 6, 1, F + 7, 3, G + 8, 1, H + 9, 5, I + 10, 0, J + #->groupBy(~[grp], ~[newCol : x | $x.name : y | $y->joinStrings(''), YoCol : x | $x.id : y | $y->plus()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' grp,newCol,YoCol\n'+ + ' 0,J,10\n'+ + ' 1,BFH,16\n'+ + ' 2,AE,6\n'+ + ' 3,CG,10\n'+ + ' 4,D,4\n'+ + ' 5,I,9\n'+ + '#', $res->sort(~grp->ascending())->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/join.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/join.pure new file mode 100644 index 00000000000..7756cdc0c62 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/join.pure @@ -0,0 +1,64 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +Enum meta::pure::functions::relation::JoinKind +{ + LEFT, + INNER +} + +native function <> meta::pure::functions::relation::join(rel1:Relation[1], rel2:Relation[1], joinKind:JoinKind[1], f:Function<{T[1],V[1]->Boolean[1]}>[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::join::testSimpleJoinShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let tds = #TDS + id, name + 1, George + 2, Pierre + 3, Sachin + 4, David + #; + + let tds2 = #TDS + id2, col, other + 1, More George 1, 1 + 1, More George 2, 2 + 4, More David, 1 + #; + + let expr = {|$tds->join($tds2, JoinKind.INNER, {x,y| $x.id == $y.id2})}; + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' id,name,id2,col,other\n'+ + ' 1,George,1,More George 1,1\n'+ + ' 1,George,1,More George 2,2\n'+ + ' 4,David,4,More David,1\n'+ + '#', $res->sort([~id->ascending(),~col->ascending()])->toString()); + + let expr2 = {|$tds->join($tds2, JoinKind.LEFT, {x,y| $x.id == $y.id2})}; + let res2 = $f->eval($expr2); + + assertEquals( '#TDS\n'+ + ' id,name,id2,col,other\n'+ + ' 1,George,1,More George 1,1\n'+ + ' 1,George,1,More George 2,2\n'+ + ' 2,Pierre,null,null,null\n'+ + ' 3,Sachin,null,null,null\n'+ + ' 4,David,4,More David,1\n'+ + '#', $res2->sort([~id->ascending(),~col->ascending()])->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/limit.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/limit.pure new file mode 100644 index 00000000000..01c665e5813 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/limit.pure @@ -0,0 +1,41 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::limit(rel:Relation[1], size:Integer[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::limit::testSimpleLimitShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->limit(3) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str\n'+ + ' 1,a\n'+ + ' 3,ewe\n'+ + ' 4,qw\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/map.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/map.pure new file mode 100644 index 00000000000..3690f20d077 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/map.pure @@ -0,0 +1,29 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::map(rel:Relation[1], f:Function<{T[1]->V[*]}>[1]):V[*]; + +function <> meta::pure::functions::relation::tests::map::testSimpleMap():Boolean[1] +{ + let res = #TDS + val + 1 + 3 + 4 + #->map(x|$x.val->toOne() + 1); + assertEquals([2,4,5], $res); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/project.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/project.pure new file mode 100644 index 00000000000..5a2c7caca5d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/project.pure @@ -0,0 +1,154 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; +import meta::pure::functions::relation::tests::project::*; + +native function <> meta::pure::functions::relation::project(cl:C[*], x:FuncColSpecArray<{C[1]->Any[*]},T>[1]):Relation[1]; + +Class meta::pure::functions::relation::tests::project::Address +{ + val : String[1]; +} + +Class meta::pure::functions::relation::tests::project::TypeForProjectTest +{ + name : String[1]; + addresses : Address[*]; + values : PrimitiveContainer[*]; +} + +Class meta::pure::functions::relation::tests::project::PrimitiveContainer +{ + val : Integer[1]; +} + +function <> meta::pure::functions::relation::tests::project::testSimpleProject(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | ^TypeForProjectTest + ( + name = 'ok', + addresses = [ + ^Address(val='no'), + ^Address(val='other') + ], + values = [ + ^PrimitiveContainer(val=1), + ^PrimitiveContainer(val=2), + ^PrimitiveContainer(val=3) + ] + )->project(~[ + one:x|$x.name, + two:x|$x.addresses.val, + three:x|$x.values.val + ]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' one,two,three\n'+ + ' ok,no,1\n'+ + ' ok,no,2\n'+ + ' ok,no,3\n'+ + ' ok,other,1\n'+ + ' ok,other,2\n'+ + ' ok,other,3\n'+ + '#', $res->sort([~one->ascending(),~two->ascending(),~three->ascending()])->toString()); +} + + +function <> meta::pure::functions::relation::tests::project::testSimpleProjectList(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + + let expr = { + | [ + ^TypeForProjectTest + ( + name = 'ok', + addresses = [ + ^Address(val='no'), + ^Address(val='other') + ], + values = [ + ^PrimitiveContainer(val=1), + ^PrimitiveContainer(val=2), + ^PrimitiveContainer(val=3) + ] + ), + ^TypeForProjectTest + ( + name = 'ok3', + addresses = [ + ^Address(val='no') + ], + values = [ + ^PrimitiveContainer(val=1), + ^PrimitiveContainer(val=2), + ^PrimitiveContainer(val=3) + ] + ) + ]->project(~[ + one:x|$x.name, + two:x|$x.addresses.val, + three:x|$x.values.val + ]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' one,two,three\n'+ + ' ok,no,1\n'+ + ' ok,no,2\n'+ + ' ok,no,3\n'+ + ' ok,other,1\n'+ + ' ok,other,2\n'+ + ' ok,other,3\n'+ + ' ok3,no,1\n'+ + ' ok3,no,2\n'+ + ' ok3,no,3\n'+ + '#', $res->sort([~one->ascending(), ~two->ascending(), ~three->ascending()])->toString()); +} + +function <> meta::pure::functions::relation::tests::project::testSimpleProjectWithEmpty(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + + let expr = { + | + ^TypeForProjectTest + ( + name = 'ok', + addresses = [ + ^Address(val='no'), + ^Address(val='other') + ], + values = [] + )->project(~[ + one:x|$x.name, + two:x|$x.addresses.val, + three:x|$x.values.val + ]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' one,two,three\n'+ + ' ok,no,null\n'+ + ' ok,other,null\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/rename.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/rename.pure new file mode 100644 index 00000000000..3cd7c67b16e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/rename.pure @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::rename(r:Relation[1], old:ColSpec[1], new:ColSpec[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::rename::testSimpleRenameShared(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->rename(~str, ~newStr); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,newStr\n'+ + ' 1,a\n'+ + ' 3,ewe\n'+ + ' 4,qw\n'+ + ' 5,wwe\n'+ + ' 6,weq\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/s.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/s.pure new file mode 100644 index 00000000000..4cbf2471aa3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/s.pure @@ -0,0 +1,18 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function meta::pure::functions::relation::s(a:Any[0..1]):String[1] +{ + if ($a->isEmpty(),|'null',|$a->toOne()->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/select.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/select.pure new file mode 100644 index 00000000000..54bf3d7c378 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/select.pure @@ -0,0 +1,95 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::select(r:Relation[1], cols:ColSpecArray[1]):Relation[1]; + +native function <> meta::pure::functions::relation::select(r:Relation[1], cols:ColSpec[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::select::testMultiColsSelectShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str, other + 1, a, a + 3, ewe, b + 4, qw, c + 5, wwe, d + 6, weq, e + #->select(~[val, other]); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,other\n'+ + ' 1,a\n'+ + ' 3,b\n'+ + ' 4,c\n'+ + ' 5,d\n'+ + ' 6,e\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::select::testSingleColSelectShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str, other + 1, a, a + 3, ewe, b + 4, qw, c + 5, wwe, d + 6, weq, e + #->select(~str); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' str\n'+ + ' a\n'+ + ' ewe\n'+ + ' qw\n'+ + ' wwe\n'+ + ' weq\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::select::testSingleSelectWithQuotedColumn(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str, other kind + 1, a, a + 3, ewe, b + 4, qw, c + 5, wwe, d + 6, weq, e + #->select(~'other kind'); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' other kind\n'+ + ' a\n'+ + ' b\n'+ + ' c\n'+ + ' d\n'+ + ' e\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/size.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/size.pure new file mode 100644 index 00000000000..1ea5aba9659 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/size.pure @@ -0,0 +1,59 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::size(rel:Relation[1]):Integer[1]; + +function <> meta::pure::functions::relation::tests::size::testSimpleSize(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + #->size(); + }; + + let res = $f->eval($expr)->toOne(); + + assertEquals(3, $res); +} + + +function <> meta::pure::functions::relation::tests::size::testGroupBySize(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, grp, name + 1, 2, A + 2, 1, B + 3, 3, C + 4, 4, D + 5, 2, E + 6, 1, F + 7, 3, G + 8, 1, H + 9, 5, I + 10, 0, J + #->groupBy(~[grp], ~[newCol : x | $x.name : y | $y->joinStrings(''), YoCol : x | $x.id : y | $y->plus()]) + ->size() + }; + + let res = $f->eval($expr)->toOne(); + + assertEquals(6, $res); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/slice.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/slice.pure new file mode 100644 index 00000000000..11f01734e6a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/slice.pure @@ -0,0 +1,40 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +native function <> meta::pure::functions::relation::slice(rel:Relation[1], start:Integer[1], stop: Integer[1]):Relation[1]; + +function <> meta::pure::functions::relation::tests::slice::testSimpleSliceShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->slice(1,3); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str\n'+ + ' 3,ewe\n'+ + ' 4,qw\n'+ + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/sort.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/sort.pure new file mode 100644 index 00000000000..9c6e75f8296 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/sort.pure @@ -0,0 +1,112 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +Enum meta::pure::functions::relation::SortType +{ + ASC, DESC +} + +Class meta::pure::functions::relation::SortInfo +{ + column : ColSpec[1]; + direction : SortType[1]; +} + +function <> meta::pure::functions::relation::descending(column:ColSpec[1]):SortInfo[1] +{ + ^SortInfo(column=$column, direction=SortType.DESC) +} + +function <> meta::pure::functions::relation::ascending (column:ColSpec[1]):SortInfo[1] +{ + ^SortInfo(column=$column, direction=SortType.ASC) +} + +native function <> meta::pure::functions::relation::sort(rel:Relation[1], sortInfo:SortInfo[*]):Relation[1]; + + +function <> meta::pure::functions::relation::tests::sort::testSimpleSortShared(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + id, name + 2, George + 3, Pierre + 1, Sachin + 1, Neema + 5, David + 4, Alex + 2, Thierry + #->sort(ascending(~id)); + }; + + let res = $f->eval($expr); + + assertEquals([1,1,2,2,3,4,5], $res->map(x|$x.id)); + + let expr2 = { + | #TDS + id, name + 2, George + 3, Pierre + 1, Sachin + 1, Neema + 5, David + 4, Alex + 2, Thierry + #->sort([ascending(~id), ascending(~name)]); + }; + + let res2 = $f->eval($expr2); + + assertEquals( '#TDS\n'+ + ' id,name\n'+ + ' 1,Neema\n'+ + ' 1,Sachin\n'+ + ' 2,George\n'+ + ' 2,Thierry\n'+ + ' 3,Pierre\n'+ + ' 4,Alex\n'+ + ' 5,David\n'+ + '#', $res2->toString()); + + let expr3 = { + | #TDS + id, name + 2, George + 3, Pierre + 1, Sachin + 1, Neema + 5, David + 4, Alex + 2, Thierry + #->sort([descending(~id), ascending(~name)]); + }; + + let res3 = $f->eval($expr3); + + assertEquals( '#TDS\n'+ + ' id,name\n'+ + ' 5,David\n'+ + ' 4,Alex\n'+ + ' 3,Pierre\n'+ + ' 2,George\n'+ + ' 2,Thierry\n'+ + ' 1,Neema\n'+ + ' 1,Sachin\n'+ + '#', $res3->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/toString.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/toString.pure new file mode 100644 index 00000000000..1339090b42a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/functions/toString.pure @@ -0,0 +1,40 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; + +function meta::pure::functions::relation::toString(rel:Relation[1]):String[1] +{ + let cols = $rel->columns(); + '#TDS\n'+ + ' '+$cols->map(c|$c.name)->joinStrings(',')+'\n'+ + $rel->map(x|' '+$cols->map(c|s($c->eval($x)->first()))->joinStrings(','))->joinStrings('\n')+'\n'+ + '#'; +} + +function <> meta::pure::functions::relation::tests::toString::testToString():Boolean[1] +{ + assertEquals( '#TDS\n'+ + ' val,other,txt\n'+ + ' 1,2,aa\n'+ + ' 2,3,ee\n'+ + ' 3,2,eewe\n'+ + '#', #TDS + val, other, txt + 1, 2, aa + 2, 3, ee + 3, 2, eewe + #->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/tests/composition.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/tests/composition.pure new file mode 100644 index 00000000000..f76bd2c845b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/main/resources/core_functions_relation/relation/tests/composition.pure @@ -0,0 +1,92 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; +import meta::pure::metamodel::relation::*; +import meta::pure::functions::relation::*; +import meta::pure::functions::relation::tests::composition::*; + +Class meta::pure::functions::relation::tests::composition::FirmTypeForCompositionTests +{ + legalName : String[1]; + employees : PersonTypeForCompositionTests[*]; +} + +Class meta::pure::functions::relation::tests::composition::PersonTypeForCompositionTests +{ + firstName : String[1]; + lastName : String[1]; +} + +function <> meta::pure::functions::relation::tests::composition::testExtendFilter(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + | #TDS + val, str + 1, a + 3, ewe + 4, qw + 5, wwe + 6, weq + #->extend(~newCol:x|$x.str->toOne() + $x.val->toOne()->toString()) + ->filter(x|$x.newCol == 'qw4'); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' val,str,newCol\n'+ + ' 4,qw,qw4\n'+ + '#', $res->toString()); +} + +function <> meta::pure::functions::relation::tests::composition::testFilterPostProject(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = {| + [ + ^FirmTypeForCompositionTests + ( + legalName = 'Firm X', + employees = [ + ^PersonTypeForCompositionTests(firstName = 'Peter', lastName = 'Smith'), + ^PersonTypeForCompositionTests(firstName = 'John', lastName = 'Johnson'), + ^PersonTypeForCompositionTests(firstName = 'John', lastName = 'Hill'), + ^PersonTypeForCompositionTests(firstName = 'Anthony', lastName = 'Allen') + ] + ), + ^FirmTypeForCompositionTests + ( + legalName = 'Firm A', + employees = [ + ^PersonTypeForCompositionTests(firstName = 'Fabrice', lastName = 'Roberts') + ] + ) + ] + ->project(~[ + legalName : x | $x.legalName, + firstName : x | $x.employees.firstName + ]) + ->filter(x | $x.legalName == 'Firm X'); + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n' + + ' legalName,firstName\n' + + ' Firm X,Peter\n' + + ' Firm X,John\n' + + ' Firm X,John\n' + + ' Firm X,Anthony\n' + + '#', $res->toString()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/relation/TestFunctionsRelationCompiledStateStrategy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/relation/TestFunctionsRelationCompiledStateStrategy.java new file mode 100644 index 00000000000..d4dea3ea265 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/relation/TestFunctionsRelationCompiledStateStrategy.java @@ -0,0 +1,27 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.relation; + +import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; +import org.junit.BeforeClass; + +public class TestFunctionsRelationCompiledStateStrategy extends AbstractCompiledStateIntegrityTest +{ + @BeforeClass + public static void initialize() + { + initialize("core_functions_relation"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java new file mode 100644 index 00000000000..8d3586a8be0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java @@ -0,0 +1,31 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core.tests; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals(4, PCTReportProviderLoader.gatherFunctions().size()); + Assert.assertEquals("essential, grammar, relation, unclassified", PCTReportProviderLoader.gatherFunctions().collect(c -> c.reportScope.module).distinct().sortThis().makeString(", ")); + Assert.assertEquals(0, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals("", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter).distinct().sortThis().makeString(", ")); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/pom.xml new file mode 100644 index 00000000000..6aeaf8daf18 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/pom.xml @@ -0,0 +1,236 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-relation + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-compiled-functions-relation + jar + Legend Pure - Runtime - Java Extension - Compiled - Functions - Relation + + + + + maven-compiler-plugin + + + pre-compile + generate-sources + + compile + + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + true + modular + true + + core_functions_relation + + + + + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + Compiled + ${project.build.directory}/classes/pct-reports/ + + org.finos.legend.pure.runtime.java.extension.relation.compiled.pure.Test_Compiled_RelationFunctions_PCT + + + + + PCT-Generation + process-test-classes + + generate-pct-report + + + + + + org.finos.legend.engine + legend-engine-pure-platform-java + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-platform-dsl-tds-java + ${project.version} + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + dependency-analyze + test-compile + + analyze-only + + + + org.finos.legend.engine:legend-engine-pure-platform-dsl-tds-java + + + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-relation + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + + org.finos.legend.pure + legend-pure-m2-dsl-tds-pure + + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + runtime + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + runtime + + + + org.finos.legend.engine + legend-engine-pure-platform-dsl-tds-java + + + org.finos.legend.engine + legend-engine-pure-platform-java + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + io.deephaven + deephaven-csv + 0.12.0 + + + + junit + junit + test + + + org.finos.legend.pure + legend-pure-m2-dsl-tds-grammar + test + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + test-jar + test + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationExtensionCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationExtensionCompiled.java new file mode 100644 index 00000000000..2ae6a9b6663 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationExtensionCompiled.java @@ -0,0 +1,108 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled; + +import org.eclipse.collections.api.block.function.Function3; +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Column; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.Bridge; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.PureFunction1; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.valuespecification.ValueSpecificationProcessor; +import org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.*; +import org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared.RowContainer; + +import java.util.List; + +public class RelationExtensionCompiled implements CompiledExtension +{ + @Override + public List getExtraNatives() + { + return Lists.fixedSize.with( + new Map(), + new Limit(), + new Size(), + new Filter(), + new Columns(), + new Concatenate(), + new Join(), + new Extend(), + new ExtendArray(), + new Drop(), + new Sort(), + new Rename(), + new Project(), + new GroupBy(), + new GroupByArray(), + new Slice(), + new Distinct(), + new Select(), + new SelectArray() + ); + } + + @Override + public String getRelatedRepository() + { + return "core_functions_relation"; + } + + public static CompiledExtension extension() + { + return new RelationExtensionCompiled(); + } + + @Override + public Function3 getExtraFunctionGeneration() + { + return (CoreInstance function, CoreInstance functionExpression, ProcessorContext processorContext) -> + { + if (processorContext.getSupport().instance_instanceOf(function, M3Paths.Column)) + { + CoreInstance firstParam = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorContext.getSupport()).getFirst(); + String processedOwnerInstance = ValueSpecificationProcessor.processValueSpecification(null, firstParam, processorContext); + + ProcessorSupport processorSupport = processorContext.getSupport(); + CoreInstance nativeFunction = Instance.getValueForMetaPropertyToOneResolved(functionExpression, M3Properties.func, processorSupport); + CoreInstance functionType = processorSupport.function_getFunctionType(nativeFunction); + String returnType = TypeProcessor.typeToJavaObjectSingle(Instance.getValueForMetaPropertyToOneResolved(functionType, M3Properties.returnType, processorSupport), true, processorSupport); + + return "(" + returnType + ")((org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared.RowContainer)" + processedOwnerInstance + ").apply(\"" + Instance.getValueForMetaPropertyToOneResolved(function, M3Properties.name, processorContext.getSupport()).getName() + "\")"; + } + return null; + }; + } + + @Override + public PureFunction1 getExtraFunctionEvaluation(Function func, Bridge bridge, ExecutionSupport es) + { + if (func instanceof Column) + { + return (o, executionSupport) -> ((RowContainer) o).apply(func._name()); + } + return null; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationNativeImplementation.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationNativeImplementation.java new file mode 100644 index 00000000000..e2efb5ea2ee --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/RelationNativeImplementation.java @@ -0,0 +1,371 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled; + +import io.deephaven.csv.parsers.DataType; +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.function.Function2; +import org.eclipse.collections.api.block.function.Function3; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.set.MutableSet; +import org.eclipse.collections.api.set.primitive.MutableIntSet; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.*; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enum; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.CompiledSupport; +import org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared.RowContainer; +import org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared.TDSContainer; +import org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared.TestTDSCompiled; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortDirection; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortInfo; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; + +import static org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS.readCsv; + +public class RelationNativeImplementation +{ + public static TestTDSCompiled getTDS(Object value) + { + return value instanceof TDSContainer ? + ((TDSContainer) value).tds : + new TestTDSCompiled(readCsv((((CoreInstance) value).getValueForMetaPropertyToOne("csv")).getName()), ((CoreInstance) value).getValueForMetaPropertyToOne(M3Properties.classifierGenericType)); + } + + + public static RichIterable> columns(Relation t) + { + return ((RelationType) t._classifierGenericType()._typeArguments().getFirst()._rawType())._columns(); + } + + public static RichIterable map(Relation rel, Function2> pureFunction, ExecutionSupport es) + { + TestTDSCompiled tds = RelationNativeImplementation.getTDS(rel); + MutableList list = Lists.mutable.empty(); + for (int i = 0; i < tds.getRowCount(); i++) + { + list.add(pureFunction.value(new RowContainer(tds, i), es)); + } + return list; + } + + public static Relation distinct(Relation rel, ColSpecArray columns, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(rel).distinct((MutableList) columns._names().toList()), ps); + } + + public static Long size(Relation res) + { + return RelationNativeImplementation.getTDS(res).getRowCount(); + } + + public static Relation limit(Relation rel, long size, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(rel).slice(0, (int) size), ps); + } + + public static Relation slice(Relation rel, long start, long stop, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(rel).slice((int) start, (int) stop), ps); + } + + public static Relation drop(Relation relation, Long aLong, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + TestTDSCompiled tds = RelationNativeImplementation.getTDS(relation); + return new TDSContainer((TestTDSCompiled) tds.slice(aLong.intValue(), (int) tds.getRowCount()), ps); + } + + public static Relation rename(Relation r, ColSpec old, ColSpec aNew, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(r).rename(old._name(), aNew._name()), ps); + } + + public static Relation select(Relation r, ColSpec col, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(r).select(Sets.mutable.with(col._name())), ps); + } + + public static Relation select(Relation r, ColSpecArray cols, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(r).select(Sets.mutable.withAll(cols._names())), ps); + } + + public static Relation concatenate(Relation rel1, Relation rel2, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + return new TDSContainer((TestTDSCompiled) RelationNativeImplementation.getTDS(rel1).concatenate((TestTDSCompiled) RelationNativeImplementation.getTDS(rel2)), ps); + } + + public static Relation filter(Relation rel, Function2 pureFunction, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + TestTDSCompiled tds = RelationNativeImplementation.getTDS(rel); + MutableIntSet list = new IntHashSet(); + for (int i = 0; i < tds.getRowCount(); i++) + { + if (!(boolean) pureFunction.value(new RowContainer(tds, i), es)) + { + list.add(i); + } + } + return new TDSContainer((TestTDSCompiled) tds.drop(list), ps); + } + + public static class ColFuncSpecTrans + { + public String newColName; + public Function2 func; + public String columnType; + + public ColFuncSpecTrans(String newColName, Function2 func, String columnType) + { + this.newColName = newColName; + this.func = func; + this.columnType = columnType; + } + } + + public static Relation extend(Relation rel, MutableList colFuncSpecTrans, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + TestTDSCompiled tds = RelationNativeImplementation.getTDS(rel); + TestTDSCompiled t = colFuncSpecTrans.injectInto(tds, (a, b) -> performExtend(b, es, a, ps)); + return new TDSContainer(t, ps); + } + + private static TestTDSCompiled performExtend(ColFuncSpecTrans colFuncSpecTrans, ExecutionSupport es, TestTDSCompiled tds, ProcessorSupport ps) + { + switch (colFuncSpecTrans.columnType) + { + case "String": + MutableList res = Lists.mutable.empty(); + for (int i = 0; i < tds.getRowCount(); i++) + { + res.add((String) colFuncSpecTrans.func.value(new RowContainer(tds, i), es)); + } + return (TestTDSCompiled) tds.addColumn(colFuncSpecTrans.newColName, DataType.STRING, res.toArray(new String[0])); + case "Integer": + int[] resultInt = new int[(int) tds.getRowCount()]; + for (int i = 0; i < tds.getRowCount(); i++) + { + resultInt[i] = (int) (long) colFuncSpecTrans.func.value(new RowContainer(tds, i), es); + } + return (TestTDSCompiled) tds.addColumn(colFuncSpecTrans.newColName, DataType.INT, resultInt); + case "Double": + case "Float": + double[] resultDouble = new double[(int) tds.getRowCount()]; + for (int i = 0; i < tds.getRowCount(); i++) + { + resultDouble[i] = (double) colFuncSpecTrans.func.value(new RowContainer(tds, i), es); + } + return (TestTDSCompiled) tds.addColumn(colFuncSpecTrans.newColName, DataType.DOUBLE, resultDouble); + } + throw new RuntimeException(colFuncSpecTrans.columnType + " not supported yet"); + } + + public static Relation join(Relation rel1, Relation rel2, Enum joinKind, Function3 pureFunction, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + + TestTDSCompiled tds1 = RelationNativeImplementation.getTDS(rel1); + TestTDSCompiled tds2 = RelationNativeImplementation.getTDS(rel2); + TestTDSCompiled tds = (TestTDSCompiled) tds1.join(tds2); + + MutableIntSet list = new IntHashSet(); + for (int i = 0; i < tds.getRowCount(); i++) + { + if (!(boolean) pureFunction.value(new RowContainer(tds, i), new RowContainer(tds, i), es)) + { + list.add(i); + } + } + TestTDSCompiled filtered = (TestTDSCompiled) tds.drop(list); + if (joinKind.getName().equals("LEFT")) + { + filtered = (TestTDSCompiled) tds1.compensateLeft(filtered); + } + + return new TDSContainer(filtered, ps); + } + + public static Relation sort(Relation rel, RichIterable> collect, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + TestTDSCompiled tds1 = RelationNativeImplementation.getTDS(rel); + return new TDSContainer((TestTDSCompiled) tds1.sort(collect.collect(c -> new SortInfo(c.getTwo(), SortDirection.valueOf(c.getOne()._name()))).toList()).getOne(), ps); + } + + public static class AggColSpecTrans + { + public String newColName; + public Function2 map; + public Function2 reduce; + public String reduceType; + + public AggColSpecTrans(String newColName, Function2 map, Function2 reduce, String reduceType) + { + this.newColName = newColName; + this.map = map; + this.reduce = reduce; + this.reduceType = reduceType; + } + } + + public static Relation groupBy(Relation rel, ColSpec cols, MutableList aggColSpecTrans, ExecutionSupport es) + { + return groupBy(rel, Lists.mutable.with(cols._name()), aggColSpecTrans, es); + } + + public static Relation groupBy(Relation rel, ColSpecArray cols, MutableList aggColSpecTransAll, ExecutionSupport es) + { + return groupBy(rel, Lists.mutable.withAll(cols._names()), aggColSpecTransAll, es); + } + + private static Relation groupBy(Relation rel, MutableList cols, MutableList aggColSpecTransAll, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + TestTDSCompiled tds = RelationNativeImplementation.getTDS(rel); + + Pair>> sortRes = tds.sort(cols.collect(name -> new SortInfo(name, SortDirection.ASC)).toList()); + + int size = sortRes.getTwo().size(); + + MutableSet columnsToRemove = tds.getColumnNames().clone().toSet(); + columnsToRemove.removeAll(cols.toSet()); + + TestTDSCompiled finalTDS = (TestTDSCompiled) sortRes.getOne()._distinct(sortRes.getTwo()).removeColumns(columnsToRemove); + + for (AggColSpecTrans aggColSpecTrans : aggColSpecTransAll) + { + switch ((String) aggColSpecTrans.reduceType) + { + case "String": + String[] finalRes = new String[size]; + performMapReduce(aggColSpecTrans.map, aggColSpecTrans.reduce, es, size, sortRes, (o, j) -> finalRes[j] = (String) o); + finalTDS.addColumn(aggColSpecTrans.newColName, DataType.STRING, finalRes); + break; + case "Integer": + int[] finalResInt = new int[size]; + performMapReduce(aggColSpecTrans.map, aggColSpecTrans.reduce, es, size, sortRes, (o, j) -> finalResInt[j] = (int) (long) o); + finalTDS.addColumn(aggColSpecTrans.newColName, DataType.INT, finalResInt); + break; + case "Double": + case "Float": + case "Number": + double[] finalResDouble = new double[size]; + performMapReduce(aggColSpecTrans.map, aggColSpecTrans.reduce, es, size, sortRes, (o, j) -> finalResDouble[j] = (double) o); + finalTDS.addColumn(aggColSpecTrans.newColName, DataType.FLOAT, finalResDouble); + break; + default: + throw new RuntimeException(aggColSpecTrans.reduceType + " is not supported yet!"); + } + } + + return new TDSContainer(finalTDS, ps); + } + + private static void performMapReduce(Function2 map, Function2 reduce, ExecutionSupport es, int size, Pair>> sortRes, Function2 val) + { + for (int j = 0; j < size; j++) + { + Pair r = sortRes.getTwo().get(j); + MutableList subList = org.eclipse.collections.impl.factory.Lists.mutable.empty(); + for (int i = r.getOne(); i < r.getTwo(); i++) + { + subList.add(map.value(new RowContainer((TestTDSCompiled) sortRes.getOne(), i), es)); + } + val.apply(reduce.value(subList, es), j); + } + } + + public static Relation project(RichIterable objects, RichIterable colFuncs, ExecutionSupport es) + { + ProcessorSupport ps = ((CompiledExecutionSupport) es).getProcessorSupport(); + + MutableList typesL = colFuncs.collect(c -> c.columnType).toList(); + MutableList namesL = colFuncs.collect(c -> c.newColName).toList(); + ListIterable pre = objects.collect(o -> + { + int i = 0; + MutableList subList = Lists.mutable.empty(); + for (Function2 f : colFuncs.collect(c -> c.func)) + { + TestTDSCompiled one = new TestTDSCompiled(); + RichIterable li = CompiledSupport.toPureCollection(f.apply(o, es)); + switch ((String) typesL.get(i)) + { + case "String": + one.addColumn(namesL.get(i), DataType.STRING, li.toArray(new String[0])); + break; + case "Integer": + one.addColumn(namesL.get(i), DataType.INT, toInt(li)); + break; + case "Double": + case "Float": + case "Number": + one.addColumn(namesL.get(i), DataType.DOUBLE, toDouble(li)); + break; + default: + throw new RuntimeException(typesL.get(i) + " is not supported yet!"); + } + if (li.isEmpty()) + { + one = (TestTDSCompiled) one.setNull(); + } + subList.add(one); + i++; + } + return subList.drop(1).injectInto(subList.get(0), (a, b) -> (TestTDSCompiled) a.join(b)); + }).toList(); + return new TDSContainer(pre.drop(1).injectInto(pre.get(0), (a, b) -> (TestTDSCompiled) a.concatenate(b)), ps); + } + + public static Object toInt(RichIterable li) + { + int[] result = new int[li.size()]; + int i = 0; + for (Object o : li) + { + result[i++] = (int) (long) o; + } + return result; + } + + public static Object toDouble(RichIterable li) + { + double[] result = new double[li.size()]; + int i = 0; + for (Object o : li) + { + result[i++] = (double) o; + } + return result; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/Relation_Compiled_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/Relation_Compiled_PCTReportProvider.java new file mode 100644 index 00000000000..2da2a06c0ae --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/Relation_Compiled_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Relation_Compiled_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return Lists.mutable.empty(); + } + + @Override + public MutableList getAdapterReports() + { + return PCTReportProviderTool.load(Relation_Compiled_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_relation_compiled_Native.json" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Columns.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Columns.java new file mode 100644 index 00000000000..0d2798e9fd7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Columns.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Columns extends AbstractNativeFunctionGeneric +{ + public Columns() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.columns", new Class[]{Relation.class}, "columns_Relation_1__Column_MANY_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Concatenate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Concatenate.java new file mode 100644 index 00000000000..a2992378fdf --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Concatenate.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Concatenate extends AbstractNativeFunctionGeneric +{ + public Concatenate() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.concatenate", new Class[]{Relation.class, Relation.class, ExecutionSupport.class}, false, true, false, "concatenate_Relation_1__Relation_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Distinct.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Distinct.java new file mode 100644 index 00000000000..0739d648360 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Distinct.java @@ -0,0 +1,28 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpecArray; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Distinct extends AbstractNativeFunctionGeneric +{ + public Distinct() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.distinct", new Class[]{Relation.class, ColSpecArray.class, ExecutionSupport.class}, false, true, false, "distinct_Relation_1__ColSpecArray_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Drop.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Drop.java new file mode 100644 index 00000000000..e15fceed70a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Drop.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Drop extends AbstractNativeFunctionGeneric +{ + public Drop() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.drop", new Class[]{Relation.class, Long.class, ExecutionSupport.class}, false, true, false, "drop_Relation_1__Integer_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Extend.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Extend.java new file mode 100644 index 00000000000..065826a205e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Extend.java @@ -0,0 +1,67 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.block.function.Function; +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class Extend extends AbstractNative implements Native +{ + public Extend() + { + super("extend_Relation_1__FuncColSpec_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = buildCode(transformedParams, s -> "Lists.mutable.with(" + transformedParams.get(1) + ")"); + return result.toString(); + } + + static StringBuilder buildCode(ListIterable transformedParams, Function collection) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.extend("); + result.append(transformedParams.get(0) + ", "); + result.append(collection.valueOf(transformedParams.get(1))); + buildCollectFuncSpec(result); + result.append(", es)"); + return result; + } + + static void buildCollectFuncSpec(StringBuilder result) + { + result.append(".collect("); + result.append("new DefendedFunction, org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.ColFuncSpecTrans>()\n" + + "{\n" + + " @Override\n" + + " public org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.ColFuncSpecTrans valueOf(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.FuncColSpec c)\n" + + " {\n"); + + result.append("return new org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.ColFuncSpecTrans("); + result.append("c._name(),"); + result.append("(Function2)PureCompiledLambda.getPureFunction(c._function(),es),"); + result.append(" ((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType)c._function()._classifierGenericType()._typeArguments().toList().get(0)._rawType())._returnType()._rawType()._name()\n"); + result.append(");\n"); + + result.append(" }\n" + + " }" + + ")"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/ExtendArray.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/ExtendArray.java new file mode 100644 index 00000000000..d8e56c0907d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/ExtendArray.java @@ -0,0 +1,38 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +import static org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.Extend.buildCode; + +public class ExtendArray extends AbstractNative implements Native +{ + public ExtendArray() + { + super("extend_Relation_1__FuncColSpecArray_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = buildCode(transformedParams, s -> "Lists.mutable.withAll(" + transformedParams.get(1) + "._funcSpecs())"); + return result.toString(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Filter.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Filter.java new file mode 100644 index 00000000000..e7e82257173 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Filter.java @@ -0,0 +1,42 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class Filter extends AbstractNative implements Native +{ + public Filter() + { + super("filter_Relation_1__Function_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.filter"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", (org.eclipse.collections.api.block.function.Function2"); + result.append(")(PureCompiledLambda.getPureFunction("); + result.append(transformedParams.get(1)); + result.append(", es)), es)\n"); + return result.toString(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupBy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupBy.java new file mode 100644 index 00000000000..ba969ce0de6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupBy.java @@ -0,0 +1,62 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class GroupBy extends AbstractNative implements Native +{ + public GroupBy() + { + super("groupBy_Relation_1__ColSpec_1__AggColSpec_1__Relation_1_", "groupBy_Relation_1__ColSpecArray_1__AggColSpec_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.groupBy"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", "); + result.append(transformedParams.get(1)); + result.append(", "); + result.append("Lists.mutable.with(" + transformedParams.get(2) + ")"); + + processAggColSpec(transformedParams, result); + + result.append(", es)"); + return result.toString(); + } + + static void processAggColSpec(ListIterable transformedParams, StringBuilder result) + { + result.append(".collect("); + result.append("new DefendedFunction, org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.AggColSpecTrans>()\n" + + "{\n" + + " @Override\n" + + " public org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.AggColSpecTrans valueOf(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.AggColSpec c)\n" + + " {\n"); + result.append("return new org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.AggColSpecTrans(c._name(),"); + result.append("(Function2)PureCompiledLambda.getPureFunction(c._map(),es),"); + result.append("(Function2)PureCompiledLambda.getPureFunction(c._reduce(),es),"); + result.append("((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType)c._reduce()._classifierGenericType()._typeArguments().toList().get(0)._rawType())._returnType()._rawType()._name());"); + result.append(" }\n" + + "})"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupByArray.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupByArray.java new file mode 100644 index 00000000000..6165b379771 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/GroupByArray.java @@ -0,0 +1,46 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; +import static org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.GroupBy.processAggColSpec; + +public class GroupByArray extends AbstractNative implements Native +{ + public GroupByArray() + { + super("groupBy_Relation_1__ColSpec_1__AggColSpecArray_1__Relation_1_", "groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.groupBy"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", "); + result.append(transformedParams.get(1)); + result.append(", "); + result.append("Lists.mutable.withAll(" + transformedParams.get(2) + "._aggSpecs())"); + processAggColSpec(transformedParams, result); + result.append(", es)"); + return result.toString(); + } + +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Join.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Join.java new file mode 100644 index 00000000000..03355213a6d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Join.java @@ -0,0 +1,46 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class Join extends AbstractNative implements Native +{ + public Join() + { + super("join_Relation_1__Relation_1__JoinKind_1__Function_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.join"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", "); + result.append(transformedParams.get(1)); + result.append(", "); + result.append(transformedParams.get(2)); + result.append(", "); + result.append("(org.eclipse.collections.api.block.function.Function3)PureCompiledLambda.getPureFunction("); + result.append(transformedParams.get(3)); + result.append(",es), es)\n"); + return result.toString(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Limit.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Limit.java new file mode 100644 index 00000000000..8fe9b107655 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Limit.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Limit extends AbstractNativeFunctionGeneric +{ + public Limit() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.limit", new Class[]{Relation.class, Long.class, ExecutionSupport.class}, false, true, false, "limit_Relation_1__Integer_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Map.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Map.java new file mode 100644 index 00000000000..0a53dcde35b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Map.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class Map extends AbstractNative implements Native +{ + public Map() + { + super("map_Relation_1__Function_1__V_MANY_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.map"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", (org.eclipse.collections.api.block.function.Function2"); + result.append(")(PureCompiledLambda.getPureFunction("); + result.append(transformedParams.get(1)); + result.append(", es)), es)\n"); + return result.toString(); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Project.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Project.java new file mode 100644 index 00000000000..cca52593a64 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Project.java @@ -0,0 +1,65 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +import static org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.Extend.buildCollectFuncSpec; + +public class Project extends AbstractNative implements Native +{ + public Project() + { + super("project_C_MANY__FuncColSpecArray_1__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.project("); + result.append("CompiledSupport.toPureCollection("); + result.append(transformedParams.get(0)); + result.append("), "); + result.append("Lists.mutable.withAll(" + transformedParams.get(1) + "._funcSpecs())"); + + buildCollectFuncSpec(result); + +// result.append("._names(), "); +// result.append(transformedParams.get(1)); +// result.append("._functions().collect(new DefendedFunction()\n" + +// "{\n" + +// " @Override\n" + +// " public Object valueOf(Object ff)\n" + +// " {\n" + +// " return PureCompiledLambda.getPureFunction((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function)ff, es);\n" + +// " }\n" + +// "}),"); +// result.append(transformedParams.get(1)); +// result.append("._functions().collect(new DefendedFunction()\n" + +// "{\n" + +// " @Override\n" + +// " public Object valueOf(Object ff)\n" + +// " {\n" + +// " return ((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType)((org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function)ff)._classifierGenericType()._typeArguments().toList().get(0)._rawType())._returnType()._rawType()._name();\n" + +// " }\n" + +// result.append("}), es)\n"); + result.append(",es)"); + return result.toString(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Rename.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Rename.java new file mode 100644 index 00000000000..9531e3f879c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Rename.java @@ -0,0 +1,28 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpec; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Rename extends AbstractNativeFunctionGeneric +{ + public Rename() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.rename", new Class[]{Relation.class, ColSpec.class, ColSpec.class, ExecutionSupport.class}, false, true, false, "rename_Relation_1__ColSpec_1__ColSpec_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Select.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Select.java new file mode 100644 index 00000000000..c948b6ce716 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Select.java @@ -0,0 +1,28 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpec; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Select extends AbstractNativeFunctionGeneric +{ + public Select() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.select", new Class[]{Relation.class, ColSpec.class, ExecutionSupport.class}, false, true, false, "select_Relation_1__ColSpec_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/SelectArray.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/SelectArray.java new file mode 100644 index 00000000000..da0724b6d74 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/SelectArray.java @@ -0,0 +1,28 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpecArray; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class SelectArray extends AbstractNativeFunctionGeneric +{ + public SelectArray() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.select", new Class[]{Relation.class, ColSpecArray.class, ExecutionSupport.class}, false, true, false, "select_Relation_1__ColSpecArray_1__Relation_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Size.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Size.java new file mode 100644 index 00000000000..7b68a0a70f8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Size.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Size extends AbstractNativeFunctionGeneric +{ + public Size() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.size", new Class[]{Relation.class}, "size_Relation_1__Integer_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Slice.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Slice.java new file mode 100644 index 00000000000..fdec8af3daa --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Slice.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.Relation; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Slice extends AbstractNativeFunctionGeneric +{ + public Slice() + { + super("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.slice", new Class[]{Relation.class, Long.class, Long.class, ExecutionSupport.class}, false, true, false, "slice_Relation_1__Integer_1__Integer_1__Relation_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Sort.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Sort.java new file mode 100644 index 00000000000..1e81721b347 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/Sort.java @@ -0,0 +1,48 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; + +public class Sort extends AbstractNative implements Native +{ + public Sort() + { + super("sort_Relation_1__SortInfo_MANY__Relation_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + StringBuilder result = new StringBuilder("org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationNativeImplementation.sort"); + result.append('('); + result.append(transformedParams.get(0)); + result.append(", "); + result.append("CompiledSupport.toPureCollection(" + transformedParams.get(1) + ")"); + result.append(".collect(new DefendedFunction, org.eclipse.collections.api.tuple.Pair>()\n" + + "{\n" + + " @Override\n" + + " public org.eclipse.collections.api.tuple.Pair valueOf(Root_meta_pure_functions_relation_SortInfo it)\n" + + " {\n" + + " return org.eclipse.collections.impl.tuple.Tuples.pair(it._direction(), it._column()._name());\n" + + " }\n" + + "}) , es)\n"); + return result.toString(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/RowContainer.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/RowContainer.java new file mode 100644 index 00000000000..9268f2ad0eb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/RowContainer.java @@ -0,0 +1,35 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared; + +import java.util.function.Function; + +public class RowContainer implements Function +{ + private int row; + private TestTDSCompiled tds; + + public RowContainer(TestTDSCompiled tds, int row) + { + this.tds = tds; + this.row = row; + } + + @Override + public Object apply(String s) + { + return tds.getValueAsCoreInstance(s, row); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TDSContainer.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TDSContainer.java new file mode 100644 index 00000000000..6de931b7bf5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TDSContainer.java @@ -0,0 +1,34 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared; + +import org.finos.legend.pure.generated.Root_meta_pure_metamodel_relation_Relation_Impl; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; + +public class TDSContainer extends Root_meta_pure_metamodel_relation_Relation_Impl +{ + public TestTDSCompiled tds; + + public TDSContainer(TestTDSCompiled tds, ProcessorSupport ps) + { + super("TDS Container"); + this.tds = tds.updateColumns(ps); + if (tds.getClassifierGenericType() == null) + { + throw new RuntimeException(""); + } + this._classifierGenericType(tds.getClassifierGenericType()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TestTDSCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TestTDSCompiled.java new file mode 100644 index 00000000000..8f045c00cab --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/compiled/natives/shared/TestTDSCompiled.java @@ -0,0 +1,162 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.compiled.natives.shared; + +import io.deephaven.csv.parsers.DataType; +import io.deephaven.csv.reading.CsvReader; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m2.inlinedsl.tds.M2TDSPaths; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.navigation.relation._Column; +import org.finos.legend.pure.m3.navigation.relation._RelationType; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; + + +public class TestTDSCompiled extends TestTDS +{ + private CoreInstance classifierGenericType; + + public TestTDSCompiled() + { + super(); + } + + public TestTDSCompiled(CsvReader.Result result) + { + super(result); + } + + public TestTDSCompiled(MutableList columnOrdered, MutableMap columnType, int rows) + { + super(columnOrdered, columnType, rows); + } + + public TestTDSCompiled(CsvReader.Result result, CoreInstance classifierGenericType) + { + super(result); + this.classifierGenericType = classifierGenericType; + } + + @Override + public TestTDS newTDS() + { + return new TestTDSCompiled(); + } + + @Override + public TestTDS newTDS(MutableList columnOrdered, MutableMap columnType, int rows) + { + return new TestTDSCompiled(columnOrdered, columnType, rows); + } + + public Object getValueAsCoreInstance(String columnName, int rowNum) + { + Object dataAsObject = dataByColumnName.get(columnName); + boolean[] isNull = (boolean[]) isNullByColumn.get(columnName); + Object result; + switch (columnType.get(columnName)) + { + case INT: + { + int[] data = (int[]) dataAsObject; + int value = data[rowNum]; + result = !isNull[rowNum] ? (long) value : null; + break; + } + case CHAR: + { + char[] data = (char[]) dataAsObject; + result = !isNull[rowNum] ? "" + data[rowNum] : null; + break; + } + case STRING: + { + String[] data = (String[]) dataAsObject; + result = data[rowNum]; + break; + } + case FLOAT: + case DOUBLE: + { + double[] data = (double[]) dataAsObject; + result = !isNull[rowNum] ? Double.valueOf(data[rowNum]) : null; + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported in getValue"); + } + return result; + } + + public GenericType getClassifierGenericType() + { + return (GenericType) classifierGenericType; + } + + @Override + public TestTDS copy() + { + TestTDSCompiled res = (TestTDSCompiled) super.copy(); + res.classifierGenericType = this.classifierGenericType; + return res; + } + + @Override + public TestTDS concatenate(TestTDS tds2) + { + TestTDSCompiled res = (TestTDSCompiled) super.concatenate(tds2); + res.classifierGenericType = this.classifierGenericType; + return res; + } + + public void updateClassifierGenericType(CoreInstance coreInstance) + { + this.classifierGenericType = coreInstance; + } + + public TestTDSCompiled updateColumns(ProcessorSupport processorSupport) + { + Class relationDatabaseAccessorType = (Class) processorSupport.package_getByUserPath(M2TDSPaths.TDS); + GenericType genericType = (GenericType) processorSupport.type_wrapGenericType(relationDatabaseAccessorType); + GenericType typeParam = (GenericType) processorSupport.newGenericType(null, relationDatabaseAccessorType, false); + MutableList columns = columnsOrdered.collect(c -> (CoreInstance) _Column.getColumnInstance(c,false, (GenericType) processorSupport.type_wrapGenericType(_Package.getByUserPath(convert(columnType.get(c)), processorSupport)), null, processorSupport)).toList(); + typeParam._rawType(_RelationType.build(columns, null, processorSupport)); + genericType._typeArguments(Lists.mutable.with(typeParam)); + this.classifierGenericType = genericType; + return this; + } + + public String convert(DataType dataType) + { + switch (dataType) + { + case INT: + return "Integer"; + case STRING: + case CHAR: + return "String"; + case FLOAT: + case DOUBLE: + return "Float"; + } + throw new RuntimeException("To Handle " + dataType); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..e58dde21f64 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.relation.compiled.Relation_Compiled_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension new file mode 100644 index 00000000000..8b69be2a525 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.relation.compiled.RelationExtensionCompiled \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestFunctionTester.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestFunctionTester.java new file mode 100644 index 00000000000..2ee583d38fc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestFunctionTester.java @@ -0,0 +1,166 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestFunctionTester extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { +// return new FunctionExecutionInterpreted(); + return new FunctionExecutionCompiledBuilder().build(); + } + + @org.junit.Test + public void testFunction() + { + compileTestSource("fromString.pure", + "function test():Any[*]\n" + + "{" + + "print(#TDS\n" + + " value, str\n" + + " 1, a\n" + + " 3, ewe\n" + + " 4, qw\n" + + " #\n" + + " ->filter\n" + + " (\n" + + " x|$x.value == 1" + + " )->toString(),1);\n" + + "}"); + this.execute("test():Any[*]"); + runtime.delete("fromString.pure"); + +// //-------------------------------------------------------------------- +// +// compileTestSource("fromString.pure", +// "function test():Any[*]\n" + +// "{ " + +// " let tds = #TDS\n" + +// " id, name\n" + +// " 1, George\n" + +// " 2, Pierre\n" + +// " 3, Sachin\n" + +// " 4, David\n" + +// " #;\n" + +// "\n" + +// " print(" + +// " $tds->limit(2)->size()" + +// " ,2);" + +// "}\n"); +// this.execute("test():Any[*]"); +// runtime.delete("fromString.pure"); +// +// //-------------------------------------------------------------------- +// +// compileTestSource("fromString.pure", +// "function test():Any[*]\n" + +// "{ " + +// " let tds = #TDS\n" + +// " id, name\n" + +// " 1, George\n" + +// " 2, Pierre\n" + +// " 3, Sachin\n" + +// " 4, David\n" + +// " #;\n" + +// "\n" + +// " print(" + +// " $tds->drop(3)->size()" + +// " ,2);" + +// "}\n"); +// this.execute("test():Any[*]"); +// runtime.delete("fromString.pure"); +// +// //-------------------------------------------------------------------- +// +// compileTestSource("fromString.pure", +// "function test():Any[*]\n" + +// "{ " + +// " let tds = #TDS\n" + +// " id, name\n" + +// " 1, George\n" + +// " 2, Pierre\n" + +// " 3, Sachin\n" + +// " 4, David\n" + +// " #;\n" + +// "\n" + +// " print(" + +// " $tds->rename(~id,~newId)" + +// " ,2);" + +// "}\n"); +// this.execute("test():Any[*]"); +// runtime.delete("fromString.pure"); +// +// //-------------------------------------------------------------------- +// +// compileTestSource("fromString.pure", +// "function test():Any[*]\n" + +// "{ " + +// " let tds = #TDS\n" + +// " id, name\n" + +// " 1, George\n" + +// " 2, Pierre\n" + +// " 3, Sachin\n" + +// " 4, David\n" + +// " #;\n" + +// "\n" + +// " print(" + +// " $tds->concatenate($tds)->size()" + +// " ,2);" + +// "}\n"); +// this.execute("test():Any[*]"); +// runtime.delete("fromString.pure"); +// +// +// //-------------------------------------------------------------------- +// +// compileTestSource("fromString.pure", +// "function test():Any[*]\n" + +// "{ " + +// " let tds = #TDS\n" + +// " id, name\n" + +// " 1, George\n" + +// " 2, Pierre\n" + +// " 3, Sachin\n" + +// " 4, David\n" + +// " #;\n" + +// "\n" + +// " print(" + +// " $tds->filter(x | $x.id > 2)->size()" + +// " ,2);" + +// "}\n"); +// this.execute("test():Any[*]"); +// runtime.delete("fromString.pure"); +// +// //-------------------------------------------------------------------- + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestPCRReport.java new file mode 100644 index 00000000000..2ecf9c2e92c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestPCRReport.java @@ -0,0 +1,29 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.compiled.pure; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals("Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); + Assert.assertEquals(4, PCTReportProviderLoader.gatherReports().size()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestRelationFunctions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestRelationFunctions.java new file mode 100644 index 00000000000..a52588c9fc8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/TestRelationFunctions.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.compiled.pure; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class TestRelationFunctions +{ + public static Test suite() + { + return PureTestBuilderCompiled.buildSuite("meta::pure::functions::relation"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/Test_Compiled_RelationFunctions_PCT.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/Test_Compiled_RelationFunctions_PCT.java new file mode 100644 index 00000000000..409292da61a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-compiled-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/compiled/pure/Test_Compiled_RelationFunctions_PCT.java @@ -0,0 +1,63 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.compiled.pure; + +import junit.framework.Test; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.code.core.RelationCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class Test_Compiled_RelationFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = RelationCodeRepositoryProvider.relationFunctions; + private static final Adapter adapter = PlatformCodeRepositoryProvider.nativeAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.empty(); + + public static Test suite() + { + return PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/pom.xml new file mode 100644 index 00000000000..f38e590c163 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/pom.xml @@ -0,0 +1,131 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-relation + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-interpreted-functions-relation + jar + Legend Pure - Runtime - Java Extension - Interpreted - Functions - Relation + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + Interpreted + ${project.build.directory}/classes/pct-reports/ + + org.finos.legend.pure.runtime.java.extension.relation.interpreted.pure.Test_Interpreted_RelationFunctions_PCT + + + + + PCT-Generation + process-test-classes + + generate-pct-report + + + + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + + + + + + + + + + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-relation + + + org.finos.legend.pure + legend-pure-runtime-java-engine-interpreted + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + io.deephaven + deephaven-csv + 0.12.0 + + + + junit + junit + test + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + test + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/RelationExtensionInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/RelationExtensionInterpreted.java new file mode 100644 index 00000000000..f200da39732 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/RelationExtensionInterpreted.java @@ -0,0 +1,94 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Columns; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Concatenate; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Distinct; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Drop; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Extend; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Filter; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.GroupBy; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Join; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Limit; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Map; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Project; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Rename; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Select; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Size; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Slice; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.Sort; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.extension.BaseInterpretedExtension; +import org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class RelationExtensionInterpreted extends BaseInterpretedExtension +{ + public RelationExtensionInterpreted() + { + super(Tuples.pair("concatenate_Relation_1__Relation_1__Relation_1_", Concatenate::new), + Tuples.pair("drop_Relation_1__Integer_1__Relation_1_", Drop::new), + Tuples.pair("extend_Relation_1__FuncColSpec_1__Relation_1_", Extend::new), + Tuples.pair("extend_Relation_1__FuncColSpecArray_1__Relation_1_", Extend::new), + Tuples.pair("filter_Relation_1__Function_1__Relation_1_", Filter::new), + Tuples.pair("map_Relation_1__Function_1__V_MANY_", Map::new), + Tuples.pair("size_Relation_1__Integer_1_", Size::new), + Tuples.pair("limit_Relation_1__Integer_1__Relation_1_", Limit::new), + Tuples.pair("rename_Relation_1__ColSpec_1__ColSpec_1__Relation_1_", Rename::new), + Tuples.pair("slice_Relation_1__Integer_1__Integer_1__Relation_1_", Slice::new), + Tuples.pair("sort_Relation_1__SortInfo_MANY__Relation_1_", Sort::new), + Tuples.pair("join_Relation_1__Relation_1__JoinKind_1__Function_1__Relation_1_", Join::new), + Tuples.pair("distinct_Relation_1__ColSpecArray_1__Relation_1_", Distinct::new), + Tuples.pair("groupBy_Relation_1__ColSpecArray_1__AggColSpec_1__Relation_1_", GroupBy::new), + Tuples.pair("groupBy_Relation_1__ColSpec_1__AggColSpec_1__Relation_1_", GroupBy::new), + Tuples.pair("groupBy_Relation_1__ColSpec_1__AggColSpecArray_1__Relation_1_", GroupBy::new), + Tuples.pair("groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_", GroupBy::new), + Tuples.pair("project_C_MANY__FuncColSpecArray_1__Relation_1_", Project::new), + Tuples.pair("columns_Relation_1__Column_MANY_", Columns::new), + Tuples.pair("select_Relation_1__ColSpec_1__Relation_1_", Select::new), + Tuples.pair("select_Relation_1__ColSpecArray_1__Relation_1_", Select::new) + ); + } + + public static InterpretedExtension extension() + { + return new RelationExtensionInterpreted(); + } + + @Override + public CoreInstance getExtraFunctionExecution(Function function, ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport, FunctionExecutionInterpreted interpreted) + { + if (Instance.instanceOf(function, M3Paths.Column, processorSupport)) + { + return ((TDSWithCursorCoreInstance) params.get(0).getValueForMetaPropertyToOne("values")).getValue(function._name()); + } + return null; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/Relation_Interpreted_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/Relation_Interpreted_PCTReportProvider.java new file mode 100644 index 00000000000..77035ce6ea4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/Relation_Interpreted_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Relation_Interpreted_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return Lists.mutable.empty(); + } + + @Override + public MutableList getAdapterReports() + { + return PCTReportProviderTool.load(Relation_Interpreted_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_relation_interpreted_Native.json" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Columns.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Columns.java new file mode 100644 index 00000000000..0de27304540 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Columns.java @@ -0,0 +1,48 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Columns extends Shared +{ + public Columns(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + RelationType relationType = (RelationType) params.get(0).getValueForMetaPropertyToOne("genericType").getValueForMetaPropertyToMany("typeArguments").getFirst().getValueForMetaPropertyToOne("rawType"); + return ValueSpecificationBootstrap.wrapValueSpecification(relationType._columns(), false, processorSupport); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Concatenate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Concatenate.java new file mode 100644 index 00000000000..2e8756cbf06 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Concatenate.java @@ -0,0 +1,63 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.relation._RelationType; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Concatenate extends Shared +{ + public Concatenate(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds1 = getTDS(params, 0, processorSupport); + TestTDS tds2 = getTDS(params, 1, processorSupport); + + GenericType genericType1 = (GenericType) params.get(0).getValueForMetaPropertyToOne("genericType").getValueForMetaPropertyToMany("typeArguments").getFirst(); + GenericType genericType2 = (GenericType) params.get(1).getValueForMetaPropertyToOne("genericType").getValueForMetaPropertyToMany("typeArguments").getFirst(); + + if (!_RelationType.canConcatenate(genericType1, genericType2, processorSupport)) + { + throw new PureExecutionException("Can't concatenate the two Relations as their types are incompatible : " + _RelationType.print(genericType1, processorSupport) + " & " + _RelationType.print(genericType2, processorSupport)); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds1.concatenate(tds2), returnGenericType, repository, processorSupport), false, processorSupport); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Distinct.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Distinct.java new file mode 100644 index 00000000000..a79c00f20f9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Distinct.java @@ -0,0 +1,54 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Distinct extends Shared +{ + public Distinct(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + MutableList columns = Instance.getValueForMetaPropertyToManyResolved(params.get(1), M3Properties.values, processorSupport).flatCollect(c -> c.getValueForMetaPropertyToMany("names")).collect(CoreInstance::getName).toList(); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.distinct(columns), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Drop.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Drop.java new file mode 100644 index 00000000000..ef783ceadec --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Drop.java @@ -0,0 +1,50 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Drop extends Shared +{ + public Drop(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + Number value = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.slice(value.intValue(), (int)tds.getRowCount()), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Extend.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Extend.java new file mode 100644 index 00000000000..925e7a91378 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Extend.java @@ -0,0 +1,138 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import io.deephaven.csv.parsers.DataType; +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.FuncColSpec; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.FuncColSpecArray; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Extend extends Shared +{ + public Extend(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds = getTDS(params, 0, processorSupport); + + RelationType relationType = getRelationType(params, 0); + + CoreInstance extendFunction = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + + TestTDS result; + if (extendFunction instanceof FuncColSpec) + { + result = processFuncColSpec(tds, + (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(extendFunction.getValueForMetaPropertyToOne(M3Properties.function)), + extendFunction.getValueForMetaPropertyToOne(M3Properties.name).getName(), + resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType + ); + } + else if (extendFunction instanceof FuncColSpecArray) + { + result = ((FuncColSpecArray) extendFunction)._funcSpecs().injectInto(tds, (a, b) -> + processFuncColSpec(a, + (LambdaFunction) b._function(), + b._name(), + resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType + )); + } + else + { + throw new RuntimeException("Not possible"); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(result, returnGenericType, repository, processorSupport), false, processorSupport); + } + + private TestTDS processFuncColSpec(TestTDS tds, LambdaFunction lambdaFunction, String name, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport, RelationType relationType) + { + VariableContext evalVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, lambdaFunction); + + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null); + Type type = ((FunctionType) lambdaFunction._classifierGenericType()._typeArguments().getFirst()._rawType())._returnType()._rawType(); + + Object res = null; + DataType resType = null; + if (type == _Package.getByUserPath("String", processorSupport)) + { + String[] resStr = new String[(int) tds.getRowCount()]; + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationType, -1, repository, false), true, processorSupport)); + CoreInstance newValue = this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + resStr[i] = PrimitiveUtilities.getStringValue(newValue.getValueForMetaPropertyToOne("values")); + } + res = resStr; + resType = DataType.STRING; + } + else if (type == _Package.getByUserPath("Integer", processorSupport)) + { + int[] resInt = new int[(int) tds.getRowCount()]; + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationType, -1, repository, false), true, processorSupport)); + CoreInstance newValue = this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + resInt[i] = PrimitiveUtilities.getIntegerValue(newValue.getValueForMetaPropertyToOne("values")).intValue(); + } + res = resInt; + resType = DataType.INT; + } + else if (type == _Package.getByUserPath("Float", processorSupport)) + { + double[] resDouble = new double[(int) tds.getRowCount()]; + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationType, -1, repository, false), true, processorSupport)); + CoreInstance newValue = this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + resDouble[i] = PrimitiveUtilities.getFloatValue(newValue.getValueForMetaPropertyToOne("values")).doubleValue(); + } + res = resDouble; + resType = DataType.DOUBLE; + } + return tds.addColumn(name, resType, res); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Filter.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Filter.java new file mode 100644 index 00000000000..91c9d6d3f14 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Filter.java @@ -0,0 +1,76 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.set.primitive.MutableIntSet; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.factory.primitive.IntSets; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Filter extends Shared +{ + public Filter(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds = getTDS(params, 0, processorSupport); + + RelationType relationType = getRelationType(params, 0); + + CoreInstance filterFunction = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + LambdaFunction lambdaFunction = (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(filterFunction); + VariableContext evalVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, filterFunction); + + MutableIntSet discardedRows = IntSets.mutable.empty(); + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null); + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationType, -1, repository, false), true, processorSupport)); + CoreInstance subResult = this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + if (!PrimitiveUtilities.getBooleanValue(Instance.getValueForMetaPropertyToOneResolved(subResult, M3Properties.values, processorSupport))) + { + discardedRows.add(i); + } + } + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.drop(discardedRows), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/GroupBy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/GroupBy.java new file mode 100644 index 00000000000..8b953d0d69d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/GroupBy.java @@ -0,0 +1,161 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import io.deephaven.csv.parsers.DataType; +import org.eclipse.collections.api.block.procedure.Procedure2; +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.*; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortDirection; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortInfo; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class GroupBy extends Shared +{ + public GroupBy(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds = getTDS(params, 0, processorSupport); + + RelationType relationType = getRelationType(params, 0); + + Object cols = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + ListIterable ids; + if (cols instanceof ColSpec) + { + ids = Lists.mutable.with(((ColSpec) cols)._name()); + } + else if (cols instanceof ColSpecArray) + { + ids = ((ColSpecArray) cols)._names().collect(c -> (String) c).toList(); + } + else + { + throw new RuntimeException("Not Possible"); + } + + CoreInstance aggColSpec = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + TestTDS result; + if (aggColSpec instanceof AggColSpec) + { + result = processOneAggColSpec(tds, null, ids, aggColSpec, resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType); + } + else if (aggColSpec instanceof AggColSpecArray) + { + result = ((AggColSpecArray) aggColSpec)._aggSpecs().injectInto(null, (a, b) -> processOneAggColSpec(tds, a, ids, b, resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType)); + } + else + { + throw new RuntimeException("Not Possible"); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(result, returnGenericType, repository, processorSupport), false, processorSupport); + } + + private TestTDS processOneAggColSpec(TestTDS tds, TestTDS existing, ListIterable ids, CoreInstance aggColSpec, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport, RelationType relationType) + { + String name = aggColSpec.getValueForMetaPropertyToOne("name").getName(); + LambdaFunction mapF = (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(aggColSpec.getValueForMetaPropertyToOne("map")); + LambdaFunction reduceF = (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(aggColSpec.getValueForMetaPropertyToOne("reduce")); + + VariableContext mapFVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, mapF); + VariableContext reduceFVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, reduceF); + + Type type = ((FunctionType) reduceF._classifierGenericType()._typeArguments().getFirst()._rawType())._returnType()._rawType(); + + Pair>> res = tds.sort(ids.collect(c -> new SortInfo(c, SortDirection.ASC))); + + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null); + + int size = res.getTwo().size(); + DataType resType = null; + Object _finalRes = null; + if (type == _Package.getByUserPath("String", processorSupport)) + { + String[] finalRes = new String[size]; + performAggregation(res, mapF, reduceF, (j, val) -> finalRes[j] = PrimitiveUtilities.getStringValue(val), resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType, size, parameters, mapFVarContext, reduceFVarContext); + resType = DataType.STRING; + _finalRes = finalRes; + } + else if (type == _Package.getByUserPath("Integer", processorSupport)) + { + int[] finalRes = new int[size]; + performAggregation(res, mapF, reduceF, (j, val) -> finalRes[j] = PrimitiveUtilities.getIntegerValue(val).intValue(), resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType, size, parameters, mapFVarContext, reduceFVarContext); + resType = DataType.INT; + _finalRes = finalRes; + } + else if (type == _Package.getByUserPath("Float", processorSupport) || type == _Package.getByUserPath("Number", processorSupport)) + { + double[] finalRes = new double[size]; + performAggregation(res, mapF, reduceF, (j, val) -> finalRes[j] = PrimitiveUtilities.getFloatValue(val).doubleValue(), resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, processorSupport, relationType, size, parameters, mapFVarContext, reduceFVarContext); + resType = DataType.FLOAT; + _finalRes = finalRes; + } + else + { + throw new RuntimeException("The type " + type._name() + " is not supported yet!"); + } + return existing == null ? res.getOne()._distinct(res.getTwo()).addColumn(name, resType, _finalRes) : existing.addColumn(name, resType, _finalRes); + } + + private void performAggregation(Pair>> res, LambdaFunction mapF, LambdaFunction reduceF, Procedure2 setter, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport, RelationType relationType, int size, FixedSizeList parameters, VariableContext mapFVarContext, VariableContext reduceFVarContext) + { + for (int j = 0; j < size; j++) + { + Pair r = res.getTwo().get(j); + MutableList subList = Lists.mutable.empty(); + for (int i = r.getOne(); i < r.getTwo(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(res.getOne(), i, "", null, relationType, -1, repository, false), true, processorSupport)); + subList.add(this.functionExecution.executeFunction(false, mapF, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, mapFVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport).getValueForMetaPropertyToOne("values")); + } + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(subList, true, processorSupport)); + CoreInstance re = this.functionExecution.executeFunction(false, reduceF, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, reduceFVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + setter.value(j, re.getValueForMetaPropertyToOne("values")); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Join.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Join.java new file mode 100644 index 00000000000..f4b8dad10b2 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Join.java @@ -0,0 +1,87 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.set.primitive.MutableIntSet; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.factory.primitive.IntSets; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Join extends Shared +{ + public Join(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds1 = getTDS(params, 0, processorSupport); + TestTDS tds2 = getTDS(params, 1, processorSupport); + + TestTDS tds = tds1.join(tds2); + + RelationType relationtype = (RelationType)returnGenericType.getValueForMetaPropertyToMany("typeArguments").get(0).getValueForMetaPropertyToOne("rawType"); + + String joinType = params.get(2).getValueForMetaPropertyToOne("values").getName(); + + CoreInstance filterFunction = Instance.getValueForMetaPropertyToOneResolved(params.get(3), M3Properties.values, processorSupport); + LambdaFunction lambdaFunction = (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(filterFunction); + VariableContext evalVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, filterFunction); + + MutableIntSet discardedRows = IntSets.mutable.empty(); + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null, (CoreInstance) null); + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationtype, -1, repository, false), true, processorSupport)); + parameters.set(1, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationtype, -1, repository, false), true, processorSupport)); + CoreInstance subResult = this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + if (!PrimitiveUtilities.getBooleanValue(Instance.getValueForMetaPropertyToOneResolved(subResult, M3Properties.values, processorSupport))) + { + discardedRows.add(i); + } + } + TestTDS res = tds.drop(discardedRows); + if (joinType.equals("LEFT")) + { + res = tds1.compensateLeft(res); + } + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(res, returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Limit.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Limit.java new file mode 100644 index 00000000000..4c6b367643b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Limit.java @@ -0,0 +1,50 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Limit extends Shared +{ + public Limit(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + Number value = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.slice(0, value.intValue()), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Map.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Map.java new file mode 100644 index 00000000000..9a2a113d96d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Map.java @@ -0,0 +1,78 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSWithCursorCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Map extends Shared +{ + public Map(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + TestTDS tds = getTDS(params, 0, processorSupport); + + RelationType relationType = getRelationType(params, 0); + + CoreInstance collectFunction = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + LambdaFunction lambdaFunction = (LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(collectFunction); + VariableContext evalVarContext = this.getParentOrEmptyVariableContextForLambda(variableContext, collectFunction); + + MutableList results = Lists.mutable.with(); + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null); + for (int i = 0; i < tds.getRowCount(); i++) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(new TDSWithCursorCoreInstance(tds, i, "", null, relationType, -1, repository, false), true, processorSupport)); + results.addAllIterable( + Instance.getValueForMetaPropertyToManyResolved( + this.functionExecution.executeFunction(false, lambdaFunction, parameters, resolvedTypeParameters, resolvedMultiplicityParameters, evalVarContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport), + M3Properties.values, + processorSupport) + ); + } + return ValueSpecificationBootstrap.wrapValueSpecification_ForFunctionReturnValue(Instance.getValueForMetaPropertyToOneResolved(functionExpressionToUseInStack, M3Properties.genericType, processorSupport), + results, false, processorSupport); + + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Project.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Project.java new file mode 100644 index 00000000000..8b4bc1a2347 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Project.java @@ -0,0 +1,151 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import io.deephaven.csv.parsers.DataType; +import org.eclipse.collections.api.list.FixedSizeList; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunction; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.FuncColSpecAccessor; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.FuncColSpecArray; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.FunctionType; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TestTDSInterpreted; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; +import java.util.function.Function; + +public class Project extends Shared +{ + public Project(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + ListIterable values = Instance.getValueForMetaPropertyToManyResolved(params.get(0), M3Properties.values, processorSupport); + + FuncColSpecArray funcColSpecArray = (FuncColSpecArray) Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + ListIterable functions = funcColSpecArray._funcSpecs().collect(c -> (CoreInstance)c._function()).toList(); + ListIterable names = funcColSpecArray._funcSpecs().collect(FuncColSpecAccessor::_name).toList(); + + ListIterable, VariableContext>> funcs = functions.collect(f -> + Tuples.pair((LambdaFunction) LambdaFunctionCoreInstanceWrapper.toLambdaFunction(f), this.getParentOrEmptyVariableContextForLambda(variableContext, f)) + ); + + FixedSizeList parameters = Lists.fixedSize.with((CoreInstance) null); + + MutableList allRes = Lists.mutable.empty(); + for (CoreInstance instance : values) + { + parameters.set(0, ValueSpecificationBootstrap.wrapValueSpecification(instance, true, processorSupport)); + int i = 0; + MutableList allTDS = Lists.mutable.empty(); + for (Pair, VariableContext> fInfo : funcs) + { + Type type = ((FunctionType) fInfo.getOne()._classifierGenericType()._typeArguments().getFirst()._rawType())._returnType()._rawType(); + TestTDS tds = new TestTDSInterpreted(this.repository, processorSupport); + Object colRes = null; + DataType colResType = null; + + MutableList vals = Lists.mutable.empty(); + + final Function valExtractor = getExtractor(processorSupport, type); + + CoreInstance subResult = this.functionExecution.executeFunction(false, fInfo.getOne(), parameters, resolvedTypeParameters, resolvedMultiplicityParameters, fInfo.getTwo(), functionExpressionToUseInStack, profiler, instantiationContext, executionSupport); + subResult.getValueForMetaPropertyToMany("values").forEach(c -> vals.add(valExtractor.apply(c))); + + if (type == _Package.getByUserPath("String", processorSupport)) + { + colResType = DataType.STRING; + colRes = vals.toArray(new String[0]); + } + if (type == _Package.getByUserPath("Integer", processorSupport)) + { + colResType = DataType.INT; + colRes = vals.stream().mapToInt(x -> (Integer) x).toArray(); + } + if (type == _Package.getByUserPath("Float", processorSupport)) + { + colResType = DataType.DOUBLE; + colRes = vals.stream().mapToDouble(x -> (Double) x).toArray(); + } + + TestTDS resTDS = tds.addColumn(names.get(i++), colResType, colRes); + if (vals.isEmpty()) + { + resTDS = resTDS.setNull(); + } + allTDS.add(resTDS); + } + TestTDS init = allTDS.get(0); + allRes.add(allTDS.drop(1).injectInto((TestTDSInterpreted) init, (a, b) -> (TestTDSInterpreted) a.join(b))); + } + TestTDSInterpreted res = allRes.get(0); + if (allRes.size() > 1) + { + TestTDS init = allRes.get(0); + res = allRes.drop(1).injectInto((TestTDSInterpreted) init, (a, b) -> (TestTDSInterpreted) a.concatenate(b)); + } + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(res, returnGenericType, repository, processorSupport), false, processorSupport); + } + + private static Function getExtractor(ProcessorSupport processorSupport, Type type) + { + final Function val; + if (type == _Package.getByUserPath("String", processorSupport)) + { + val = PrimitiveUtilities::getStringValue; + } + else if (type == _Package.getByUserPath("Integer", processorSupport)) + { + val = PrimitiveUtilities::getIntegerValue; + } + else if (type == _Package.getByUserPath("Float", processorSupport)) + { + val = PrimitiveUtilities::getFloatValue; + } + else + { + val = null; + } + return val; + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Rename.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Rename.java new file mode 100644 index 00000000000..9bc83c0a022 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Rename.java @@ -0,0 +1,51 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Rename extends Shared +{ + public Rename(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + String oldName = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getValueForMetaPropertyToOne("name").getName(); + String newName = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport).getValueForMetaPropertyToOne("name").getName(); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.rename(oldName, newName), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Select.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Select.java new file mode 100644 index 00000000000..91d20828584 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Select.java @@ -0,0 +1,72 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpec; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.ColSpecArray; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Select extends Shared +{ + public Select(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + + TestTDS tds = getTDS(params, 0, processorSupport); + + Object cols = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + ListIterable ids; + if (cols instanceof ColSpec) + { + ids = Lists.mutable.with(((ColSpec) cols)._name()); + } + else if (cols instanceof ColSpecArray) + { + ids = ((ColSpecArray) cols)._names().collect(c -> (String) c).toList(); + } + else + { + throw new RuntimeException("Not Possible"); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.select(ids.toSet()), returnGenericType, repository, processorSupport), false, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Size.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Size.java new file mode 100644 index 00000000000..6397b6189e6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Size.java @@ -0,0 +1,48 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Size extends Shared +{ + public Size(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + TestTDS tds = getTDS(params, 0, processorSupport); + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newIntegerCoreInstance(tds.getRowCount()), true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Slice.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Slice.java new file mode 100644 index 00000000000..fe47599c27a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Slice.java @@ -0,0 +1,52 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.*; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Slice extends Shared +{ + public Slice(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + Number from = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)); + Number to = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport)); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.slice(from.intValue(), to.intValue()), returnGenericType, repository, processorSupport), false, processorSupport); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Sort.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Sort.java new file mode 100644 index 00000000000..216443427b3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/Sort.java @@ -0,0 +1,62 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.Shared; +import org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared.TDSCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortDirection; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortInfo; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Sort extends Shared +{ + public Sort(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(functionExecution, repository); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance returnGenericType = getReturnGenericType(resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, processorSupport); + TestTDS tds = getTDS(params, 0, processorSupport); + ListIterable sortInfo = Instance.getValueForMetaPropertyToManyResolved(params.get(1), M3Properties.values, processorSupport); + ListIterable sortInfos = sortInfo.collect(c -> + { + String name = c.getValueForMetaPropertyToOne("column").getValueForMetaPropertyToOne("name").getName(); + SortDirection direction = SortDirection.valueOf(c.getValueForMetaPropertyToOne("direction").getName()); + return new SortInfo(name, direction); + }); + return ValueSpecificationBootstrap.wrapValueSpecification(new TDSCoreInstance(tds.sort(sortInfos).getOne(), returnGenericType, repository, processorSupport), false, processorSupport); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/Shared.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/Shared.java new file mode 100644 index 00000000000..0d94f45e6d7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/Shared.java @@ -0,0 +1,79 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared; + +import io.deephaven.csv.CsvSpecs; +import io.deephaven.csv.reading.CsvReader; +import io.deephaven.csv.sinks.SinkFactory; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relation.RelationType; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.generictype.GenericType; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; + +import java.io.ByteArrayInputStream; +import java.util.Stack; + +public abstract class Shared extends NativeFunction +{ + protected final ModelRepository repository; + protected final FunctionExecutionInterpreted functionExecution; + + public Shared(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + this.functionExecution = functionExecution; + } + + public TestTDS getTDS(ListIterable params, int position, ProcessorSupport processorSupport) + { + return getTDS(params.get(position).getValueForMetaPropertyToOne("values"), processorSupport); + } + + public TestTDS getTDS(CoreInstance value, ProcessorSupport processorSupport) + { + return value instanceof TDSCoreInstance ? + ((TDSCoreInstance) value).getTDS() : + new TestTDSInterpreted(readCsv((value.getValueForMetaPropertyToOne("csv")).getName()), repository, processorSupport); + } + + public RelationType getRelationType(ListIterable params, int i) + { + return (RelationType) params.get(i).getValueForMetaPropertyToOne("genericType").getValueForMetaPropertyToMany("typeArguments").getFirst().getValueForMetaPropertyToOne("rawType"); + } + + public static CoreInstance getReturnGenericType(Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, CoreInstance functionExpressionToUseInStack, ProcessorSupport processorSupport) + { + return GenericType.makeTypeArgumentAsConcreteAsPossible(functionExpressionToUseInStack.getValueForMetaPropertyToOne("genericType"), resolvedTypeParameters.get(0), resolvedMultiplicityParameters.get(0), processorSupport); + } + + + public static CsvReader.Result readCsv(String csv) + { + try + { + return CsvReader.read(CsvSpecs.csv(), new ByteArrayInputStream(csv.getBytes()), SinkFactory.arrays()); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSCoreInstance.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSCoreInstance.java new file mode 100644 index 00000000000..d7375dc6c27 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSCoreInstance.java @@ -0,0 +1,41 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared; + +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.simple.SimpleCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; + +public class TDSCoreInstance extends SimpleCoreInstance +{ + private final TestTDSInterpreted tds; + + public TDSCoreInstance(TestTDS tds, CoreInstance genericType, ModelRepository repository, ProcessorSupport processorSupport) + { + super("", null, _Package.getByUserPath("meta::pure::metamodel::relation::TDS", processorSupport), -1, repository, false); + Instance.addValueToProperty(this, M3Properties.classifierGenericType, genericType, processorSupport); + this.tds = (TestTDSInterpreted)tds; + } + + public TestTDS getTDS() + { + return this.tds; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSWithCursorCoreInstance.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSWithCursorCoreInstance.java new file mode 100644 index 00000000000..2c43d13309c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TDSWithCursorCoreInstance.java @@ -0,0 +1,39 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.simple.SimpleCoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; + +public class TDSWithCursorCoreInstance extends SimpleCoreInstance +{ + private final TestTDSInterpreted tds; + private final int currentRow; + + public TDSWithCursorCoreInstance(TestTDS tds, int currentRow, String name, SourceInformation sourceInformation, CoreInstance classifier, int internalSyntheticId, ModelRepository repository, boolean persistent) + { + super(name, sourceInformation, classifier, internalSyntheticId, repository, persistent); + this.tds = (TestTDSInterpreted)tds; + this.currentRow = currentRow; + } + + public CoreInstance getValue(String name) + { + return tds.getValueAsCoreInstance(name, currentRow); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TestTDSInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TestTDSInterpreted.java new file mode 100644 index 00000000000..cb31a7c5b6d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/interpreted/natives/shared/TestTDSInterpreted.java @@ -0,0 +1,123 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.natives.shared; + +import io.deephaven.csv.parsers.DataType; +import io.deephaven.csv.reading.CsvReader; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.navigation.type.Type; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; + +import java.math.BigDecimal; + +import static org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap.*; + +public class TestTDSInterpreted extends TestTDS +{ + private ModelRepository modelRepository; + private ProcessorSupport processorSupport; + + public TestTDSInterpreted(String csv, ModelRepository repository, ProcessorSupport processorSupport) + { + super(csv); + this.modelRepository = repository; + this.processorSupport = processorSupport; + } + + public TestTDSInterpreted(CsvReader.Result result, ModelRepository repository, ProcessorSupport processorSupport) + { + super(result); + this.modelRepository = repository; + this.processorSupport = processorSupport; + } + + private TestTDSInterpreted(MutableList columnOrdered, MutableMap columnType, int rows, ModelRepository repository, ProcessorSupport processorSupport) + { + super(columnOrdered, columnType, rows); + this.modelRepository = repository; + this.processorSupport = processorSupport; + + } + + public TestTDSInterpreted(ModelRepository repository, ProcessorSupport processorSupport) + { + this.modelRepository = repository; + this.processorSupport = processorSupport; + } + + @Override + public TestTDS newTDS() + { + return new TestTDSInterpreted(this.modelRepository, this.processorSupport); + } + + @Override + public TestTDS newTDS(MutableList columnOrdered, MutableMap columnType, int rows) + { + return new TestTDSInterpreted(columnOrdered, columnType, rows, this.modelRepository, this.processorSupport); + } + + public CoreInstance getValueAsCoreInstance(String columnName, int rowNum) + { + Object dataAsObject = dataByColumnName.get(columnName); + if (dataAsObject == null) + { + throw new RuntimeException("The column " + columnName + " can't be found in the TDS"); + } + boolean[] isNull = (boolean[]) isNullByColumn.get(columnName); + CoreInstance result; + switch (columnType.get(columnName)) + { + case INT: + { + int[] data = (int[]) dataAsObject; + int value = data[rowNum]; + result = !isNull[rowNum] ? newIntegerLiteral(modelRepository, value, processorSupport) : ValueSpecificationBootstrap.wrapValueSpecification_ResultGenericTypeIsKnown(Lists.mutable.empty(), Type.wrapGenericType(_Package.getByUserPath(M3Paths.Integer, processorSupport), processorSupport), true, processorSupport); + break; + } + case CHAR: + { + char[] data = (char[]) dataAsObject; + result = !isNull[rowNum] ? newStringLiteral(modelRepository, "" + data[rowNum], processorSupport) : ValueSpecificationBootstrap.wrapValueSpecification_ResultGenericTypeIsKnown(Lists.mutable.empty(), Type.wrapGenericType(_Package.getByUserPath(M3Paths.String, processorSupport), processorSupport), true, processorSupport); + break; + } + case STRING: + { + String[] data = (String[]) dataAsObject; + String value = data[rowNum]; + result = value != null ? newStringLiteral(modelRepository, value, processorSupport) : ValueSpecificationBootstrap.wrapValueSpecification_ResultGenericTypeIsKnown(Lists.mutable.empty(), Type.wrapGenericType(_Package.getByUserPath(M3Paths.String, processorSupport), processorSupport), true, processorSupport); + break; + } + case FLOAT: + case DOUBLE: + { + double[] data = (double[]) dataAsObject; + result = !isNull[rowNum] ? newFloatLiteral(modelRepository, BigDecimal.valueOf(data[rowNum]), processorSupport) : ValueSpecificationBootstrap.wrapValueSpecification_ResultGenericTypeIsKnown(Lists.mutable.empty(), Type.wrapGenericType(_Package.getByUserPath(M3Paths.Float, processorSupport), processorSupport), true, processorSupport); + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported in getValue"); + } + return result; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..c607d24e5b9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.Relation_Interpreted_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension new file mode 100644 index 00000000000..faf01d3c6ff --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.external.relation.interpreted.RelationExtensionInterpreted \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestPCRReport.java new file mode 100644 index 00000000000..5a6d385c02a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestPCRReport.java @@ -0,0 +1,29 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.interpreted.pure; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals("Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); + Assert.assertEquals(4, PCTReportProviderLoader.gatherReports().size()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestRelationFunctions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestRelationFunctions.java new file mode 100644 index 00000000000..47aca321518 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/TestRelationFunctions.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.interpreted.pure; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.interpreted.testHelper.PureTestBuilderInterpreted; + +public class TestRelationFunctions +{ + public static Test suite() + { + return PureTestBuilderInterpreted.buildSuite("meta::pure::functions::relation"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/Test_Interpreted_RelationFunctions_PCT.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/Test_Interpreted_RelationFunctions_PCT.java new file mode 100644 index 00000000000..0f875aa20a7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-interpreted-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/interpreted/pure/Test_Interpreted_RelationFunctions_PCT.java @@ -0,0 +1,63 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation.interpreted.pure; + +import junit.framework.Test; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.code.core.RelationCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.interpreted.testHelper.PureTestBuilderInterpreted; + +public class Test_Interpreted_RelationFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = RelationCodeRepositoryProvider.relationFunctions; + private static final Adapter adapter = PlatformCodeRepositoryProvider.nativeAdapter; + private static final String platform = "interpreted"; + private static final MutableList expectedFailures = Lists.mutable.empty(); + + public static Test suite() + { + return PureTestBuilderInterpreted.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/pom.xml new file mode 100644 index 00000000000..74e508f36b4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-relation + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-shared-functions-relation + jar + Legend Pure - Runtime - Java Extension - Shared - Functions - Relation + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + io.deephaven + deephaven-csv + 0.12.0 + + + + junit + junit + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortDirection.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortDirection.java new file mode 100644 index 00000000000..657b7055e66 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortDirection.java @@ -0,0 +1,21 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.shared; + +public enum SortDirection +{ + ASC, + DESC +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortInfo.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortInfo.java new file mode 100644 index 00000000000..09d1172eaa0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/SortInfo.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.shared; + +public class SortInfo +{ + String columnName; + SortDirection direction; + + public SortInfo(String name, SortDirection direction) + { + this.columnName = name; + this.direction = direction; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/TestTDS.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/TestTDS.java new file mode 100644 index 00000000000..78b8ea70b0c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/main/java/org/finos/legend/pure/runtime/java/extension/external/relation/shared/TestTDS.java @@ -0,0 +1,1017 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.external.relation.shared; + +import io.deephaven.csv.CsvSpecs; +import io.deephaven.csv.parsers.DataType; +import io.deephaven.csv.reading.CsvReader; +import io.deephaven.csv.sinks.SinkFactory; +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.factory.Maps; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.set.MutableSet; +import org.eclipse.collections.api.set.primitive.IntSet; +import org.eclipse.collections.api.set.primitive.MutableIntSet; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet; +import org.eclipse.collections.impl.tuple.Tuples; +import org.eclipse.collections.impl.utility.ArrayIterate; + +import java.io.ByteArrayInputStream; +import java.lang.reflect.Array; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Objects; + +public class TestTDS +{ + protected MutableMap dataByColumnName = Maps.mutable.empty(); + protected MutableMap isNullByColumn = Maps.mutable.empty(); + protected MutableMap columnType = Maps.mutable.empty(); + protected MutableList columnsOrdered = Lists.mutable.empty(); + protected long rowCount; + + public TestTDS() + { + } + + public TestTDS newTDS() + { + return new TestTDS(); + } + + public TestTDS newTDS(MutableList columnOrdered, MutableMap columnType, int rows) + { + return new TestTDS(columnOrdered, columnType, rows); + } + + public TestTDS(String csv) + { + this(readCsv(csv)); + } + + public TestTDS(CsvReader.Result result) + { + this.rowCount = result.numRows(); + + ArrayIterate.forEach(result.columns(), c -> + { + columnsOrdered.add(c.name()); + columnType.put(c.name(), c.dataType()); + dataByColumnName.put(c.name(), c.data()); + boolean[] array = new boolean[(int) this.rowCount]; + isNullByColumn.put(c.name(), array); + switch (c.dataType()) + { + case INT: + for (int i = 0; i < this.rowCount; i++) + { + array[i] = ((int[]) c.data())[i] == Integer.MIN_VALUE; + } + break; + case CHAR: + for (int i = 0; i < this.rowCount; i++) + { + array[i] = ((char[]) c.data())[i] == Character.MIN_VALUE; + } + break; + case DOUBLE: + for (int i = 0; i < this.rowCount; i++) + { + array[i] = ((double[]) c.data())[i] == -Double.MAX_VALUE; + } + break; + case STRING: + for (int i = 0; i < this.rowCount; i++) + { + if ("null".equals(((String[]) c.data())[i])) + { + ((String[]) c.data())[i] = null; + } + } + } + }); + } + + protected TestTDS(MutableList columnOrdered, MutableMap columnType, int rows) + { + this.columnsOrdered = columnOrdered; + this.columnType = columnType; + this.rowCount = rows; + this.columnType.keyValuesView().forEach(p -> + { + switch (p.getTwo()) + { + case INT: + { + this.dataByColumnName.put(p.getOne(), new int[(int) this.rowCount]); + boolean[] array = new boolean[(int) this.rowCount]; + Arrays.fill(array, Boolean.TRUE); + this.isNullByColumn.put(p.getOne(), array); + break; + } + case CHAR: + { + this.dataByColumnName.put(p.getOne(), new char[(int) this.rowCount]); + boolean[] array = new boolean[(int) this.rowCount]; + Arrays.fill(array, Boolean.TRUE); + this.isNullByColumn.put(p.getOne(), array); + break; + } + case STRING: + { + this.dataByColumnName.put(p.getOne(), new String[(int) this.rowCount]); + boolean[] array = new boolean[(int) this.rowCount]; + Arrays.fill(array, Boolean.TRUE); + this.isNullByColumn.put(p.getOne(), array); + break; + } + case FLOAT: + case DOUBLE: + { + this.dataByColumnName.put(p.getOne(), new double[(int) this.rowCount]); + boolean[] array = new boolean[(int) this.rowCount]; + Arrays.fill(array, Boolean.TRUE); + this.isNullByColumn.put(p.getOne(), array); + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(p.getOne()) + " not supported yet!"); + } + }); + } + + public TestTDS setNull() + { + TestTDS res = this.copy(); + res.rowCount = 1; + boolean[] array = new boolean[(int) res.rowCount]; + Arrays.fill(array, Boolean.TRUE); + res.columnType.keyValuesView().forEach(c -> + { + switch (c.getTwo()) + { + case INT: + res.dataByColumnName.put(c.getOne(), new int[1]); + res.isNullByColumn.put(c.getOne(), array); + break; + case CHAR: + res.dataByColumnName.put(c.getOne(), new char[1]); + res.isNullByColumn.put(c.getOne(), array); + break; + case FLOAT: + case DOUBLE: + res.dataByColumnName.put(c.getOne(), new double[1]); + res.isNullByColumn.put(c.getOne(), array); + break; + case STRING: + res.dataByColumnName.put(c.getOne(), new String[1]); + break; + default: + throw new RuntimeException("ERROR " + columnType.get(c.getTwo()) + " not supported yet!"); + } + }); + return res; + } + + private static SinkFactory makeMySinkFactory() + { + return SinkFactory.arrays( + Byte.MIN_VALUE, + Short.MIN_VALUE, + Integer.MIN_VALUE, + Long.MIN_VALUE, + -Float.MAX_VALUE, + -Double.MAX_VALUE, + Byte.MIN_VALUE, + Character.MIN_VALUE, + "null", + Long.MIN_VALUE, + Long.MIN_VALUE); + } + + public static CsvReader.Result readCsv(String csv) + { + try + { + return CsvReader.read(CsvSpecs.csv(), new ByteArrayInputStream(csv.getBytes(StandardCharsets.UTF_8)), SinkFactory.arrays()); + } + catch (Exception e) + { + throw new RuntimeException("Error parsing:\n" + csv, e); + } + } + + public TestTDS join(TestTDS otherTDS) + { + MutableMap columnTypes = Maps.mutable.empty(); + columnTypes.putAll(this.columnType); + columnTypes.putAll(otherTDS.columnType); + MutableList columnOrdered = Lists.mutable.empty(); + columnOrdered.addAll(this.columnsOrdered); + columnOrdered.addAll(otherTDS.columnsOrdered); + TestTDS res = newTDS(columnOrdered, columnTypes, (int) (rowCount * otherTDS.rowCount)); + + for (int i = 0; i < this.rowCount; i++) + { + for (int j = 0; j < otherTDS.rowCount; j++) + { + for (String column : this.dataByColumnName.keysView()) + { + res.setValue(column, i * (int) otherTDS.rowCount + j, this, i); + } + for (String column : otherTDS.dataByColumnName.keysView()) + { + res.setValue(column, i * (int) otherTDS.rowCount + j, otherTDS, j); + } + } + } + return res; + } + + public void setValue(String columnName, int row, TestTDS srcTDS, int srcRow) + { + Object dataAsObject = dataByColumnName.get(columnName); + boolean[] nullAsObject = (boolean[]) isNullByColumn.get(columnName); + boolean[] nullAsObjectSrc = (boolean[]) srcTDS.isNullByColumn.get(columnName); + switch (columnType.get(columnName)) + { + case INT: + { + ((int[]) dataAsObject)[row] = ((int[]) srcTDS.dataByColumnName.get(columnName))[srcRow]; + nullAsObject[row] = nullAsObjectSrc[srcRow]; + break; + } + case CHAR: + { + ((char[]) dataAsObject)[row] = ((char[]) srcTDS.dataByColumnName.get(columnName))[srcRow]; + nullAsObject[row] = nullAsObjectSrc[srcRow]; + break; + } + case STRING: + { + ((String[]) dataAsObject)[row] = ((String[]) srcTDS.dataByColumnName.get(columnName))[srcRow]; + break; + } + case FLOAT: + case DOUBLE: + { + ((double[]) dataAsObject)[row] = ((double[]) srcTDS.dataByColumnName.get(columnName))[srcRow]; + nullAsObject[row] = nullAsObjectSrc[srcRow]; + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported yet!"); + } + } + + public TestTDS copy() + { + TestTDS result = newTDS(); + result.rowCount = rowCount; + result.columnsOrdered = Lists.mutable.withAll(columnsOrdered); + result.columnType = Maps.mutable.withMap(columnType); + result.dataByColumnName = Maps.mutable.empty(); + result.isNullByColumn = Maps.mutable.empty(); + dataByColumnName.forEachKey(columnName -> + { + Object dataAsObject = dataByColumnName.get(columnName); + Object copy; + Object copyIsNull = null; + switch (columnType.get(columnName)) + { + case INT: + { + copy = Arrays.copyOf((int[]) dataAsObject, (int) rowCount); + copyIsNull = Arrays.copyOf((boolean[]) this.isNullByColumn.get(columnName), (int) rowCount); + break; + } + case CHAR: + { + copy = Arrays.copyOf((char[]) dataAsObject, (int) rowCount); + copyIsNull = Arrays.copyOf((boolean[]) isNullByColumn.get(columnName), (int) rowCount); + break; + } + case STRING: + { + copy = Arrays.copyOf((String[]) dataAsObject, (int) rowCount); + break; + } + case FLOAT: + case DOUBLE: + { + copy = Arrays.copyOf((double[]) dataAsObject, (int) rowCount); + copyIsNull = Arrays.copyOf((boolean[]) isNullByColumn.get(columnName), (int) rowCount); + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported yet!"); + } + result.dataByColumnName.put(columnName, copy); + if (copyIsNull != null) + { + result.isNullByColumn.put(columnName, copyIsNull); + } + }); + return result; + } + + public TestTDS drop(IntSet rows) + { + TestTDS copy = this.copy(); + int size = rows.size(); + copy.dataByColumnName.forEachKey(columnName -> + { + Object dataAsObject = copy.dataByColumnName.get(columnName); + boolean[] isNull = (boolean[]) copy.isNullByColumn.get(columnName); + boolean[] isNullTarget = new boolean[(int) copy.rowCount - size]; + switch (copy.columnType.get(columnName)) + { + case INT: + { + int[] src = (int[]) dataAsObject; + int[] target = new int[(int) copy.rowCount - size]; + int j = 0; + for (int i = 0; i < copy.rowCount; i++) + { + if (!rows.contains(i)) + { + target[j] = src[i]; + isNullTarget[j++] = isNull[i]; + } + } + copy.dataByColumnName.put(columnName, target); + copy.isNullByColumn.put(columnName, isNullTarget); + break; + } + case CHAR: + { + char[] src = (char[]) dataAsObject; + char[] target = new char[(int) copy.rowCount - size]; + int j = 0; + for (int i = 0; i < copy.rowCount; i++) + { + if (!rows.contains(i)) + { + target[j] = src[i]; + isNullTarget[j++] = isNull[i]; + } + } + copy.dataByColumnName.put(columnName, target); + copy.isNullByColumn.put(columnName, isNullTarget); + break; + } + case STRING: + { + String[] src = (String[]) dataAsObject; + String[] target = new String[(int) copy.rowCount - size]; + int j = 0; + for (int i = 0; i < copy.rowCount; i++) + { + if (!rows.contains(i)) + { + target[j++] = src[i]; + } + } + copy.dataByColumnName.put(columnName, target); + break; + } + case FLOAT: + case DOUBLE: + { + double[] src = (double[]) dataAsObject; + double[] target = new double[(int) copy.rowCount - size]; + int j = 0; + for (int i = 0; i < copy.rowCount; i++) + { + if (!rows.contains(i)) + { + target[j] = src[i]; + isNullTarget[j++] = isNull[i]; + } + } + copy.dataByColumnName.put(columnName, target); + copy.isNullByColumn.put(columnName, isNullTarget); + break; + } + default: + throw new RuntimeException("ERROR " + copy.columnType.get(columnName) + " not supported in drop!"); + } + }); + copy.rowCount = copy.rowCount - size; + return copy; + } + + public long getRowCount() + { + return rowCount; + } + + public TestTDS concatenate(TestTDS tds2) + { + TestTDS result = newTDS(); + result.rowCount = this.rowCount + tds2.rowCount; + result.columnType = Maps.mutable.withMap(columnType); + result.columnsOrdered = Lists.mutable.withAll(columnsOrdered); + + dataByColumnName.forEachKey(columnName -> + { + Object dataAsObject1 = dataByColumnName.get(columnName); + Object dataAsObject2 = tds2.dataByColumnName.get(columnName); + Object copy; + boolean[] newIsNull = null; + switch (columnType.get(columnName)) + { + case INT: + { + int[] _copy = Arrays.copyOf((int[]) dataAsObject1, (int) result.rowCount); + System.arraycopy((int[]) dataAsObject2, 0, _copy, (int) rowCount, (int) tds2.rowCount); + copy = _copy; + newIsNull = concatenate((boolean[]) isNullByColumn.get(columnName), (boolean[]) tds2.isNullByColumn.get(columnName)); + break; + } + case CHAR: + { + char[] _copy = Arrays.copyOf((char[]) dataAsObject1, (int) result.rowCount); + System.arraycopy((char[]) dataAsObject2, 0, _copy, (int) rowCount, (int) tds2.rowCount); + copy = _copy; + newIsNull = concatenate((boolean[]) isNullByColumn.get(columnName), (boolean[]) tds2.isNullByColumn.get(columnName)); + break; + } + case STRING: + { + String[] _copy = Arrays.copyOf((String[]) dataAsObject1, (int) result.rowCount); + System.arraycopy((String[]) dataAsObject2, 0, _copy, (int) rowCount, (int) tds2.rowCount); + copy = _copy; + break; + } + case FLOAT: + case DOUBLE: + { + double[] _copy = Arrays.copyOf((double[]) dataAsObject1, (int) result.rowCount); + System.arraycopy((double[]) dataAsObject2, 0, _copy, (int) rowCount, (int) tds2.rowCount); + copy = _copy; + newIsNull = concatenate((boolean[]) isNullByColumn.get(columnName), (boolean[]) tds2.isNullByColumn.get(columnName)); + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported yet!"); + } + result.dataByColumnName.put(columnName, copy); + if (newIsNull != null) + { + result.isNullByColumn.put(columnName, newIsNull); + } + }); + return result; + } + + private boolean[] concatenate(boolean[] set1, boolean[] set2) + { + boolean[] _copy = Arrays.copyOf(set1, set1.length + set2.length); + System.arraycopy(set2, 0, _copy, set1.length, set2.length); + return _copy; + } + + public TestTDS addColumn(String name, DataType dataType, Object res) + { + int size = Array.getLength(res); + if (this.rowCount == 0) + { + this.rowCount = size; + } + if (size != this.rowCount) + { + throw new RuntimeException("Error!"); + } + this.dataByColumnName.put(name, res); + this.columnsOrdered.add(name); + this.columnType.put(name, dataType); + switch (dataType) + { + case INT: + case CHAR: + case FLOAT: + case DOUBLE: + boolean[] array = new boolean[(int) this.rowCount]; + Arrays.fill(array, Boolean.FALSE); + isNullByColumn.put(name, array); + } + return this; + } + + public TestTDS removeColumns(MutableSet columns) + { + TestTDS copy = this.copy(); + copy.columnsOrdered.removeAll(columns); + copy.columnType.removeAllKeys(columns); + copy.isNullByColumn.removeAllKeys(columns); + copy.dataByColumnName.removeAllKeys(columns); + return copy; + } + + public TestTDS select(MutableSet columns) + { + MutableSet allColumns = Sets.mutable.withAll(this.getColumnNames()); + allColumns.removeAll(columns); + return removeColumns(allColumns); + } + + public TestTDS rename(String oldName, String newName) + { + TestTDS copy = this.copy(); + DataType type = copy.columnType.get(oldName); + Object data = copy.dataByColumnName.get(oldName); + Object oldIsNull = copy.isNullByColumn.get(oldName); + copy.columnType.put(newName, type); + copy.dataByColumnName.put(newName, data); + copy.isNullByColumn.put(newName, oldIsNull); + copy.columnsOrdered.add(newName); + copy.columnType.remove(oldName); + copy.dataByColumnName.remove(oldName); + copy.isNullByColumn.remove(oldName); + copy.columnsOrdered.remove(oldName); + return copy; + } + + public TestTDS slice(int from, int to) + { + TestTDS copy = this.copy(); + copy.dataByColumnName.forEachKey(columnName -> + { + Object dataAsObject = copy.dataByColumnName.get(columnName); + boolean[] isNull = (boolean[]) copy.isNullByColumn.get(columnName); + switch (copy.columnType.get(columnName)) + { + case INT: + { + copy.dataByColumnName.put(columnName, Arrays.copyOfRange((int[]) dataAsObject, from, to)); + copy.isNullByColumn.put(columnName, Arrays.copyOfRange(isNull, from, to)); + break; + } + case CHAR: + { + copy.dataByColumnName.put(columnName, Arrays.copyOfRange((char[]) dataAsObject, from, to)); + copy.isNullByColumn.put(columnName, Arrays.copyOfRange(isNull, from, to)); + break; + } + case STRING: + { + copy.dataByColumnName.put(columnName, Arrays.copyOfRange((String[]) dataAsObject, from, to)); + break; + } + case FLOAT: + case DOUBLE: + { + copy.dataByColumnName.put(columnName, Arrays.copyOfRange((double[]) dataAsObject, from, to)); + copy.isNullByColumn.put(columnName, Arrays.copyOfRange(isNull, from, to)); + break; + } + default: + throw new RuntimeException("ERROR " + copy.columnType.get(columnName) + " not supported yet!"); + } + }); + copy.rowCount = (long) to - from; + return copy; + } + + public Pair>> sort(SortInfo sortInfos) + { + return this.sort(Lists.mutable.with(sortInfos)); + } + + public Pair>> sort(ListIterable sortInfos) + { + TestTDS copy = this.copy(); + MutableList> ranges = Lists.mutable.empty(); + this.sort(copy, sortInfos, 0, (int) rowCount, ranges); + return Tuples.pair(copy, ranges); + } + + public TestTDS distinct(MutableList columns) + { + Pair>> res = this.sort(columns.collect(c -> new SortInfo(c, SortDirection.ASC))); + return res.getOne()._distinct(res.getTwo()); + } + + public TestTDS _distinct(MutableList> ranges) + { + MutableIntSet drop = new IntHashSet(); + ranges.forEach(r -> + { + for (int i = r.getOne() + 1; i < r.getTwo(); i++) + { + drop.add(i); + } + }); + return this.drop(drop); + } + + + private void sort(TestTDS copy, ListIterable sortInfos, int start, int end, MutableList> ranges) + { + SortInfo currentSort = sortInfos.getFirst(); + this.sortOneLevel(copy, currentSort, start, end); + if (!sortInfos.isEmpty()) + { + String columnName = currentSort.columnName; + Object dataAsObject = copy.dataByColumnName.get(columnName); + switch (copy.columnType.get(columnName)) + { + case INT: + { + int[] src = (int[]) dataAsObject; + int val = src[start]; + int subStart = start; + + for (int i = start; i < end; i++) + { + if (src[i] != val || (src[i] == val && i == end - 1)) + { + int realEnd = (src[i] == val && i == end - 1) ? end : i; + if (sortInfos.size() > 1) + { + sort(copy, sortInfos.subList(1, sortInfos.size()), subStart, realEnd, ranges); + } + else + { + ranges.add(Tuples.pair(subStart, realEnd)); + } + val = src[i]; + subStart = i; + } + } + break; + } + case CHAR: + { + char[] src = (char[]) dataAsObject; + char val = src[start]; + int subStart = start; + + for (int i = start; i < end; i++) + { + if (src[i] != val || (src[i] == val && i == end - 1)) + { + int realEnd = (src[i] == val && i == end - 1) ? end : i; + if (sortInfos.size() > 1) + { + sort(copy, sortInfos.subList(1, sortInfos.size()), subStart, realEnd, ranges); + } + else + { + ranges.add(Tuples.pair(subStart, realEnd)); + } + val = src[i]; + subStart = i; + } + } + break; + } + case STRING: + { + String[] src = (String[]) dataAsObject; + String val = src[start]; + int subStart = start; + for (int i = start; i < end; i++) + { + if (!Objects.equals(src[i], val) || (Objects.equals(src[i], val) && i == end - 1)) + { + int realEnd = (Objects.equals(src[i], val) && i == end - 1) ? end : i; + if (sortInfos.size() > 1) + { + sort(copy, sortInfos.subList(1, sortInfos.size()), subStart, realEnd, ranges); + } + else + { + ranges.add(Tuples.pair(subStart, realEnd)); + } + val = src[i]; + subStart = i; + } + } + break; + } + case FLOAT: + case DOUBLE: + { + double[] src = (double[]) dataAsObject; + double val = src[start]; + int subStart = start; + for (int i = start; i < end; i++) + { + if (src[i] != val || (src[i] == val && i == end - 1)) + { + int realEnd = (src[i] == val && i == end - 1) ? end : i; + if (sortInfos.size() > 1) + { + sort(copy, sortInfos.subList(1, sortInfos.size()), subStart, realEnd, ranges); + } + else + { + ranges.add(Tuples.pair(subStart, realEnd)); + } + val = src[i]; + subStart = i; + } + } + break; + } + } + } + if (ranges.getLast() != null) + { + int lastVal = ranges.getLast().getTwo(); + if (lastVal < end) + { + ranges.add(Tuples.pair(lastVal, end)); + } + } + } + + private void sortOneLevel(TestTDS copy, SortInfo sortInfo, int start, int end) + { + String columnName = sortInfo.columnName; + Object dataAsObject = copy.dataByColumnName.get(columnName); + switch (copy.columnType.get(columnName)) + { + case INT: + { + int[] src = (int[]) dataAsObject; + MutableList> list = Lists.mutable.empty(); + for (int i = start; i < end; i++) + { + list.add(Tuples.pair(i, src[i])); + } + list.sortThisBy(Pair::getTwo); + if (sortInfo.direction == SortDirection.DESC) + { + list.reverseThis(); + } + this.reorder(copy, list.collect(Pair::getOne), start, end); + break; + } + case CHAR: + { + char[] src = (char[]) dataAsObject; + MutableList> list = Lists.mutable.empty(); + for (int i = start; i < end; i++) + { + list.add(Tuples.pair(i, src[i])); + } + list.sortThisBy(Pair::getTwo); + if (sortInfo.direction == SortDirection.DESC) + { + list.reverseThis(); + } + this.reorder(copy, list.collect(Pair::getOne), start, end); + break; + } + case STRING: + { + String[] src = (String[]) dataAsObject; + MutableList> list = Lists.mutable.empty(); + for (int i = start; i < end; i++) + { + list.add(Tuples.pair(i, src[i])); + } + list.sortThisBy(Pair::getTwo); + if (sortInfo.direction == SortDirection.DESC) + { + list.reverseThis(); + } + this.reorder(copy, list.collect(Pair::getOne), start, end); + break; + } + case FLOAT: + case DOUBLE: + { + double[] src = (double[]) dataAsObject; + MutableList> list = Lists.mutable.empty(); + for (int i = start; i < end; i++) + { + list.add(Tuples.pair(i, src[i])); + } + list.sortThisBy(Pair::getTwo); + if (sortInfo.direction == SortDirection.DESC) + { + list.reverseThis(); + } + this.reorder(copy, list.collect(Pair::getOne), start, end); + break; + } + default: + throw new RuntimeException("ERROR " + columnType.get(columnName) + " not supported in drop!"); + } + } + + private void reorder(TestTDS copy, MutableList indices, int start, int end) + { + for (String columnName : copy.dataByColumnName.keysView()) + { + Object dataAsObject = copy.dataByColumnName.get(columnName); + boolean[] isNull = (boolean[]) copy.isNullByColumn.get(columnName); + switch (copy.columnType.get(columnName)) + { + case INT: + { + int[] src = (int[]) dataAsObject; + boolean[] isNullResult = new boolean[(int) copy.rowCount]; + int[] result = new int[(int) copy.rowCount]; + for (int i = 0; i < indices.size(); i++) + { + result[i] = src[indices.get(i)]; + isNullResult[i] = isNull[indices.get(i)]; + } + System.arraycopy(result, 0, src, start, end - start); + System.arraycopy(isNullResult, 0, isNull, start, end - start); + break; + } + case CHAR: + { + char[] src = (char[]) dataAsObject; + boolean[] isNullResult = new boolean[(int) copy.rowCount]; + char[] result = new char[(int) copy.rowCount]; + for (int i = 0; i < indices.size(); i++) + { + result[i] = src[indices.get(i)]; + isNullResult[i] = isNull[indices.get(i)]; + } + System.arraycopy(result, 0, src, start, end - start); + System.arraycopy(isNullResult, 0, isNull, start, end - start); + break; + } + case STRING: + { + String[] src = (String[]) dataAsObject; + String[] result = new String[(int) copy.rowCount]; + for (int i = 0; i < indices.size(); i++) + { + result[i] = src[indices.get(i)]; + } + System.arraycopy(result, 0, src, start, end - start); + break; + } + case FLOAT: + case DOUBLE: + { + double[] src = (double[]) dataAsObject; + boolean[] isNullResult = new boolean[(int) copy.rowCount]; + double[] result = new double[(int) copy.rowCount]; + for (int i = 0; i < indices.size(); i++) + { + result[i] = src[indices.get(i)]; + isNullResult[i] = isNull[indices.get(i)]; + } + System.arraycopy(result, 0, src, start, end - start); + System.arraycopy(isNullResult, 0, isNull, start, end - start); + break; + } + default: + throw new RuntimeException("ERROR " + copy.columnType.get(columnName) + " not supported in drop!"); + } + } + } + + public String toString() + { + RichIterable columns = this.dataByColumnName.keysView(); + MutableList rows = Lists.mutable.empty(); + for (int i = 0; i < rowCount; i++) + { + int finalI = i; + rows.add(columns.collect(columnName -> + { + Object dataAsObject = dataByColumnName.get(columnName); + boolean[] isNull = (boolean[]) isNullByColumn.get(columnName); + + switch (columnType.get(columnName)) + { + case INT: + { + return isNull[finalI] ? "NULL" : ((int[]) dataAsObject)[finalI]; + } + case CHAR: + { + return isNull[finalI] ? "NULL" : ((char[]) dataAsObject)[finalI]; + } + case STRING: + { + String res = ((String[]) dataAsObject)[finalI]; + return res == null ? "NULL" : res; + } + case FLOAT: + case DOUBLE: + { + return isNull[finalI] ? "NULL" : ((double[]) dataAsObject)[finalI]; + } + default: + return ""; + } + }).makeString(", ")); + } + return columns.makeString(", ") + "\n" + rows.makeString("\n"); + } + + + public TestTDS compensateLeft(TestTDS res) + { + MutableList sortInfos = this.dataByColumnName.keysView().collect(c -> new SortInfo(c, SortDirection.ASC)).toList(); + MutableList cols = this.dataByColumnName.keysView().toList(); + + int rowLeftCurs = 0; + int rowResCurs = 0; + TestTDS leftS = this.sort(sortInfos).getOne(); + TestTDS resS = res.sort(sortInfos).getOne(); + + MutableList missings = Lists.mutable.empty(); + while (rowLeftCurs < leftS.rowCount) + { + if (!leftS.fullMatch(cols, resS, rowLeftCurs, rowResCurs)) + { + missings.add(rowLeftCurs); + rowLeftCurs++; + } + else + { + do + { + rowResCurs++; + } + while (rowResCurs < resS.rowCount && leftS.fullMatch(cols, resS, rowLeftCurs, rowResCurs)); + rowLeftCurs++; + } + } + + TestTDS missingTDS = newTDS(res.columnsOrdered.clone(), res.columnType.clone(), missings.size()); + + int cursor = 0; + for (Integer missing : missings) + { + for (String col : columnType.keysView()) + { + missingTDS.setValue(col, cursor, leftS, missing); + } + cursor++; + } + return res.concatenate(missingTDS); + } + + public boolean fullMatch(MutableList cols, TestTDS second, int rowFirst, int rowSecond) + { + boolean valid = true; + for (String col : cols) + { + Object firstDataAsObject = dataByColumnName.get(col); + Object secondDataAsObject = second.dataByColumnName.get(col); + switch (columnType.get(col)) + { + case INT: + { + valid = valid && ((int[]) firstDataAsObject)[rowFirst] == ((int[]) secondDataAsObject)[rowSecond]; + break; + } + case CHAR: + { + valid = valid && ((char[]) firstDataAsObject)[rowFirst] == ((char[]) secondDataAsObject)[rowSecond]; + break; + } + case STRING: + { + valid = valid && Objects.equals(((String[]) firstDataAsObject)[rowFirst], (((String[]) secondDataAsObject)[rowSecond])); + break; + } + case FLOAT: + case DOUBLE: + { + valid = valid && ((double[]) firstDataAsObject)[rowFirst] == ((double[]) secondDataAsObject)[rowSecond]; + break; + } + default: + throw new RuntimeException("ERROR"); + } + } + return valid; + } + + public MutableList getColumnNames() + { + return this.columnsOrdered; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestTestTDS.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestTestTDS.java new file mode 100644 index 00000000000..9af242e9c76 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-runtime-java-extension-shared-functions-relation/src/test/java/org/finos/legend/pure/runtime/java/extension/relation/TestTestTDS.java @@ -0,0 +1,399 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.relation; + +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortDirection; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.SortInfo; +import org.finos.legend.pure.runtime.java.extension.external.relation.shared.TestTDS; +import org.junit.Assert; + +public class TestTestTDS +{ + @org.junit.Test + public void testSort() + { + String initialTDS = "id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F"; + TestTDS tds = new TestTDS(initialTDS); + + TestTDS t = tds.sort(Lists.mutable.with(new SortInfo("id", SortDirection.ASC), new SortInfo("name", SortDirection.ASC))).getOne(); + Assert.assertEquals("id, name, otherOne\n" + + "1, Pierre, F\n" + + "2, Bla, B\n" + + "2, Neema, F\n" + + "3, Ephrim, C\n" + + "3, Nop, E\n" + + "3, Ok, D\n" + + "4, Simple, D\n" + + "4, Simple, A", t.toString()); + + TestTDS t2 = tds.sort(Lists.mutable.with(new SortInfo("id", SortDirection.ASC), new SortInfo("name", SortDirection.ASC), new SortInfo("otherOne", SortDirection.ASC))).getOne(); + Assert.assertEquals("id, name, otherOne\n" + + "1, Pierre, F\n" + + "2, Bla, B\n" + + "2, Neema, F\n" + + "3, Ephrim, C\n" + + "3, Nop, E\n" + + "3, Ok, D\n" + + "4, Simple, A\n" + + "4, Simple, D", t2.toString()); + + TestTDS t3 = tds.sort(Lists.mutable.with(new SortInfo("id", SortDirection.DESC), new SortInfo("name", SortDirection.ASC), new SortInfo("otherOne", SortDirection.DESC))).getOne(); + Assert.assertEquals("id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "3, Nop, E\n" + + "3, Ok, D\n" + + "2, Bla, B\n" + + "2, Neema, F\n" + + "1, Pierre, F", t3.toString()); + + Assert.assertEquals(initialTDS, tds.toString()); + } + + + @org.junit.Test + public void testGetRanges() + { + String initialTDS = "id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F"; + TestTDS tds = new TestTDS(initialTDS); + + Assert.assertEquals("[0:1, 1:2, 2:3, 3:4, 4:5, 5:6, 6:8]", tds.sort(Lists.mutable.with(new SortInfo("id", SortDirection.ASC), new SortInfo("name", SortDirection.ASC))).getTwo().toString()); + } + + @org.junit.Test + public void testDistinct() + { + String initialTDS = "id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F"; + TestTDS tds = new TestTDS(initialTDS); + + Assert.assertEquals("id, name, otherOne\n" + + "1, Pierre, F\n" + + "2, Bla, B\n" + + "3, Ephrim, C\n" + + "4, Simple, D", tds.distinct(Lists.mutable.with("id")).toString()); + + Assert.assertEquals("id, name, otherOne\n" + + "1, Pierre, F\n" + + "2, Bla, B\n" + + "2, Neema, F\n" + + "3, Ephrim, C\n" + + "3, Nop, E\n" + + "3, Ok, D\n" + + "4, Simple, D", tds.distinct(Lists.mutable.with("id", "name")).toString()); + + Assert.assertEquals("id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F", tds.toString()); + } + + @org.junit.Test + public void testSortWithNull() + { + String resTDS = "id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2"; + + String leftTDS = "id, name\n" + + "1, George\n" + + "3, Sachin\n" + + "2, Pierre\n" + + "4, David"; + + TestTDS res = new TestTDS(resTDS); + TestTDS left = new TestTDS(leftTDS); + + TestTDS t = left.compensateLeft(res).sort(new SortInfo("id", SortDirection.ASC)).getOne(); + Assert.assertEquals("id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "1, 1, More George 2, George, 2\n" + + "2, NULL, NULL, Pierre, NULL\n" + + "3, NULL, NULL, Sachin, NULL\n" + + "4, 4, More David, David, 1", t.toString()); + + Assert.assertEquals(resTDS, res.toString()); + Assert.assertEquals(leftTDS, left.toString()); + } + + @org.junit.Test + public void testSlice() + { + String initialTDS = "id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F"; + TestTDS tds = new TestTDS(initialTDS); + + TestTDS t = tds.slice(1, 3); + Assert.assertEquals("id, name, otherOne\n" + + "4, Simple, A\n" + + "3, Ephrim, C", t.toString()); + + Assert.assertEquals(initialTDS, tds.toString()); + } + + @org.junit.Test + public void testSliceWithNull() + { + String resTDS = "id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2"; + + String leftTDS = "id, name\n" + + "1, George\n" + + "3, Sachin\n" + + "2, Pierre\n" + + "4, David"; + + TestTDS res = new TestTDS(resTDS); + TestTDS left = new TestTDS(leftTDS); + + TestTDS t = left.compensateLeft(res).slice(2, 4); + Assert.assertEquals("id, id2, extra, name, extraInt\n" + + "1, 1, More George 2, George, 2\n" + + "2, NULL, NULL, Pierre, NULL", t.toString()); + + Assert.assertEquals(resTDS, res.toString()); + Assert.assertEquals(leftTDS, left.toString()); + } + + + @org.junit.Test + public void testConcatenate() + { + String initialTDS1 = "id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F"; + + String initialTDS2 = "id, name, otherOne\n" + + "1, SimpleAA, D\n" + + "3, SimpleEE, A\n" + + "4, EphrimWW, C"; + + TestTDS tds1 = new TestTDS(initialTDS1); + TestTDS tds2 = new TestTDS(initialTDS2); + + TestTDS t = tds1.concatenate(tds2); + Assert.assertEquals("id, name, otherOne\n" + + "4, Simple, D\n" + + "4, Simple, A\n" + + "3, Ephrim, C\n" + + "2, Bla, B\n" + + "3, Ok, D\n" + + "3, Nop, E\n" + + "2, Neema, F\n" + + "1, Pierre, F\n" + + "1, SimpleAA, D\n" + + "3, SimpleEE, A\n" + + "4, EphrimWW, C", t.toString()); + + Assert.assertEquals(initialTDS1, tds1.toString()); + Assert.assertEquals(initialTDS2, tds2.toString()); + } + + @org.junit.Test + public void testConcatenateWithNull() + { + String resTDS = "id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2"; + + String leftTDS = "id, name\n" + + "1, George\n" + + "3, Sachin\n" + + "2, Pierre\n" + + "4, David"; + + TestTDS res = new TestTDS(resTDS); + TestTDS left = new TestTDS(leftTDS); + + TestTDS t = res.concatenate(left.compensateLeft(res)); + + Assert.assertEquals("id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2\n" + + "2, NULL, NULL, Pierre, NULL\n" + + "3, NULL, NULL, Sachin, NULL", t.toString()); + + Assert.assertEquals(resTDS, res.toString()); + Assert.assertEquals(leftTDS, left.toString()); + } + + @org.junit.Test + public void testJoin() + { + String initialTds1 = "id, name\n" + + "1, A\n" + + "2, B\n" + + "3, C"; + + String initialTds2 = "extra\n" + + "X\n" + + "Y\n" + + "Z"; + + TestTDS tds1 = new TestTDS(initialTds1); + TestTDS tds2 = new TestTDS(initialTds2); + + TestTDS t = tds1.join(tds2); + + Assert.assertEquals("id, extra, name\n" + + "1, X, A\n" + + "1, Y, A\n" + + "1, Z, A\n" + + "2, X, B\n" + + "2, Y, B\n" + + "2, Z, B\n" + + "3, X, C\n" + + "3, Y, C\n" + + "3, Z, C", t.toString()); + + Assert.assertEquals(initialTds1, tds1.toString()); + Assert.assertEquals(initialTds2, tds2.toString()); + } + + @org.junit.Test + public void testJoinWithNull() + { + String initialRes = "id, id2, extra, name, extraInt\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2"; + + String initialLeft = "id, name\n" + + "1, George\n" + + "3, Sachin"; + + String initialThird = "id, boom\n" + + "1, A1\n" + + "3, A3"; + + TestTDS res = new TestTDS(initialRes); + TestTDS left = new TestTDS(initialLeft); + TestTDS third = new TestTDS(initialThird); + + TestTDS t = left.compensateLeft(res).join(third); + + Assert.assertEquals("id, id2, extra, name, boom, extraInt\n" + + "1, 4, More David, David, A1, 1\n" + + "3, 4, More David, David, A3, 1\n" + + "1, 1, More George 2, George, A1, 2\n" + + "3, 1, More George 2, George, A3, 2\n" + + "1, NULL, NULL, Sachin, A1, NULL\n" + + "3, NULL, NULL, Sachin, A3, NULL", t.toString()); + + Assert.assertEquals(initialRes, res.toString()); + Assert.assertEquals(initialLeft, left.toString()); + Assert.assertEquals(initialThird, third.toString()); + } + + @org.junit.Test + public void testCompensateLeft() + { + String resTDS = "id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2"; + + String leftTDS = "id, name\n" + + "1, George\n" + + "3, Sachin\n" + + "2, Pierre\n" + + "4, David"; + + TestTDS res = new TestTDS(resTDS); + TestTDS left = new TestTDS(leftTDS); + TestTDS t = left.compensateLeft(res); + + Assert.assertEquals("id, id2, extra, name, extraInt\n" + + "1, 1, More George 1, George, 1\n" + + "4, 4, More David, David, 1\n" + + "1, 1, More George 2, George, 2\n" + + "2, NULL, NULL, Pierre, NULL\n" + + "3, NULL, NULL, Sachin, NULL", t.toString()); + + Assert.assertEquals(resTDS, res.toString()); + Assert.assertEquals(leftTDS, left.toString()); + } + + + @org.junit.Test + public void testSentinel() + { + String resTDS = "id,name,id2,col,other\n" + + "1,George,1,More George 1,1\n" + + "1,George,1,More George 2,2\n" + + "2,Pierre,-2147483648,null,-2147483648\n" + + "3,Sachin,-2147483648,null,-2147483648\n" + + "4,David,4,More David,1"; + + TestTDS res = new TestTDS(resTDS); + + Assert.assertEquals("id, col, other, id2, name\n" + + "1, More George 1, 1, 1, George\n" + + "1, More George 2, 2, 1, George\n" + + "2, NULL, NULL, NULL, Pierre\n" + + "3, NULL, NULL, NULL, Sachin\n" + + "4, More David, 1, 4, David", res.toString()); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/pom.xml new file mode 100644 index 00000000000..e3008f729a6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/pom.xml @@ -0,0 +1,35 @@ + + + + + org.finos.legend.engine + legend-engine-core-pure + 4.50.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-code-functions-relation + pom + Legend Engine - Pure - Code - Core - Functions - Relation + + + legend-engine-pure-functions-relation-pure + legend-engine-pure-runtime-java-extension-compiled-functions-relation + legend-engine-pure-runtime-java-extension-interpreted-functions-relation + legend-engine-pure-runtime-java-extension-shared-functions-relation + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/pom.xml new file mode 100644 index 00000000000..9705b85ffd5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/pom.xml @@ -0,0 +1,185 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-standard + 4.50.2-SNAPSHOT + + + legend-engine-pure-functions-standard-pure + jar + Legend Engine - Pure - Code - Core - Functions - Standard + + + + + org.finos.legend.pure + legend-pure-maven-generation-par + + src/main/resources + ${legend.pure.version} + + ${project.basedir}/src/main/resources/core_functions_standard.definition.json + + + + + generate-sources + + build-pure-jar + + + + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + true + modular + true + + core_functions_standard + + + + + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation + ${project.version} + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + + functions + process-classes + + generate-pct-functions + + + ${project.build.directory}/classes/pct-reports/ + org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider.standardFunctions + + + + report + process-test-classes + + generate-pct-report + + + Compiled + ${project.build.directory}/classes/pct-reports/ + + org.finos.legend.engine.pure.code.core.functions.standard.Test_Compiled_StandardFunctions_PCT + + + + + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation + ${project.version} + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + + org.finos.legend.engine + legend-engine-pure-platform-java + + + org.finos.legend.pure + legend-pure-m2-dsl-tds-pure + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + + + junit + junit + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/CoreStandardFunctionsCodeRepositoryProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/CoreStandardFunctionsCodeRepositoryProvider.java new file mode 100644 index 00000000000..ba521497738 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/CoreStandardFunctionsCodeRepositoryProvider.java @@ -0,0 +1,35 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class CoreStandardFunctionsCodeRepositoryProvider implements CodeRepositoryProvider +{ + public static final ReportScope standardFunctions = new ReportScope( + "standard", + "meta::pure::functions", + "/core_functions_standard/" + ); + + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("core_functions_standard.definition.json"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/Standard_Functions_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/Standard_Functions_PCTReportProvider.java new file mode 100644 index 00000000000..02663fa4fba --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/java/org/finos/legend/pure/code/core/Standard_Functions_PCTReportProvider.java @@ -0,0 +1,40 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Standard_Functions_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return PCTReportProviderTool.load(Standard_Functions_PCTReportProvider.class.getClassLoader(), Functions.class, + "pct-reports/FUNCTIONS_standard.json" + ); + } + + @Override + public MutableList getAdapterReports() + { + return PCTReportProviderTool.load(Standard_Functions_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_Native.json" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..9f8f983d9ea --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.Standard_Functions_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..48530864d78 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions.definition.json b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard.definition.json similarity index 62% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions.definition.json rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard.definition.json index 2d3f82d736c..82a8f941574 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions.definition.json +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard.definition.json @@ -1,8 +1,8 @@ { - "name": "core_functions", + "name": "core_functions_standard", "pattern": "(meta::pure::milestoning|meta::pure::functions)(::.*)?", "dependencies": [ "platform", - "platform_functions" + "core_functions_relation" ] } \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/average.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/average.pure new file mode 100644 index 00000000000..b76c572b2c5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/average.pure @@ -0,0 +1,30 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::average(numbers:Number[*]):Float[1] +{ + if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) +} + +function <> meta::pure::functions::math::average(numbers:Integer[*]):Float[1] +{ + if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) +} + +function <> meta::pure::functions::math::average(numbers:Float[*]):Float[1] +{ + if($numbers->isEmpty(),|fail('Error: Mean of an empty set.');0.0;,|$numbers->sum() / $numbers->size()) +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDev.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDev.pure new file mode 100644 index 00000000000..58a808d6c84 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDev.pure @@ -0,0 +1,20 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::stdDev(numbers:Number[1..*], isBiasCorrected: Boolean[1]):Number[1] +{ + sqrt(variance($numbers, $isBiasCorrected)); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevPopulation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevPopulation.pure new file mode 100644 index 00000000000..30fe743eca6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevPopulation.pure @@ -0,0 +1,52 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::stdDevPopulation(numbers:Number[*]):Number[1] +{ + meta::pure::functions::math::stdDev($numbers->toOneMany(), false); +} + +function <> meta::pure::functions::math::stdDevPopulation(numbers:Number[1..*]):Number[1] +{ + meta::pure::functions::math::stdDev($numbers, false); +} + +function <> meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(0.5, $f->eval(|stdDevPopulation([1,2]))); + assertEq(1.0, $f->eval(|stdDevPopulation([2,4]))); +} + +function <> meta::pure::functions::math::tests::stdDev::testSimpleGroupByStandardDeviationPopulation(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, val + 1, 1 + 1, 2 + 2, 2 + 2, 4 + #->groupBy(~[id], ~[newCol : x | $x.val : y | $y->meta::pure::functions::math::stdDevPopulation()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' id,newCol\n'+ + ' 1,0.5\n'+ + ' 2,1.0\n'+ + '#', $res->sort(~id->ascending())->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevSample.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevSample.pure new file mode 100644 index 00000000000..dd72e4cfc91 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/stdDevSample.pure @@ -0,0 +1,79 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::stdDevSample(numbers:Number[*]):Number[1] +{ + meta::pure::functions::math::stdDev($numbers->toOneMany(), true); +} + +function <> meta::pure::functions::math::stdDevSample(numbers:Number[1..*]):Number[1] +{ + meta::pure::functions::math::stdDev($numbers, true); +} + +function <> meta::pure::functions::math::tests::stdDev::testIntStdDev(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(1.0, $f->eval(|stdDevSample([1,2,3]))); + assertEq(2.0, $f->eval(|stdDevSample([2,4,6]))); +} + +function <> meta::pure::functions::math::tests::stdDev::testFloatStdDev(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(1.0, $f->eval(|stdDevSample([1.0,2.0,3.0]))); + assertEq(1.0, $f->eval(|stdDevSample([1.5,2.5,3.5]))); + assertEq(3.14, $f->eval(|stdDevSample([3.14,6.28,9.42]))); +} + +function <> meta::pure::functions::math::tests::stdDev::testMixedStdDev(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(1.0, $f->eval(|stdDevSample([1.0,2,3.0]))); + assertEq(0.5, $f->eval(|stdDevSample([1,1.5,2]))); +} + +function <> meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(2.0, $f->eval(|stdDevSample([-2,-4,-6]))); + assertEq(5.0, $f->eval(|stdDevSample([-5,0,5]))); + assertEq(5.0, $f->eval(|stdDevSample([-5.0,0.0,5.0]))); +} + + +function <> meta::pure::functions::math::tests::stdDev::testSimpleGroupByStandardDeviationSample(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, val + 1, 1.0 + 1, 2.0 + 1, 3 + 2, 1.5 + 2, 2.5 + 2, 3.5 + 3, 1 + 3, 1.5 + 3, 2.0 + #->groupBy(~[id], ~[newCol : x | $x.val : y | $y->meta::pure::functions::math::stdDevSample()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' id,newCol\n'+ + ' 1,1.0\n'+ + ' 2,1.0\n'+ + ' 3,0.5\n'+ + '#', $res->sort(~id->ascending())->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/sum.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/sum.pure new file mode 100644 index 00000000000..baf10397dee --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/sum.pure @@ -0,0 +1,30 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::sum(numbers:Number[*]):Number[1] +{ + $numbers->plus(); +} + +function <> meta::pure::functions::math::sum(numbers:Integer[*]):Integer[1] +{ + $numbers->plus(); +} + +function <> meta::pure::functions::math::sum(numbers:Float[*]):Float[1] +{ + $numbers->plus(); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variance.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variance.pure new file mode 100644 index 00000000000..3f0500a0cdd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variance.pure @@ -0,0 +1,35 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::variance(numbers:Number[*], isBiasCorrected: Boolean[1]):Number[1] +{ + let avg = $numbers->average(); + let accVal = $numbers->fold({val,acc|$acc + pow($val - $avg, 2);}, 0.0->cast(@Number)); + $accVal / ($numbers->size() - if ($isBiasCorrected, |1.0, |0.0)); +} + + +function <> meta::pure::functions::math::tests::variance::testVariance_Population(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(0.25, $f->eval(|variance([1,2], false))); + assertEq(1.0, $f->eval(|variance([2,4], false))); +} + +function <> meta::pure::functions::math::tests::variance::testVariance_Sample(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(1.0, $f->eval(|variance([1.0,2.0,3.0], true))); + assertEq(4.0, $f->eval(|variance([2,4,6], true))); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variancePopulation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variancePopulation.pure new file mode 100644 index 00000000000..0c5284d7a89 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/variancePopulation.pure @@ -0,0 +1,48 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::variancePopulation(numbers:Number[*]):Number[1] +{ + variance($numbers, false); +} + +function <> meta::pure::functions::math::tests::variance::testVariancePopulation(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(0.25, $f->eval(|variancePopulation([1,2]))); + assertEq(1.0, $f->eval(|variancePopulation([2,4]))); +} + + +function <> meta::pure::functions::math::tests::variance::testSimpleGroupByVariancePopulation(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, val + 1, 1 + 1, 2 + 2, 2 + 2, 4 + #->groupBy(~[id], ~[newCol : x | $x.val : y | $y->meta::pure::functions::math::variancePopulation()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' id,newCol\n'+ + ' 1,0.25\n'+ + ' 2,1.0\n'+ + '#', $res->sort(~id->ascending())->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/varianceSample.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/varianceSample.pure new file mode 100644 index 00000000000..b27539dd078 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/main/resources/core_functions_standard/math/aggregator/varianceSample.pure @@ -0,0 +1,50 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::test::pct::*; + +function <> meta::pure::functions::math::varianceSample(numbers:Number[*]):Number[1] +{ + variance($numbers, true); +} + +function <> meta::pure::functions::math::tests::variance::testVarianceSample(f:Function<{Function<{->Z[y]}>[1]->Z[y]}>[1]):Boolean[1] +{ + assertEq(1.0, $f->eval(|varianceSample([1.0,2.0,3.0]))); + assertEq(4.0, $f->eval(|varianceSample([2,4,6]))); +} + + +function <> meta::pure::functions::math::tests::variance::testSimpleGroupByVarianceSample(f:Function<{Function<{->T[m]}>[1]->T[m]}>[1]):Boolean[1] +{ + let expr = { + |#TDS + id, val + 1, 1.0 + 1, 2.0 + 1, 3.0 + 2, 2 + 2, 4 + 2, 6 + #->groupBy(~[id], ~[newCol : x | $x.val : y | $y->meta::pure::functions::math::varianceSample()]) + }; + + let res = $f->eval($expr); + + assertEquals( '#TDS\n'+ + ' id,newCol\n'+ + ' 1,1.0\n'+ + ' 2,4.0\n'+ + '#', $res->sort(~id->ascending())->toString()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestFunctionsStandardCompiledStateStrategy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestFunctionsStandardCompiledStateStrategy.java new file mode 100644 index 00000000000..22f24494570 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestFunctionsStandardCompiledStateStrategy.java @@ -0,0 +1,27 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.standard; + +import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; +import org.junit.BeforeClass; + +public class TestFunctionsStandardCompiledStateStrategy extends AbstractCompiledStateIntegrityTest +{ + @BeforeClass + public static void initialize() + { + initialize("core_functions_standard"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestPCRReport.java new file mode 100644 index 00000000000..e31d02c2150 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/TestPCRReport.java @@ -0,0 +1,31 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.standard; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals(5, PCTReportProviderLoader.gatherFunctions().size()); + Assert.assertEquals("essential, grammar, relation, standard, unclassified", PCTReportProviderLoader.gatherFunctions().collect(c -> c.reportScope.module).distinct().sortThis().makeString(", ")); + Assert.assertEquals(5, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals("Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Compiled_StandardFunctions_PCT.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Compiled_StandardFunctions_PCT.java new file mode 100644 index 00000000000..de859f9641f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Compiled_StandardFunctions_PCT.java @@ -0,0 +1,63 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.standard; + +import junit.framework.Test; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class Test_Compiled_StandardFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = PlatformCodeRepositoryProvider.nativeAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.empty(); + + public static Test suite() + { + return PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/test/java/org/finos/legend/engine/pure/code/core/Test_Pure_Core_Functions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Pure_Core_Functions.java similarity index 65% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/test/java/org/finos/legend/engine/pure/code/core/Test_Pure_Core_Functions.java rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Pure_Core_Functions.java index fb20fe0e938..8bb0936951b 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/test/java/org/finos/legend/engine/pure/code/core/Test_Pure_Core_Functions.java +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/standard/Test_Pure_Core_Functions.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.engine.pure.code.core; +package org.finos.legend.engine.pure.code.core.functions.standard; import junit.framework.TestSuite; import org.finos.legend.pure.m3.execution.test.PureTestBuilder; @@ -27,8 +27,7 @@ public static TestSuite suite() CompiledExecutionSupport executionSupport = PureTestBuilderCompiled.getClassLoaderExecutionSupport(); executionSupport.getConsole().disable(); TestSuite suite = new TestSuite(); - suite.addTest(PureTestBuilderCompiled.buildSuite(TestCollection.collectTests("meta::pure::functions", executionSupport.getProcessorSupport(), fn -> PureTestBuilderCompiled.generatePureTestCollection(fn, executionSupport), ci -> PureTestBuilder.satisfiesConditionsModular(ci, executionSupport.getProcessorSupport())), executionSupport)); - suite.addTest(PureTestBuilderCompiled.buildSuite(TestCollection.collectTests("meta::pure::milestoning", executionSupport.getProcessorSupport(), fn -> PureTestBuilderCompiled.generatePureTestCollection(fn, executionSupport), ci -> PureTestBuilder.satisfiesConditionsModular(ci, executionSupport.getProcessorSupport())), executionSupport)); + suite.addTest(PureTestBuilderCompiled.buildSuite(TestCollection.collectTests("meta::pure::functions::relation", executionSupport.getProcessorSupport(), fn -> PureTestBuilderCompiled.generatePureTestCollection(fn, executionSupport), ci -> PureTestBuilder.satisfiesConditionsModular(ci, executionSupport.getProcessorSupport())), executionSupport)); return suite; } diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/pom.xml new file mode 100644 index 00000000000..4fca0b7fcf4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/pom.xml @@ -0,0 +1,32 @@ + + + + + org.finos.legend.engine + legend-engine-core-pure + 4.50.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-code-functions-standard + pom + Legend Engine - Pure - Code - Core - Functions - Standard + + + legend-engine-pure-functions-standard-pure + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/pom.xml new file mode 100644 index 00000000000..673f8710f80 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/pom.xml @@ -0,0 +1,119 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-unclassified + 4.50.2-SNAPSHOT + + + Legend Pure - Base - M2 Functions - Base - Pure + legend-engine-pure-functions-unclassified-pure + jar + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + compile + compile + + compile + + + + default-compile + process-classes + + + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.finos.legend.pure + legend-pure-maven-generation-par + + ${project.basedir}/src/main/resources + ${legend.pure.version} + + ${project.basedir}/src/main/resources/core_functions_unclassified.definition.json + + + + + generate-sources + + build-pure-jar + + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + + process-classes + + generate-pct-functions + + + + + ${project.build.directory}/classes/pct-reports/ + org.finos.legend.pure.code.core.CoreUnclassifiedFunctionsCodeRepositoryProvider.unclassifiedFunctions + + + + + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + + junit + junit + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/CoreUnclassifiedFunctionsCodeRepositoryProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/CoreUnclassifiedFunctionsCodeRepositoryProvider.java new file mode 100644 index 00000000000..b291d6eb530 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/CoreUnclassifiedFunctionsCodeRepositoryProvider.java @@ -0,0 +1,35 @@ +// Copyright 2021 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class CoreUnclassifiedFunctionsCodeRepositoryProvider implements CodeRepositoryProvider +{ + public static final ReportScope unclassifiedFunctions = new ReportScope( + "unclassified", + "meta::pure::functions", + "/core_functions_unclassified/" + ); + + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("core_functions_unclassified.definition.json"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/Unclassified_Functions_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/Unclassified_Functions_PCTReportProvider.java new file mode 100644 index 00000000000..c174772e289 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/code/core/Unclassified_Functions_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core; + +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Unclassified_Functions_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return PCTReportProviderTool.load(Unclassified_Functions_PCTReportProvider.class.getClassLoader(), Functions.class, + "pct-reports/FUNCTIONS_unclassified.json" + ); + } + + @Override + public MutableList getAdapterReports() + { + return Lists.mutable.empty(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/m2/functions/M2FunctionsPath.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/m2/functions/M2FunctionsPath.java new file mode 100644 index 00000000000..109612714a1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/java/org/finos/legend/pure/m2/functions/M2FunctionsPath.java @@ -0,0 +1,19 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.m2.functions; + +public class M2FunctionsPath +{ +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..e8f2d34cf68 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.Unclassified_Functions_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..0a1ab0a4339 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.pure.code.core.CoreUnclassifiedFunctionsCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified.definition.json b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified.definition.json new file mode 100644 index 00000000000..23fddefdb43 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified.definition.json @@ -0,0 +1,7 @@ +{ + "name": "core_functions_unclassified", + "pattern": "(meta::pure::functions|meta::pure|meta::core|meta::alloy|meta::legend|meta::vcs)(::.*)?", + "dependencies": [ + "platform" + ] +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/decrypt.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/decrypt.pure new file mode 100644 index 00000000000..a6f669212d6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/decrypt.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::cipher::decrypt(value:String[1], key:String[1]):String[1]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/encrypt.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/encrypt.pure new file mode 100644 index 00000000000..dbf76bb0b93 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/encrypt.pure @@ -0,0 +1,18 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Encryption/Decryption is based on AES/GCM/NoPadding with 128 bit key. +native function meta::pure::functions::cipher::encrypt(value:String[1],key:String[1]):String[1]; +native function meta::pure::functions::cipher::encrypt(value:Number[1],key:String[1]):String[1]; +native function meta::pure::functions::cipher::encrypt(value:Boolean[1],key:String[1]):String[1]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/profile.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/profile.pure new file mode 100644 index 00000000000..c447ab350cb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/cipher/profile.pure @@ -0,0 +1,4 @@ +Profile meta::pure::profiles::cipher +{ + stereotypes: [Cipher, Decipher]; +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/collection/containsAny.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/containsAny.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/collection/containsAny.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/containsAny.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/collection/in.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/in.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/collection/in.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/in.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/operation/distinct.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/operation/distinct.pure new file mode 100644 index 00000000000..e5f86a663e9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/collection/operation/distinct.pure @@ -0,0 +1,18 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function meta::pure::functions::collection::distinct(s:T[*]):T[*] +{ + $s->removeDuplicates(); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/now.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/now.pure new file mode 100644 index 00000000000..0808a4bbae5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/now.pure @@ -0,0 +1,16 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Returns the current time to a system dependent precision. +native function <> meta::pure::functions::date::now():DateTime[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/today.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/today.pure new file mode 100644 index 00000000000..4506614dcdd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/creation/today.pure @@ -0,0 +1,16 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Returns the current day. +native function <> meta::pure::functions::date::today():StrictDate[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfWeekNumber.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfWeekNumber.pure new file mode 100644 index 00000000000..063eb0c666e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfWeekNumber.pure @@ -0,0 +1,32 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::date::dayOfWeekNumber(d:Date[1]):Integer[1]; + +function <> meta::pure::functions::date::tests::testDayOfWeekNumber():Boolean[1] +{ + assertEquals(3, %2015-04-15->dayOfWeekNumber()); + assertEquals(3, %2015-04-15T17->dayOfWeekNumber()); + assertEquals(3, %2015-04-15T17:09->dayOfWeekNumber()); + assertEquals(3, %2015-04-15T17:09:21->dayOfWeekNumber()); + assertEquals(3, %2015-04-15T17:09:21.398->dayOfWeekNumber()); + + assertEquals(1, %2015-04-13->dayOfWeekNumber()); + assertEquals(2, %2015-04-14->dayOfWeekNumber()); + assertEquals(3, %2015-04-15->dayOfWeekNumber()); + assertEquals(4, %2015-04-16->dayOfWeekNumber()); + assertEquals(5, %2015-04-17->dayOfWeekNumber()); + assertEquals(6, %2015-04-18->dayOfWeekNumber()); + assertEquals(7, %2015-04-19->dayOfWeekNumber()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfYear.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfYear.pure new file mode 100644 index 00000000000..fa6777b6bd7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/dayOfYear.pure @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::date::dayOfYear(d:Date[1]):Integer[1]; + +function <> {test.excludePlatform = 'Java compiled'} meta::pure::functions::date::tests::testDayOfYear():Boolean[1] +{ + assertEquals(34, %2023-02-03->dayOfYear()); + assertEquals(34, %2023-02-03T17->dayOfYear()); + assertEquals(34, %2023-02-03T17:09->dayOfYear()); + assertEquals(34, %2023-02-03T17:09:21->dayOfYear()); + assertEquals(34, %2023-02-03T17:09:21.398->dayOfYear()); + + assertEquals(61, %2020-03-01->dayOfYear()); + assertEquals(60, %2021-03-01->dayOfYear()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/weekOfYear.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/weekOfYear.pure new file mode 100644 index 00000000000..8eb321a6966 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/date/extract/weekOfYear.pure @@ -0,0 +1,24 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::date::weekOfYear(d:Date[1]):Integer[1]; + +function <> meta::pure::functions::date::tests::testWeekOfYear():Boolean[1] +{ + assertEquals(16, %2015-04-15->weekOfYear()); + assertEquals(16, %2015-04-15T17->weekOfYear()); + assertEquals(16, %2015-04-15T17:09->weekOfYear()); + assertEquals(16, %2015-04-15T17:09:21->weekOfYear()); + assertEquals(16, %2015-04-15T17:09:21.398->weekOfYear()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/hash/hash.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/hash/hash.pure new file mode 100644 index 00000000000..8830f87ae1f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/hash/hash.pure @@ -0,0 +1,40 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::functions::hash::*; + +Enum meta::pure::functions::hash::HashType +{ + MD5, + SHA1, + SHA256 +} + +native function meta::pure::functions::hash::hash(text: String[1], hashType: meta::pure::functions::hash::HashType[1]):String[1]; + + +function <> meta::pure::functions::hash::tests::testMD5_Hash():Boolean[1] +{ + assertEquals('65A8E27D8879283831B664BD8B7F0AD4'->toLower(), hash('Hello, World!', HashType.MD5)); +} + +function <> meta::pure::functions::hash::tests::testSHA1_Hash():Boolean[1] +{ + assertEquals('0A0A9F2A6772942557AB5355D76AF442F8F65E01'->toLower(), hash('Hello, World!', HashType.SHA1)); +} + +function <> meta::pure::functions::hash::tests::testSHA256_Hash():Boolean[1] +{ + assertEquals('DFFD6021BB2BD5B0AF676290809EC3A53191DD81C7F70A4B28688A362182986F'->toLower(), hash('Hello, World!', HashType.SHA256)); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/http/executeHTTPRaw.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/http/executeHTTPRaw.pure new file mode 100644 index 00000000000..3ae036f804b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/http/executeHTTPRaw.pure @@ -0,0 +1,45 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::functions::io::http::*; + +Class meta::pure::functions::io::http::URL +{ + scheme: URLScheme[0..1]; + host : String[1]; + port : Integer[1]; + path : String[1]; +} + +Enum meta::pure::functions::io::http::URLScheme +{ + http, + https +} + +Enum meta::pure::functions::io::http::HTTPMethod +{ + GET, + PUT, + POST, + DELETE +} + +Class meta::pure::functions::io::http::HTTPResponse +{ + statusCode : Integer[1]; + entity : String[1]; +} + +native function meta::pure::functions::io::http::executeHTTPRaw(url:URL[1], method:HTTPMethod[1], mimeType:String[0..1], body:String[0..1]):HTTPResponse[1]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/readFile.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/readFile.pure new file mode 100644 index 00000000000..26c13dd14cb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/io/readFile.pure @@ -0,0 +1,22 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function meta::pure::functions::io::readFile(filePath:String[1]):String[0..1] +{ + readFile($filePath, []) +} + +// Read the text of a file. If lineSeparator is supplied, then it will replace any line separators found in the file. +// This can be used, for example, to ensure consistency of line separator independently of the underlying file system. +native function meta::pure::functions::io::readFile(filePath:String[1], lineSeparator:String[0..1]):String[0..1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/lang/mutateAdd.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/lang/mutateAdd.pure new file mode 100644 index 00000000000..991605f3867 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/lang/mutateAdd.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::lang::mutateAdd(obj:T[1], property:String[1], value:Any[*]):T[1]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/math/sequence/repeat.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/math/sequence/repeat.pure new file mode 100644 index 00000000000..a75089c670f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/math/sequence/repeat.pure @@ -0,0 +1,36 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::collection::repeat(element:T[1], n:Integer[1]):T[*]; + +function <> meta::pure::functions::collection::tests::repeat::testRepeat():Boolean[1] +{ + assertEquals([1, 1], 1->repeat(2)); + assertEquals([1, 1, 1], 1->repeat(3)); +} + +function <> meta::pure::functions::collection::tests::repeat::testRepeatOne():Boolean[1] +{ + assertEquals(1, 1->repeat(1)); +} + +function <> meta::pure::functions::collection::tests::repeat::testRepeatZero():Boolean[1] +{ + assertEmpty(1->repeat(0)); +} + +function <> meta::pure::functions::collection::tests::repeat::testRepeatNegative():Boolean[1] +{ + assertEmpty(1->repeat(-5)); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/compileValueSpecification.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/compileValueSpecification.pure new file mode 100644 index 00000000000..454ddf794d4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/compileValueSpecification.pure @@ -0,0 +1,53 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +Class meta::pure::functions::meta::CompilationResult +{ + result:ValueSpecification[0..1]; + failure:CompilationFailure[0..1]; + + succeeded() + { + $this.failure->isEmpty() + }:Boolean[1]; + + failed() + { + !$this.succeeded(); + }:Boolean[1]; +} + +Class meta::pure::functions::meta::CompilationFailure +{ + message:String[1]; + sourceInformation:SourceInformation[0..1]; +} + +native function meta::pure::functions::meta::compileValueSpecification<|m>(value:String[m]):CompilationResult[m]; + +function <> meta::pure::functions::meta::tests::compileValueSpecification::testCompileValueSpecification():Boolean[1] +{ + let res = compileValueSpecification('meta::pure::functions::meta::tests::model::CC_Person.all()->filter(t | $t.lastName == 3)'); + let expr = $res.result; + assertEquals('filter', $expr->cast(@SimpleFunctionExpression).func.functionName); + assertSize($expr->cast(@SimpleFunctionExpression).parametersValues, 2); +} + +function <> meta::pure::functions::meta::tests::reactivate::testPredicateReactivate():Boolean[1] +{ + let res = compileValueSpecification('[1,2,3]->exists(x|$x>1)'); + let expr = $res.result; + + assertEquals(true, $expr->toOne()->reactivate()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newAssociation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newAssociation.pure new file mode 100644 index 00000000000..6fd9fe1c678 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newAssociation.pure @@ -0,0 +1,93 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newAssociation(name:String[1], p1:Property[1], p2:Property[1]):Association[1]; + + + + +function <> meta::pure::functions::meta::tests::newAssociation::testNewAssociation():Boolean[1] +{ + let classA = newClass('test::pkg::ClassA'); + let classB = newClass('test::pkg::ClassB'); + let aToB = newProperty('aToB', ^GenericType(rawType=$classA), ^GenericType(rawType=$classB), ZeroMany); + let bToA = newProperty('bToA', ^GenericType(rawType=$classB), ^GenericType(rawType=$classA), ZeroMany); + + let myAssociation = newAssociation('pkg1::pkg2::pkg3::MyAssociation', $aToB, $bToA); + assertInstanceOf($myAssociation, Association); + assertEquals('MyAssociation', $myAssociation.name); + assertIs($aToB, $myAssociation.properties->at(0)); + assertIs($bToA, $myAssociation.properties->at(1)); + + let pkg3 = $myAssociation.package->toOne(); + assertInstanceOf($pkg3, Package); + assertEquals('pkg3', $pkg3.name); + assertFalse($pkg3.children->contains($myAssociation)); + + let pkg2 = $pkg3.package->toOne(); + assertInstanceOf($pkg2, Package); + assertEquals('pkg2', $pkg2.name); + + let pkg1 = $pkg2.package->toOne(); + assertInstanceOf($pkg1, Package); + assertEquals('pkg1', $pkg1.name); + + let rootPkg = $pkg1.package->toOne(); + assertInstanceOf($rootPkg, Package); + assertEquals('Root', $rootPkg.name); + + let noPackage = newAssociation('AssociationWithNoPackage', $aToB, $bToA); + assertInstanceOf($noPackage, Association); + assertEquals('AssociationWithNoPackage', $noPackage.name); + assertEquals('Root', $noPackage.package->toOne().name); + assertFalse($noPackage.package->toOne().children->contains($noPackage)); +} + +function <> meta::pure::functions::meta::tests::newAssociation::testNewAssociationElementToPath():Boolean[1] +{ + let classA = newClass('test::pkg::ClassA'); + let classB = newClass('test::pkg::ClassB'); + let aToB = newProperty('aToB', ^GenericType(rawType=$classA), ^GenericType(rawType=$classB), ZeroMany); + let bToA = newProperty('bToA', ^GenericType(rawType=$classB), ^GenericType(rawType=$classA), ZeroMany); + + let myAssociation = newAssociation('test::pkg::MyAssociation', $aToB, $bToA); + assertEquals('test::pkg::MyAssociation', $myAssociation->elementToPath()); + assertEquals('Root::test::pkg::MyAssociation', $myAssociation->elementToPath(true)); + + let otherAssociation = newAssociation('pkg1::pkg2::pkg3::OtherAssociation', $aToB, $bToA); + assertEquals('pkg1::pkg2::pkg3::OtherAssociation', $otherAssociation->elementToPath()); + assertEquals('Root::pkg1::pkg2::pkg3::OtherAssociation', $otherAssociation->elementToPath(true)); + + let noPackage = newAssociation('AssociationWithNoPackage', $aToB, $bToA); + assertEquals('AssociationWithNoPackage', $noPackage->elementToPath()); + assertEquals('Root::AssociationWithNoPackage', $noPackage->elementToPath(true)); +} + +function <> meta::pure::functions::meta::tests::newAssociation::testNewAssociationElementPath():Boolean[1] +{ + let classA = newClass('test::pkg::ClassA'); + let classB = newClass('test::pkg::ClassB'); + let aToB = newProperty('aToB', ^GenericType(rawType=$classA), ^GenericType(rawType=$classB), ZeroMany); + let bToA = newProperty('bToA', ^GenericType(rawType=$classB), ^GenericType(rawType=$classA), ZeroMany); + + let myAssociation = newAssociation('pkg1::pkg2::pkg3::MyAssociation', $aToB, $bToA); + let pkg3 = $myAssociation.package->toOne(); + let pkg2 = $pkg3.package->toOne(); + let pkg1 = $pkg2.package->toOne(); + let rootPkg = $pkg1.package->toOne(); + assertEquals([$rootPkg, $pkg1, $pkg2, $pkg3, $myAssociation], $myAssociation->elementPath()); + + let noPackage = newAssociation('AssociationWithNoPackage', $aToB, $bToA); + assertEquals([$noPackage.package->toOne(), $noPackage], $noPackage->elementPath()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newClass.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newClass.pure new file mode 100644 index 00000000000..fe8c728283e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newClass.pure @@ -0,0 +1,76 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newClass(name:String[1]):Class[1]; + + + + +function <> meta::pure::functions::meta::tests::newClass::testNewClass():Boolean[1] +{ + let myClass = newClass('pkg1::pkg2::pkg3::MyClass'); + assertInstanceOf($myClass, Class); + assertEquals('MyClass', $myClass.name); + + let pkg3 = $myClass.package->toOne(); + assertInstanceOf($pkg3, Package); + assertEquals('pkg3', $pkg3.name); + assertFalse($pkg3.children->contains($myClass)); + + let pkg2 = $pkg3.package->toOne(); + assertInstanceOf($pkg2, Package); + assertEquals('pkg2', $pkg2.name); + + let pkg1 = $pkg2.package->toOne(); + assertInstanceOf($pkg1, Package); + assertEquals('pkg1', $pkg1.name); + + let rootPkg = $pkg1.package->toOne(); + assertInstanceOf($rootPkg, Package); + assertEquals('Root', $rootPkg.name); + + let noPackage = newClass('ClassWithNoPackage'); + assertInstanceOf($noPackage, Class); + assertEquals('ClassWithNoPackage', $noPackage.name); + assertEquals('Root', $noPackage.package->toOne().name); + assertFalse($noPackage.package->toOne().children->contains($noPackage)); +} + +function <> meta::pure::functions::meta::tests::newClass::testNewClassElementToPath():Boolean[1] +{ + let myClass = newClass('test::pkg::MyClass'); + assertEquals('test::pkg::MyClass', $myClass->elementToPath()); + assertEquals('Root::test::pkg::MyClass', $myClass->elementToPath(true)); + + let otherClass = newClass('pkg1::pkg2::pkg3::OtherClass'); + assertEquals('pkg1::pkg2::pkg3::OtherClass', $otherClass->elementToPath()); + assertEquals('Root::pkg1::pkg2::pkg3::OtherClass', $otherClass->elementToPath(true)); + + let noPackage = newClass('ClassWithNoPackage'); + assertEquals('ClassWithNoPackage', $noPackage->elementToPath()); + assertEquals('Root::ClassWithNoPackage', $noPackage->elementToPath(true)); +} + +function <> meta::pure::functions::meta::tests::newClass::testNewClassElementPath():Boolean[1] +{ + let myClass = newClass('pkg1::pkg2::pkg3::MyClass'); + let pkg3 = $myClass.package->toOne(); + let pkg2 = $pkg3.package->toOne(); + let pkg1 = $pkg2.package->toOne(); + let rootPkg = $pkg1.package->toOne(); + assertEquals([$rootPkg, $pkg1, $pkg2, $pkg3, $myClass], $myClass->elementPath()); + + let noPackage = newClass('ClassWithNoPackage'); + assertEquals([$noPackage.package->toOne(), $noPackage], $noPackage->elementPath()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newEnumeration.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newEnumeration.pure new file mode 100644 index 00000000000..698f8c4e33b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newEnumeration.pure @@ -0,0 +1,78 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newEnumeration(name:String[1], values:String[*]):Enumeration[1]; + + + + +function <> meta::pure::functions::meta::tests::newEnumeration::testNewEnumeration():Boolean[1] +{ + let myEnumeration = newEnumeration('pkg1::pkg2::pkg3::MyEnumeration', ['val1', 'val2']); + assertInstanceOf($myEnumeration, Enumeration); + assertEquals('MyEnumeration', $myEnumeration->cast(@ModelElement).name); + + let pkg3 = $myEnumeration->cast(@PackageableElement).package->toOne(); + assertInstanceOf($pkg3, Package); + assertEquals('pkg3', $pkg3.name); + assertFalse($pkg3.children->contains($myEnumeration)); + + let pkg2 = $pkg3.package->toOne(); + assertInstanceOf($pkg2, Package); + assertEquals('pkg2', $pkg2.name); + + let pkg1 = $pkg2.package->toOne(); + assertInstanceOf($pkg1, Package); + assertEquals('pkg1', $pkg1.name); + + let rootPkg = $pkg1.package->toOne(); + assertInstanceOf($rootPkg, Package); + assertEquals('Root', $rootPkg.name); + + let noPackage = newEnumeration('EnumerationWithNoPackage', ['val3']); + let noPackagePkg = $noPackage->cast(@PackageableElement).package->toOne(); + assertInstanceOf($noPackage, Enumeration); + assertEquals('EnumerationWithNoPackage', $noPackage->cast(@ModelElement).name); + assertEquals('Root', $noPackagePkg.name); + assertFalse($noPackagePkg.children->contains($noPackage)); +} + +function <> meta::pure::functions::meta::tests::newEnumeration::testNewEnumerationElementToPath():Boolean[1] +{ + let myEnumeration = newEnumeration('test::pkg::MyEnumeration', ['val1', 'val2']); + assertEquals('test::pkg::MyEnumeration', $myEnumeration->elementToPath()); + assertEquals('Root::test::pkg::MyEnumeration', $myEnumeration->elementToPath(true)); + + let otherEnumeration = newEnumeration('pkg1::pkg2::pkg3::OtherEnumeration', ['val3', 'val4']); + assertEquals('pkg1::pkg2::pkg3::OtherEnumeration', $otherEnumeration->elementToPath()); + assertEquals('Root::pkg1::pkg2::pkg3::OtherEnumeration', $otherEnumeration->elementToPath(true)); + + let noPackage = newEnumeration('EnumerationWithNoPackage', ['val5']); + assertEquals('EnumerationWithNoPackage', $noPackage->elementToPath()); + assertEquals('Root::EnumerationWithNoPackage', $noPackage->elementToPath(true)); +} + +function <> meta::pure::functions::meta::tests::newEnumeration::testNewEnumerationElementPath():Boolean[1] +{ + let myEnumeration = newEnumeration('pkg1::pkg2::pkg3::MyEnumeration', ['val1', 'val2']); + let pkg3 = $myEnumeration->cast(@PackageableElement).package->toOne(); + let pkg2 = $pkg3.package->toOne(); + let pkg1 = $pkg2.package->toOne(); + let rootPkg = $pkg1.package->toOne(); + assertEquals([$rootPkg, $pkg1, $pkg2, $pkg3, $myEnumeration], $myEnumeration->elementPath()); + + let noPackage = newEnumeration('EnumerationWithNoPackage', ['val3']); + let noPackagePkg = $noPackage->cast(@PackageableElement).package->toOne(); + assertEquals([$noPackagePkg, $noPackage], $noPackage->elementPath()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newLambdaFunction.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newLambdaFunction.pure new file mode 100644 index 00000000000..91bd32a9c89 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newLambdaFunction.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newLambdaFunction(functionType:FunctionType[1]):LambdaFunction[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newProperty.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newProperty.pure new file mode 100644 index 00000000000..197ed39c4a3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newProperty.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newProperty(name:String[1], owner:GenericType[1], target:GenericType[1], multiplicity:Multiplicity[1]):Property[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newQualifiedProperty.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newQualifiedProperty.pure new file mode 100644 index 00000000000..0dee60a2b4f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/create/newQualifiedProperty.pure @@ -0,0 +1,15 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::newQualifiedProperty(name:String[1], owner:GenericType[1], target:GenericType[1], multiplicity:Multiplicity[1], parameters:VariableExpression[*]):QualifiedProperty[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/get.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/get.pure new file mode 100644 index 00000000000..290276b1e1e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/get.pure @@ -0,0 +1,38 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::functions::collection::tests::model::*; + +native function meta::pure::functions::collection::get(set:T[*], key:String[1]):T[0..1]; + +function <> meta::pure::functions::collection::tests::get::testGet():Boolean[1] +{ + let p = ^CO_NPerson(firstName='Kevin', + lastName='RoeDoe', + locations=[^CO_Location a(place='Jersey City, NJ'), + ^CO_Location(place='Philadelphia, PA'), + ^CO_Location atx(place='Austin, TX')]); + assertEquals('Austin, TX', $p.locations->get('atx')->toOne().place); +} + +function <> meta::pure::functions::collection::tests::get::testGetWithVariable():Boolean[1] +{ + let p = ^CO_NPerson(firstName='Kevin', + lastName='RoeDoe', + locations=[^CO_Location jcnj(place='Jersey City, NJ'), + ^CO_Location(place='Philadelphia, PA'), + ^CO_Location atx(place='Austin, TX')]); + let key = 'atx'; + assertEquals('Austin, TX', $p.locations->get($key)->toOne().place); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/getAllPackageableElements.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/getAllPackageableElements.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/getAllPackageableElements.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/getAllPackageableElements.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/hasStereotype.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/hasStereotype.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/hasStereotype.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/hasStereotype.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/source/isSourceReadOnly.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/source/isSourceReadOnly.pure new file mode 100644 index 00000000000..947937fb192 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/source/isSourceReadOnly.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::isSourceReadOnly(node:String[1]):Boolean[1]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/class/classPropertyByName.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/class/classPropertyByName.pure new file mode 100644 index 00000000000..a85ce76c2ee --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/class/classPropertyByName.pure @@ -0,0 +1,35 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::pure::functions::meta::tests::model::*; + +function + {doc.doc = 'Get the property with the given name from the given class. Note that this searches only properties defined directly on the class, not those inherited from super-classes or those which come from associations.'} + meta::pure::functions::meta::classPropertyByName(class:Class[1], name:String[1]):Property[0..1] +{ + $class.properties->filter(p | $p.name == $name)->first() +} + +function <> meta::pure::functions::meta::tests::properties::testClassPropertyByName():Boolean[1] +{ + assertEmpty(CC_EntityWithAddress->classPropertyByName('unknownProperty')); + assertNotEmpty(CC_EntityWithAddress->classPropertyByName('address')); + assertIs(CC_EntityWithAddress.properties->at(0), CC_EntityWithAddress->classPropertyByName('address')->toOne()); + assertEmpty(CC_EntityWithAddress->classPropertyByName('firstName')); + + assertEmpty(CC_Person->classPropertyByName('unknownProperty')); + assertEmpty(CC_Person->classPropertyByName('address')); + assertNotEmpty(CC_Person->classPropertyByName('firstName')); + assertIs(CC_Person.properties->filter(p | $p.name == 'firstName')->toOne(), CC_Person->classPropertyByName('firstName')->toOne()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/functionDescriptorToId.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/functionDescriptorToId.pure new file mode 100644 index 00000000000..ce8ff523b5d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/functionDescriptorToId.pure @@ -0,0 +1,51 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::functionDescriptorToId(functionDescriptor:String[1]):String[1]; + +function <> meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToId():Boolean[1] +{ + assertEquals( + 'meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToId__Boolean_1_', + 'meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToId():Boolean[1]'->functionDescriptorToId()); + assertEquals( + 'meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToId__Boolean_1_', + 'meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToId( ) : Boolean[1..1]'->functionDescriptorToId()); + assertEquals( + 'meta::pure::functions::meta::pathToElement_String_1__PackageableElement_1_', + 'meta::pure::functions::meta::pathToElement(String[1]):PackageableElement[1]'->functionDescriptorToId()); +} + +function <> meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToIdWithTypeArguments():Boolean[1] +{ + assertEquals( + 'meta::pure::functions::collection::removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_', + 'meta::pure::functions::collection::removeDuplicates(T[*], Function<{T[1]->V[1]}>[0..1], Function<{V[1], V[1]->Boolean[1]}>[0..1]):T[*]'->functionDescriptorToId()); + assertEquals( + 'meta::pure::functions::collection::removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_', + 'meta::pure::functions::collection::removeDuplicates(T[*],Function<{T[1..1] -> V[1]}>[0..1],Function<{V[1], V[1] -> Boolean[1]}>[0..1]) : T[0..*]'->functionDescriptorToId()); + assertEquals( + 'meta::pure::functions::collection::removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_', + 'meta::pure::functions::collection::removeDuplicates(T[*],Function[0..1],Function[0..1]):T[*]'->functionDescriptorToId()); +} + +function <> meta::pure::functions::meta::tests::functionDescriptorToId::testFunctionDescriptorToIdWithUnits():Boolean[1] +{ + assertEquals( + 'my::test::testUnits_Mass~Kilogram_1__Mass~Kilogram_1_', + 'my::test::testUnits(Mass~Kilogram[1]):Mass~Kilogram[1]'->functionDescriptorToId()); + assertEquals( + 'my::test::testUnits_Mass~Kilogram_1__Mass~Kilogram_1_', + 'my::test::testUnits( Mass ~ Kilogram [1..1] ) : Mass~Kilogram[1]'->functionDescriptorToId()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/isValidFunctionDescriptor.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/isValidFunctionDescriptor.pure new file mode 100644 index 00000000000..16f2262ddd3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/type/function/isValidFunctionDescriptor.pure @@ -0,0 +1,31 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::meta::isValidFunctionDescriptor(functionDescriptor:String[1]):Boolean[1]; + +function <> meta::pure::functions::meta::tests::isValidFunctionDescriptor::testIsValidFunctionDescriptor():Boolean[1] +{ + assert('meta::pure::functions::meta::tests::functionDescriptorToId():Boolean[1]'->isValidFunctionDescriptor()); + assert('meta::pure::functions::collection::removeDuplicates(T[*], Function<{T[1]->V[1]}>[0..1], Function<{V[1], V[1]->Boolean[1]}>[0..1]):T[*]'->isValidFunctionDescriptor()); + assert('meta::pure::functions::collection::removeDuplicates(T[*], Function[0..1], Function[0..1]):T[*]'->isValidFunctionDescriptor()); + assert('meta::pure::functions::collection::removeDuplicates(T[*],Function[0..1],Function[0..1]):T[0..*]'->isValidFunctionDescriptor()); + assert('meta::pure::functions::meta::pathToElement(String[1]):PackageableElement[1]'->isValidFunctionDescriptor()); + assert('my::test::testUnits(Mass~Kilogram[1]):Mass~Kilogram[1]'->isValidFunctionDescriptor()); + + assertFalse(''->isValidFunctionDescriptor()); + assertFalse('the quick brown fox jumps over the lazy dog'->isValidFunctionDescriptor()); + assertFalse('meta::pure::functions::meta::pathToElement(path:String[1]):PackageableElement[1]'->isValidFunctionDescriptor()); + assertFalse('meta::pure::functions::meta::pathToElement(String[[1]]):PackageableElement[1]'->isValidFunctionDescriptor()); + assertFalse('meta::pure::functions::meta::pathToElement(String[*..*]):PackageableElement[1]'->isValidFunctionDescriptor()); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/value4Tag.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/value4Tag.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/meta/value4Tag.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/meta/value4Tag.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/edgePointPropertyName.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/edgePointPropertyName.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/edgePointPropertyName.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/edgePointPropertyName.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/getMilestonedGeneratedQualifiedPropertiesForEdgePointProperty.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/getMilestonedGeneratedQualifiedPropertiesForEdgePointProperty.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/getMilestonedGeneratedQualifiedPropertiesForEdgePointProperty.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/getMilestonedGeneratedQualifiedPropertiesForEdgePointProperty.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/hasGeneratedMilestoningDatePropertyStereotype.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/hasGeneratedMilestoningDatePropertyStereotype.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/hasGeneratedMilestoningDatePropertyStereotype.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/hasGeneratedMilestoningDatePropertyStereotype.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/hasGeneratedMilestoningPropertyStereotype.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/hasGeneratedMilestoningPropertyStereotype.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/hasGeneratedMilestoningPropertyStereotype.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/hasGeneratedMilestoningPropertyStereotype.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/isEdgePointProperty.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/isEdgePointProperty.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/isEdgePointProperty.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/isEdgePointProperty.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/originalPropertyNameForEdgePointProperty.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/originalPropertyNameForEdgePointProperty.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/originalPropertyNameForEdgePointProperty.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/originalPropertyNameForEdgePointProperty.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/reverseMilestoningTransforms.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/reverseMilestoningTransforms.pure similarity index 100% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-functions/src/main/resources/core_functions/milestoning/reverseMilestoningTransforms.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/milestoning/reverseMilestoningTransforms.pure diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/profile.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/profile.pure new file mode 100644 index 00000000000..e6df008ad3b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/profile.pure @@ -0,0 +1,21 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +Class meta::pure::functions::tools::ProfileResult +{ + report : String[1]; + result : T[m]; +} + +native function meta::pure::functions::tools::profile(e:T[m], printTime:Boolean[1]):ProfileResult[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/currentUserId.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/currentUserId.pure new file mode 100644 index 00000000000..6ace373b571 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/currentUserId.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function <> meta::core::runtime::currentUserId():String[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/generateGuid.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/generateGuid.pure new file mode 100644 index 00000000000..7f4a4c214ec --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/generateGuid.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::core::runtime::generateGuid():String[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/isOptionSet.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/isOptionSet.pure new file mode 100644 index 00000000000..7f07c8954f8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/runtime/isOptionSet.pure @@ -0,0 +1,15 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::core::runtime::isOptionSet(option:String[1]):Boolean[1]; diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/ascii.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/ascii.pure new file mode 100644 index 00000000000..13edfbd8aed --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/ascii.pure @@ -0,0 +1,22 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::ascii(source:String[1]):Integer[1]; + +function <> {test.excludePlatform = 'Java compiled'} meta::pure::functions::string::tests::ascii::testSimpleAscii():Boolean[1] +{ + assertEquals(0, ascii('')); + assertEquals(32, ascii(' ')); + assertEquals(97, ascii('abc')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/tests/math/testVariance.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/char.pure similarity index 70% rename from legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/tests/math/testVariance.pure rename to legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/char.pure index cb091f468ce..ef90db7d73e 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/corefunctions/tests/math/testVariance.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/ascii/char.pure @@ -12,13 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import meta::pure::profiles::*; +native function meta::pure::functions::string::char(source:Integer[1]):String[1]; -function <> {test.excludePlatform = 'Java compiled'} meta::pure::functions::math::tests::variance::testVariance():Boolean[1] +function <> {test.excludePlatform = 'Java compiled'} meta::pure::functions::string::tests::char::testSimpleChar():Boolean[1] { - assertEq(1.0, varianceSample([1.0,2.0,3.0])); - assertEq(4.0, varianceSample([2,4,6])); - - assertEq(0.25, variancePopulation([1,2])); - assertEq(1.0, variancePopulation([2,4])); + assertEquals(' ', char(32)); + assertEquals('a', char(97)); } \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeBase64.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeBase64.pure new file mode 100644 index 00000000000..c19c7fadbee --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeBase64.pure @@ -0,0 +1,28 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::decodeBase64(string:String[1]):String[1]; + +function <> meta::pure::functions::string::tests::base64::testBase64Decoding():Boolean[1] +{ + assertEquals('Hello, World!', 'SGVsbG8sIFdvcmxkIQ'->decodeBase64()); + assertEquals('Hello, World!', 'SGVsbG8sIFdvcmxkIQ='->decodeBase64()); + assertEquals('Hello, World!', 'SGVsbG8sIFdvcmxkIQ=='->decodeBase64()); +} + +function <> meta::pure::functions::string::tests::base64::testBase64RoundTrip():Boolean[1] +{ + let str = 'Any Random String'; + assertEquals($str, $str->encodeBase64()->decodeBase64()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeUrl.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeUrl.pure new file mode 100644 index 00000000000..a093315393d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/decodeUrl.pure @@ -0,0 +1,35 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::decodeUrl(string:String[1], charset:String[1]):String[1]; + +function meta::pure::functions::string::decodeUrl(string:String[1]):String[1] +{ + decodeUrl($string, 'UTF-8'); +} + +function <> meta::pure::functions::string::tests::url::testUrlDecoding():Boolean[1] +{ + assertEquals('abc,xyz % +', 'abc%2Cxyz+%25+%2B'->decodeUrl()); +} + +function <> meta::pure::functions::string::tests::url::testUrlDecodingWithNonDefaultCharset():Boolean[1] +{ + assertEquals('abc,xyz % +', 'abc%2Cxyz+%25+%2B'->decodeUrl('ascii')); +} + +function <> meta::pure::functions::string::tests::url::testUrlEncodingDecodingRoundtrip():Boolean[1] +{ + assertEquals('abc,xyz % +', 'abc,xyz % +'->encodeUrl()->decodeUrl()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeBase64.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeBase64.pure new file mode 100644 index 00000000000..e659a4e02f8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeBase64.pure @@ -0,0 +1,20 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::encodeBase64(string:String[1]):String[1]; + +function <> meta::pure::functions::string::tests::base64::testBase64Encoding():Boolean[1] +{ + assertEquals('SGVsbG8sIFdvcmxkIQ', 'Hello, World!'->encodeBase64()); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeUrl.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeUrl.pure new file mode 100644 index 00000000000..e5a2685b983 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/codec/encodeUrl.pure @@ -0,0 +1,30 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::encodeUrl(string:String[1], charset:String[1]):String[1]; + +function meta::pure::functions::string::encodeUrl(string:String[1]):String[1] +{ + encodeUrl($string, 'UTF-8'); +} + +function <> meta::pure::functions::string::tests::url::testUrlEncoding():Boolean[1] +{ + assertEquals('abc%2Cxyz+%25+%2B', 'abc,xyz % +'->encodeUrl()); +} + +function <> meta::pure::functions::string::tests::url::testUrlEncodingWithNonDefaultCharset():Boolean[1] +{ + assertEquals('abc%2Cxyz+%25+%2B', 'abc,xyz % +'->encodeUrl('ascii')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/regex/matches.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/regex/matches.pure new file mode 100644 index 00000000000..cd94d9635d0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/regex/matches.pure @@ -0,0 +1,22 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::matches(string:String[1], regexp:String[1]):Boolean[1]; + +function <> meta::pure::functions::string::tests::matches::testMatches():Boolean[1] +{ + assert('hello'->matches('hello')); + assert('abc'->matches('[a-z][a-z][a-z]')); + assertFalse('abc'->matches('[a-z][a-z][a-z][a-z]')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/jaroWinklerSimilarity.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/jaroWinklerSimilarity.pure new file mode 100644 index 00000000000..8feaa048a97 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/jaroWinklerSimilarity.pure @@ -0,0 +1,21 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::jaroWinklerSimilarity(str1:String[1], str2:String[1]):Float[1]; + +function <> meta::pure::functions::string::tests::jaroWinklerSimilarity::testSimple():Boolean[1] +{ + assertEquals(0.88, jaroWinklerSimilarity('John Smith', 'Jane Smith')); + assertEquals(1.0, jaroWinklerSimilarity('John Smith', 'John Smith')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/levenshteinDistance.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/levenshteinDistance.pure new file mode 100644 index 00000000000..921d3df1ca5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/similarity/levenshteinDistance.pure @@ -0,0 +1,21 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::levenshteinDistance(str1:String[1], str2:String[1]):Integer[1]; + +function <> meta::pure::functions::string::tests::levenshteinDistance::testSimple():Boolean[1] +{ + assertEquals(3, levenshteinDistance('John Smith', 'Jane Smith')); + assertEquals(0, levenshteinDistance('John Smith', 'John Smith')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/split/chunk.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/split/chunk.pure new file mode 100644 index 00000000000..13cffd95936 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/string/split/chunk.pure @@ -0,0 +1,25 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::pure::functions::string::chunk(source:String[1], val:Integer[1]):String[*]; + +function <> meta::pure::functions::string::tests::chunk::testSimpleChunk():Boolean[1] +{ + assertEquals('abcde|fghij|klmno|p', 'abcdefghijklmnop'->chunk(5)->joinStrings('|')); +} + +function <> meta::pure::functions::string::tests::chunk::testSmallChunk():Boolean[1] +{ + assertEquals('abc', 'abc'->chunk(5)->joinStrings('|')); +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/test.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/test.pure new file mode 100644 index 00000000000..caeefeb46af --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/test.pure @@ -0,0 +1,19 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +native function meta::alloy::test::mayExecuteAlloyTest(f1:meta::pure::metamodel::function::Function<{String[1], String[1], String[1], Integer[1]->X[k]}>[1], + f2:meta::pure::metamodel::function::Function<{->X[k]}>[1]):X[k]; + +native function meta::legend::test::mayExecuteLegendTest(f1:meta::pure::metamodel::function::Function<{String[1], String[1], String[1], String[1], Integer[1]->X[k]}>[1], + f2:meta::pure::metamodel::function::Function<{->X[k]}>[1]):X[k]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/tracing/traceSpan.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/tracing/traceSpan.pure new file mode 100644 index 00000000000..8c02dd86041 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/tracing/traceSpan.pure @@ -0,0 +1,24 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Executes the given function inside a trace span +native function meta::pure::functions::tracing::traceSpan(func:Function<{->V[m]}>[1], name:String[1]):V[m]; + +// Executes the given function inside a trace span, and also adds the tags to the span +// Will cascade if there any errors while evaluating the lambda to retrieve tags +native function meta::pure::functions::tracing::traceSpan(func:Function<{->V[m]}>[1], name:String[1], tagsFunc:Function<{->Map[1]}>[1]):V[m]; + +// Executes the given function inside a trace span, and also adds the tags to the span. +// when 'tagsCritical' flag is set to true then errors will be cascaded if not it will be absorbed +native function meta::pure::functions::tracing::traceSpan(func:Function<{->V[m]}>[1], name:String[1], tagsFunc:Function<{->Map[1]}>[1], tagsCritical:Boolean[1]):V[m]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/vcs/versionHistory.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/vcs/versionHistory.pure new file mode 100644 index 00000000000..58b9bf5acff --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/main/resources/core_functions_unclassified/vcs/versionHistory.pure @@ -0,0 +1,42 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import meta::vcs::metamodel::*; + +Class meta::vcs::metamodel::Revision +{ + number: Integer[1]; + author: String[0..1]; + message: String[0..1]; + date: Date[0..1]; + + changedPaths: ChangedPath[*]; +} + +Class meta::vcs::metamodel::ChangedPath +{ + path: String[1]; + copyPath: String[0..1]; + changeType: ChangeType[1]; +} + +Enum meta::vcs::metamodel::ChangeType +{ + ADD, + MODIFY, + REPLACE, + DELETE +} + +native function meta::vcs::metamodel::versionHistory(source:String[*]):Revision[*]; \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/unclassified/TestFunctionsUnclassifiedCompiledStateStrategy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/unclassified/TestFunctionsUnclassifiedCompiledStateStrategy.java new file mode 100644 index 00000000000..4e261ba519b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/engine/pure/code/core/functions/unclassified/TestFunctionsUnclassifiedCompiledStateStrategy.java @@ -0,0 +1,27 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.functions.unclassified; + +import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; +import org.junit.BeforeClass; + +public class TestFunctionsUnclassifiedCompiledStateStrategy extends AbstractCompiledStateIntegrityTest +{ + @BeforeClass + public static void initialize() + { + initialize("core_functions_unclassified"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java new file mode 100644 index 00000000000..f763f110c1f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure/src/test/java/org/finos/legend/pure/code/core/tests/TestPCRReport.java @@ -0,0 +1,31 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.code.core.tests; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals(3, PCTReportProviderLoader.gatherFunctions().size()); + Assert.assertEquals("essential, grammar, unclassified", PCTReportProviderLoader.gatherFunctions().collect(c -> c.reportScope.module).distinct().sortThis().makeString(", ")); + Assert.assertEquals(0, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals("", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter).distinct().sortThis().makeString(", ")); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/pom.xml new file mode 100644 index 00000000000..aff62cf2889 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/pom.xml @@ -0,0 +1,201 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-unclassified + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + jar + Legend Pure - Runtime - Java Extension - Compiled - Functions - Base + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + true + modular + true + + core_functions_unclassified + + + + + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + Compiled + ${project.build.directory}/classes/pct-reports/ + + org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.pure.Test_Compiled_UnclassifiedFunctions_PCT + + + + + PCT-Generation + process-test-classes + + generate-pct-report + + + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + ${legend.pure.version} + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + runtime + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-shared + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + + + + org.finos.legend.engine + legend-engine-pure-platform-java + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + + io.opentracing + opentracing-api + + + io.opentracing + opentracing-util + + + + commons-codec + commons-codec + + + org.apache.commons + commons-text + + + + junit + junit + runtime + + + + org.eclipse.collections + eclipse-collections-testutils + test + + + org.slf4j + jcl-over-slf4j + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/Base_Compiled_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/Base_Compiled_PCTReportProvider.java new file mode 100644 index 00000000000..af665456d08 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/Base_Compiled_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Base_Compiled_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return Lists.mutable.empty(); + } + + @Override + public MutableList getAdapterReports() + { + return PCTReportProviderTool.load(Base_Compiled_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_unclassified_compiled_Native.json" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsExtensionCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsExtensionCompiled.java new file mode 100644 index 00000000000..ad4f7e01f3a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsExtensionCompiled.java @@ -0,0 +1,345 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License", +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled; + +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.runtime.java.compiled.compiler.StringJavaSource; +import org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.MayExecuteAlloyTest; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.MayExecuteLegendTest; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.Profile; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.cipher.Decrypt; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.cipher.Encrypt; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.collection.Get; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.collection.Repeat; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date.DayOfWeekNumber; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date.DayOfYear; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date.Now; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date.Today; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date.WeekOfYear; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.hash.Hash; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.io.ReadFile; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.io.http.Http; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.lang.MutateAdd; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.CompileValueSpecification; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.FunctionDescriptorToId; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.IsSourceReadOnly; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.IsValidFunctionDescriptor; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewAssociation; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewClass; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewEnumeration; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewLambdaFunction; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewProperty; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta.NewQualifiedProperty; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime.CurrentUserId; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime.Guid; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime.IsOptionSet; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.ASCII; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.Char; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.Chunk; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.DecodeBase64; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.DecodeUrl; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.EncodeBase64; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.EncodeUrl; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.JaroWinklerSimilarity; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.LevenshteinDistance; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string.Matches; +import org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.tracing.TraceSpan; + +import java.util.List; + +public class FunctionsExtensionCompiled implements CompiledExtension +{ + @Override + public List getExtraJavaSources() + { + return Lists.fixedSize.with(StringJavaSource.newStringJavaSource("org.finos.legend.pure.generated", "FunctionsGen", + "package org.finos.legend.pure.generated;\n" + + "\n" + + "import org.eclipse.collections.api.RichIterable;\n" + + "import org.eclipse.collections.api.factory.Lists;\n" + + "import org.eclipse.collections.api.list.ListIterable;\n" + + "import org.eclipse.collections.api.list.MutableList;\n" + + "import org.eclipse.collections.impl.list.mutable.FastList;\n" + + "import org.finos.legend.pure.m3.coreinstance.Package;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.ConcreteFunctionDefinition;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any;\n" + + "import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enum;\n" + + "import org.finos.legend.pure.m3.exception.PureExecutionException;\n" + + "import org.finos.legend.pure.m3.execution.ExecutionSupport;\n" + + "import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\n" + + "import org.finos.legend.pure.m4.coreinstance.SourceInformation;\n" + + "import org.finos.legend.pure.runtime.java.compiled.delta.CodeBlockDeltaCompiler;\n" + + "import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.Pure;\n" + + "import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.DefendedFunction;\n" + + "import org.finos.legend.pure.runtime.java.compiled.metadata.MetadataAccessor;\n" + + "import org.finos.legend.pure.runtime.java.shared.http.HttpMethod;\n" + + "import org.finos.legend.pure.runtime.java.shared.http.HttpRawHelper;\n" + + "import org.finos.legend.pure.runtime.java.shared.http.URLScheme;\n" + + "\n" + + "public class FunctionsGen extends org.finos.legend.pure.runtime.java.extension.functions.compiled.FunctionsHelper\n" + + "{\n" + + " public static Root_meta_pure_functions_io_http_HTTPResponse executeHttpRaw(Root_meta_pure_functions_io_http_URL url, Object method, String mimeType, String body, ExecutionSupport executionSupport)\n" + + " {\n" + + " URLScheme scheme = URLScheme.http;\n" + + " if (url._scheme() != null)\n" + + " {\n" + + " scheme = URLScheme.valueOf(url._scheme()._name());\n" + + " }\n" + + " return (Root_meta_pure_functions_io_http_HTTPResponse) HttpRawHelper.toHttpResponseInstance(HttpRawHelper.executeHttpService(scheme, url._host(), (int) url._port(), url._path(), HttpMethod.valueOf(((Enum) method)._name()), mimeType, body), ((CompiledExecutionSupport) executionSupport).getProcessorSupport());\n" + + " }\n" + + "\n" + + " public static Root_meta_pure_functions_meta_CompilationResult compileCodeBlock(String source, ExecutionSupport es)\n" + + " {\n" + + " Root_meta_pure_functions_meta_CompilationResult result = null;\n" + + " if (source != null)\n" + + " {\n" + + " CodeBlockDeltaCompiler.CompilationResult compilationResult = CodeBlockDeltaCompiler.compileCodeBlock(source, ((CompiledExecutionSupport) es));\n" + + " result = convertCompilationResult(compilationResult);\n" + + " }\n" + + " return result;\n" + + " }\n" + + "\n" + + " public static RichIterable compileCodeBlocks(RichIterable sources, ExecutionSupport es)\n" + + " {\n" + + " RichIterable compilationResults = CodeBlockDeltaCompiler.compileCodeBlocks(sources, ((CompiledExecutionSupport) es));\n" + + " MutableList results = FastList.newList(sources.size());\n" + + "\n" + + " for (CodeBlockDeltaCompiler.CompilationResult compilationResult : compilationResults)\n" + + " {\n" + + " results.add(convertCompilationResult(compilationResult));\n" + + " }\n" + + " return results;\n" + + " }\n" + + "\n" + + "\n" + + " private static Root_meta_pure_functions_meta_CompilationResult convertCompilationResult(CodeBlockDeltaCompiler.CompilationResult compilationResult)\n" + + " {\n" + + " Root_meta_pure_functions_meta_CompilationResult result = new Root_meta_pure_functions_meta_CompilationResult_Impl(\"\");\n" + + "\n" + + " if (compilationResult.getFailureMessage() != null)\n" + + " {\n" + + " Root_meta_pure_functions_meta_CompilationFailure failure = new Root_meta_pure_functions_meta_CompilationFailure_Impl(\"\");\n" + + " failure._message(compilationResult.getFailureMessage());\n" + + "\n" + + " SourceInformation si = compilationResult.getFailureSourceInformation();\n" + + "\n" + + " if (si != null)\n" + + " {\n" + + " Root_meta_pure_functions_meta_SourceInformation sourceInformation = new Root_meta_pure_functions_meta_SourceInformation_Impl(\"\");\n" + + " sourceInformation._column(si.getColumn());\n" + + " sourceInformation._line(si.getLine());\n" + + " sourceInformation._endColumn(si.getEndColumn());\n" + + " sourceInformation._endLine(si.getEndLine());\n" + + " sourceInformation._startColumn(si.getStartColumn());\n" + + " sourceInformation._startLine(si.getStartLine());\n" + + " failure._sourceInformation(sourceInformation);\n" + + " }\n" + + " result._failure(failure);\n" + + " }\n" + + " else\n" + + " {\n" + + " ConcreteFunctionDefinition cfd = (ConcreteFunctionDefinition) compilationResult.getResult();\n" + + " result._result(cfd._expressionSequence().getFirst());\n" + + " }\n" + + " return result;\n" + + " }\n" + + "\n" + + " public static Object alloyTest(ExecutionSupport es, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function alloyTest, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function regular)\n" + + " {\n" + + " return alloyTest(es, alloyTest, regular, CoreGen.bridge);\n" + + " }\n" + + "\n" + + " public static Object legendTest(ExecutionSupport es, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function alloyTest, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function regular)\n" + + " {\n" + + " return legendTest(es, alloyTest, regular, CoreGen.bridge);\n" + + " }\n" + + "\n" + + " public static org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class newClass(String fullPathString, MetadataAccessor ma, SourceInformation si)\n" + + " {\n" + + " ListIterable fullPath = PackageableElement.splitUserPath(fullPathString);\n" + + " if (fullPath.isEmpty())\n" + + " {\n" + + " throw new PureExecutionException(null, \"Cannot create a new Class: '\" + fullPathString + \"'\");\n" + + " }\n" + + " String name = fullPath.getLast();\n" + + " org.finos.legend.pure.m3.coreinstance.Package _package = Pure.buildPackageIfNonExistent(new Package_Impl(\"Root\")._name(\"Root\"), fullPath.subList(0, fullPath.size() - 1), si, new DefendedFunction()\n" + + " {\n" + + " @Override\n" + + " public Package valueOf(String s)\n" + + " {\n" + + " return new Package_Impl(s);\n" + + " }\n" + + " });\n" + + " org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class _class = new Root_meta_pure_metamodel_type_Class_Impl(name)._name(name)._package(_package);\n" + + " return _class._classifierGenericType(\n" + + " new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")\n" + + " ._rawType(ma.getClass(\"Root::meta::pure::metamodel::type::Class\"))\n" + + " ._typeArguments(Lists.immutable.of(new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")._rawType(_class))))\n" + + " ._generalizations(Lists.immutable.of(\n" + + " new Root_meta_pure_metamodel_relationship_Generalization_Impl(\"Anonymous_StripedId\")\n" + + " ._general(new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")._rawType(ma.getTopType()))\n" + + " ._specific(_class)));\n" + + " }\n" + + "\n" + + " public static org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association newAssociation(String fullPathString, Property p1, Property p2, MetadataAccessor ma, SourceInformation si)\n" + + " {\n" + + " ListIterable fullPath = PackageableElement.splitUserPath(fullPathString);\n" + + " if (fullPath.isEmpty())\n" + + " {\n" + + " throw new PureExecutionException(null, \"Cannot create a new Association: '\" + fullPathString + \"'\");\n" + + " }\n" + + " String name = fullPath.getLast();\n" + + " org.finos.legend.pure.m3.coreinstance.Package _package = Pure.buildPackageIfNonExistent(new Package_Impl(\"Root\")._name(\"Root\"), fullPath.subList(0, fullPath.size() - 1), si, new DefendedFunction()\n" + + " {\n" + + " @Override\n" + + " public Package valueOf(String s)\n" + + " {\n" + + " return new Package_Impl(s);\n" + + " }\n" + + " });\n" + + " org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association _association = new Root_meta_pure_metamodel_relationship_Association_Impl(name)._name(name)._package(_package);\n" + + " return _association._propertiesAdd(p1)._propertiesAdd(p2)._classifierGenericType(\n" + + " new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")\n" + + " ._rawType(ma.getClass(\"Root::meta::pure::metamodel::relationship::Association\")));\n" + + " }\n" + + "\n" + + " public static org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration newEnumeration(final String fullPathString, RichIterable values, MetadataAccessor ma, SourceInformation si)\n" + + " {\n" + + " ListIterable fullPath = PackageableElement.splitUserPath(fullPathString);\n" + + " if (fullPath.isEmpty())\n" + + " {\n" + + " throw new PureExecutionException(null, \"Cannot create a new Enumeration: '\" + fullPathString + \"'\");\n" + + " }\n" + + " String name = fullPath.getLast();\n" + + " String packageName = fullPath.subList(0, fullPath.size() - 1).makeString(\"::\");\n" + + " org.finos.legend.pure.m3.coreinstance.Package _package = Pure.buildPackageIfNonExistent(new Package_Impl(\"Root\")._name(\"Root\"), fullPath.subList(0, fullPath.size() - 1), si, new DefendedFunction()\n" + + " {\n" + + " @Override\n" + + " public Package valueOf(String s)\n" + + " {\n" + + " return new Package_Impl(s);\n" + + " }\n" + + " });\n" + + " org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enumeration _enumeration = new Root_meta_pure_metamodel_type_Enumeration_Impl(name)._name(name)._package(_package);\n" + + " return _enumeration._classifierGenericType(\n" + + " new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")\n" + + " ._rawType(ma.getClass(\"Root::meta::pure::metamodel::type::Enumeration\"))\n" + + " ._typeArguments(Lists.immutable.of(new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")._rawType(_enumeration))))\n" + + " ._generalizations(Lists.immutable.of(\n" + + " new Root_meta_pure_metamodel_relationship_Generalization_Impl(\"Anonymous_StripedId\")\n" + + " ._general(new Root_meta_pure_metamodel_type_generics_GenericType_Impl(\"Anonymous_StripedId\")._rawType(ma.getClass(\"Root::meta::pure::metamodel::type::Enum\")))\n" + + " ._specific(_enumeration)))\n" + + " ._values(values.collect(new DefendedFunction()\n" + + " {\n" + + " public PureEnum valueOf(String valueName)\n" + + " {\n" + + " return new PureEnum(valueName, fullPathString);\n" + + " }\n" + + " }));\n" + + " }\n" + + "\n" + + "\n" + + " public static Object traceSpan(ExecutionSupport es, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function function, String operationName, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function funcToGetTags, boolean tagsCritical)\n" + + " {\n" + + " return FunctionsGen.traceSpan(es, function, operationName, funcToGetTags, tagsCritical, CoreGen.bridge);\n" + + " }\n" + + "}")); + } + + @Override + public List getExtraNatives() + { + return Lists.fixedSize.with( + // Cipher + new Decrypt(), + new Encrypt(), + + // Collection + new Get(), + new Repeat(), + + //Date + new DayOfWeekNumber(), + new DayOfYear(), + new Now(), + new Today(), + new WeekOfYear(), + + //Hash + new Hash(), + + //IO + new Http(), + new ReadFile(), + + //Lang + new MutateAdd(), + + // Meta + new CompileValueSpecification(), + new FunctionDescriptorToId(), + new IsSourceReadOnly(), + new IsValidFunctionDescriptor(), + new NewAssociation(), + new NewClass(), + new NewEnumeration(), + new NewLambdaFunction(), + new NewProperty(), + new NewQualifiedProperty(), + + //Runtime + new CurrentUserId(), + new IsOptionSet(), + new Guid(), + + //String + new ASCII(), + new Char(), + new Chunk(), + new DecodeBase64(), + new EncodeBase64(), + new DecodeUrl(), + new EncodeUrl(), + new Matches(), + new JaroWinklerSimilarity(), + new LevenshteinDistance(), + + //Tracing + new TraceSpan(), + + // LegendTests + new MayExecuteAlloyTest(), + new MayExecuteLegendTest(), + + //Tools + new Profile() + ); + } + + @Override + public String getRelatedRepository() + { + return "core_functions_unclassified"; + } + + public static CompiledExtension extension() + { + return new FunctionsExtensionCompiled(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsHelper.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsHelper.java new file mode 100644 index 00000000000..2ac49403740 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/FunctionsHelper.java @@ -0,0 +1,646 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled; + +import io.opentracing.Scope; +import io.opentracing.Span; +import io.opentracing.util.GlobalTracer; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.similarity.JaroWinklerSimilarity; +import org.apache.commons.text.similarity.LevenshteinDistance; +import org.eclipse.collections.api.LazyIterable; +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.HashingStrategy; +import org.eclipse.collections.api.block.predicate.Predicate; +import org.eclipse.collections.api.block.procedure.Procedure; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.factory.Maps; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.api.ordered.ReversibleIterable; +import org.eclipse.collections.api.set.MutableSet; +import org.eclipse.collections.impl.lazy.AbstractLazyIterable; +import org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy; +import org.eclipse.collections.impl.utility.Iterate; +import org.eclipse.collections.impl.utility.LazyIterate; +import org.finos.legend.pure.m3.coreinstance.meta.pure.functions.collection.TreeNode; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Profile; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Stereotype; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Tag; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Any; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Enum; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Nil; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.function.FunctionDescriptor; +import org.finos.legend.pure.m3.navigation.function.InvalidFunctionDescriptorException; +import org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.RepositoryCodeStorage; +import org.finos.legend.pure.m3.serialization.runtime.SourceRegistry; +import org.finos.legend.pure.m3.tools.StatisticsUtil; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateTime; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.m4.coreinstance.primitive.date.StrictDate; +import org.finos.legend.pure.m4.coreinstance.primitive.date.Year; +import org.finos.legend.pure.m4.coreinstance.primitive.date.YearMonth; +import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.Bridge; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.CompiledSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.Pure; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.PureEqualsHashingStrategy; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.PureMap; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; +import org.finos.legend.pure.runtime.java.extension.functions.shared.cipher.AESCipherUtil; +import org.finos.legend.pure.runtime.java.shared.hash.HashType; +import org.finos.legend.pure.runtime.java.shared.hash.HashingUtil; +import org.finos.legend.pure.runtime.java.shared.identity.IdentityManager; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.SecureRandom; +import java.time.Instant; +import java.util.Calendar; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +public class FunctionsHelper +{ + // Crypto ---------------------------------------------------------------- + public static String encrypt(String value, String key) + { + return performEncryption(value, key); + } + + public static String encrypt(Number value, String key) + { + return performEncryption(value.toString(), key); + } + + public static String encrypt(Boolean value, String key) + { + return performEncryption(value.toString(), key); + } + + private static String performEncryption(String value, String key) + { + try + { + return new String(AESCipherUtil.encrypt(key, value.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8); + } + catch (Exception e) + { + throw new PureExecutionException("Error ciphering value '" + value + "' with key '" + key + "'.", e); + } + } + + public static String decrypt(String value, String key) + { + try + { + return new String(AESCipherUtil.decrypt(key, value.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8); + } + catch (Exception e) + { + throw new PureExecutionException("Error deciphering value '" + value + "' with key '" + key + "'.", e); + } + } + // Crypto ---------------------------------------------------------------- + + + // DATE-TIME -------------------------------------------------------------- + public static StrictDate today() + { + return DateFunctions.today(); + } + + public static DateTime now() + { + return DateFunctions.fromInstant(Instant.now(), 3); + } + + public static long weekOfYear(PureDate date, SourceInformation sourceInformation) + { + if (!date.hasDay()) + { + throw new PureExecutionException(sourceInformation, "Cannot get week of year for " + date); + } + return date.getCalendar().get(Calendar.WEEK_OF_YEAR); + } + + public static long dayOfYear(PureDate date, SourceInformation sourceInformation) + { + if (!date.hasDay()) + { + throw new PureExecutionException(sourceInformation, "Cannot get day of year for " + date); + } + return date.getCalendar().get(Calendar.DAY_OF_YEAR); + } + + public static long dayOfWeekNumber(PureDate date, SourceInformation sourceInformation) + { + if (!date.hasDay()) + { + throw new PureExecutionException(sourceInformation, "Cannot get day of week for " + date); + } + switch (date.getCalendar().get(Calendar.DAY_OF_WEEK)) + { + case Calendar.MONDAY: + { + return 1; + } + case Calendar.TUESDAY: + { + return 2; + } + case Calendar.WEDNESDAY: + { + return 3; + } + case Calendar.THURSDAY: + { + return 4; + } + case Calendar.FRIDAY: + { + return 5; + } + case Calendar.SATURDAY: + { + return 6; + } + case Calendar.SUNDAY: + { + return 7; + } + default: + { + throw new PureExecutionException(sourceInformation, "Error getting day of week for " + date); + } + } + } + + // DATE-TIME -------------------------------------------------------------- + + + // COLLECTION --------------------------------------------------------------- + + /** + * Return a list consisting of element repeated n times. + * + * @param element element to repeat + * @param n number of times to repeat element + * @param element type + * @return element repeated n times + */ + public static RichIterable repeat(T element, long n) + { + if (n <= 0) + { + return Lists.immutable.empty(); + } + int num = (int) n; + MutableList elements = Lists.mutable.ofInitialCapacity(num); + for (; num > 0; num--) + { + elements.add(element); + } + return elements; + } + + public static Object get(RichIterable list, String id) + { + return list.detect(e -> id.equals(((CoreInstance) e).getName())); + } + + // COLLECTION --------------------------------------------------------------- + + + // HASH------ --------------------------------------------------------------- + public static String hash(String text, Object hashTypeObject) + { + Enum hashTypeEnum = (Enum) hashTypeObject; + HashType hashType = HashType.valueOf(hashTypeEnum._name()); + + return HashingUtil.hash(text, hashType); + } + // HASH------ --------------------------------------------------------------- + + + // META --------------------------------------------------------------------- + public static String functionDescriptorToId(String functionDescriptor, SourceInformation sourceInformation) + { + try + { + return FunctionDescriptor.functionDescriptorToId(functionDescriptor); + } + catch (InvalidFunctionDescriptorException e) + { + throw new PureExecutionException(sourceInformation, "Invalid function descriptor: " + functionDescriptor, e); + } + } + + public static boolean isValidFunctionDescriptor(String possiblyFunctionDescriptor) + { + return FunctionDescriptor.isValidFunctionDescriptor(possiblyFunctionDescriptor); + } + + public static boolean isSourceReadOnly(String sourceName, ExecutionSupport es) + { + return isSourceReadOnly(((CompiledExecutionSupport) es).getSourceRegistry(), sourceName); + } + + public static boolean isSourceReadOnly(SourceRegistry sourceRegistry, String sourceName) + { + if (sourceRegistry == null) + { + throw new RuntimeException("The source registry has not been defined... This function should probably not be used in your current environment."); + } + return sourceRegistry.getSource(sourceName).isImmutable(); + } + // META --------------------------------------------------------------------- + + + + // STRING ------------------------------------------------------------------- + public static String encodeBase64(String str) + { + return Base64.encodeBase64URLSafeString(str.getBytes()); + } + + public static String decodeBase64(String str) + { + return new String(Base64.decodeBase64(str)); + } + + public static String encodeUrl(String str, String charset) + { + try + { + return URLEncoder.encode(str, charset); + } + catch (UnsupportedEncodingException e) + { + throw new RuntimeException(e); + } + } + + public static String decodeUrl(String str, String charset) + { + try + { + return URLDecoder.decode(str, charset); + } + catch (UnsupportedEncodingException e) + { + throw new RuntimeException(e); + } + } + + public static long ascii(String str) + { + return str.length() > 0 ? (int) str.charAt(0) : 0; + } + + public static String character(Number number) + { + return String.valueOf((char) number.intValue()); + } + + + + public static boolean matches(String str, String regexp) + { + return str.matches(regexp); + } + + public static Double jaroWinklerSimilarity(String str1, String str2) + { + return new JaroWinklerSimilarity().apply(str1, str2); + } + + public static Long levenshteinDistance(String str1, String str2) + { + Integer integerValue = new LevenshteinDistance().apply(str1, str2); + if (integerValue != null) + { + return integerValue.longValue(); + } + else + { + return 0L; + } + } + + public static RichIterable chunk(String text, long size, SourceInformation sourceInformation) + { + if (size < 1) + { + throw new PureExecutionException(sourceInformation, "Invalid chunk size: " + size); + } + return chunk(text, (int) size); + } + + private static RichIterable chunk(String text, int size) + { + int length = text.length(); + if (length == 0) + { + return Lists.immutable.empty(); + } + + if (size >= length) + { + return Lists.immutable.with(text); + } + + return new AbstractLazyIterable() + { + @Override + public boolean isEmpty() + { + return false; + } + + @Override + public int size() + { + return (length + size - 1) / size; + } + + @Override + public void forEach(Consumer consumer) + { + for (int i = 0; i < length; i += size) + { + consumer.accept(text.substring(i, Math.min(i + size, length))); + } + } + + @Override + public void each(Procedure procedure) + { + forEach((Consumer) procedure); + } + + @Override + public Iterator iterator() + { + return new Iterator() + { + private int current = 0; + + @Override + public boolean hasNext() + { + return this.current < length; + } + + @Override + public String next() + { + if (!hasNext()) + { + throw new NoSuchElementException(); + } + int start = this.current; + int end = Math.min(start + size, length); + String next = text.substring(start, end); + this.current = end; + return next; + } + }; + } + }; + } + + // STRING ------------------------------------------------------------------- + + + // Runtime ------------------------------------------------------------------ + public static String currentUserId() + { + return IdentityManager.getAuthenticatedUserId(); + } + + public static boolean isOptionSet(String name, ExecutionSupport es) + { + return ((CompiledExecutionSupport) es).getRuntimeOptions().isOptionSet(name); + } + + public static String guid() + { + return UUID.randomUUID().toString(); + } + // Runtime ------------------------------------------------------------------ + + + + // IO ----------------------------------------------------------------------- + public static String readFile(String path, String lineSeparator, ExecutionSupport es) + { + RepositoryCodeStorage codeStorage = ((CompiledExecutionSupport) es).getCodeStorage(); + if (!codeStorage.exists(path)) + { + return null; + } + String content = codeStorage.getContentAsText(path); + return (lineSeparator == null) ? content : content.replaceAll("\\R", lineSeparator); + } + // IO ----------------------------------------------------------------------- + + + // Lang --------------------------------------------------------------------- + public static T mutateAdd(T val, String property, RichIterable vals, SourceInformation sourceInformation) + { + try + { + Method m = val.getClass().getMethod("_" + property); + if (m.getReturnType() == RichIterable.class) + { + RichIterable l = (RichIterable) m.invoke(val); + RichIterable newValues = Iterate.isEmpty(l) ? vals : LazyIterate.concatenate(l, vals).toList(); + + m = val.getClass().getMethod("_" + property, RichIterable.class); + m.invoke(val, newValues); + } + else + { + m = val.getClass().getMethod("_" + property, m.getReturnType()); + m.invoke(val, vals.getFirst()); + } + } + catch (NoSuchMethodException e) + { + throw new PureExecutionException(sourceInformation, "Cannot find property '" + property + "' on " + CompiledSupport.getPureGeneratedClassName(val)); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + return val; + } + // Lang --------------------------------------------------------------------- + + + + // Trace --------------------------------------------------------------------- + private static final ExecutorService traceAsyncExecutor = Executors.newCachedThreadPool(new ThreadFactory() + { + private final ThreadGroup group = System.getSecurityManager() == null + ? Thread.currentThread().getThreadGroup() + : System.getSecurityManager().getThreadGroup(); + private final AtomicInteger threadNumber = new AtomicInteger(1); + + @Override + public Thread newThread(Runnable r) + { + Thread thread = new Thread(this.group, r, "trace-async-executor-thread-" + this.threadNumber.getAndIncrement(), 0); + if (!thread.isDaemon()) + { + thread.setDaemon(true); + } + if (thread.getPriority() != Thread.NORM_PRIORITY) + { + thread.setPriority(Thread.NORM_PRIORITY); + } + return thread; + } + }); + + public static Object traceSpan(ExecutionSupport es, + org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function function, + String operationName, + org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function funcToGetTags, + boolean tagsCritical, + Bridge bridge) + { + if (!GlobalTracer.isRegistered()) + { + return Pure.evaluate(es, function, bridge, Lists.mutable.empty()); + } + + Span span = GlobalTracer.get().buildSpan(operationName).start(); + try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) + { + if ((funcToGetTags != null) && (span != null)) + { + try + { + Future future = traceAsyncExecutor.submit(() -> + { + try (Scope scope1 = GlobalTracer.get().scopeManager().activate(span)) + { + MutableMap tags = ((PureMap) Pure.evaluate(es, funcToGetTags, bridge, Lists.mutable.empty())).getMap(); + tags.forEachKeyValue((tag, value) -> span.setTag((String) tag, (String) value)); + } + }); + future.get(60, TimeUnit.SECONDS); + } + catch (TimeoutException e) + { + span.setTag("Exception", "Timeout received before tags could be resolved"); + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); + } + catch (Exception e) + { + if (tagsCritical) + { + throw (e instanceof RuntimeException) ? (RuntimeException) e : new RuntimeException(e); + } + span.setTag("Exception", "Unable to resolve tags - [" + e.getMessage() + "]"); + } + } + return Pure.evaluate(es, function, bridge, Lists.mutable.empty()); + } + finally + { + if (span != null) + { + span.finish(); + } + } + } + // Trace --------------------------------------------------------------------- + + + + public static Object alloyTest(ExecutionSupport es, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function alloyTest, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function regular, Bridge bridge) + { + String host = System.getProperty("alloy.test.server.host"); + long port = System.getProperty("alloy.test.server.port") == null ? -1 : Long.parseLong(System.getProperty("alloy.test.server.port")); + if (host != null && port == -1) + { + throw new PureExecutionException("The system variable 'alloy.test.server.host' is set to '" + host + "' however 'alloy.test.server.port' has not been set!"); + } + String clientVersion = System.getProperty("alloy.test.clientVersion"); + String serverVersion = System.getProperty("alloy.test.serverVersion"); + return host != null ? Pure.evaluate(es, alloyTest, bridge, clientVersion, serverVersion, host, port) : Pure.evaluate(es, regular, bridge); + } + + public static Object legendTest(ExecutionSupport es, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function alloyTest, org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.Function regular, Bridge bridge) + { + String host = System.getProperty("legend.test.server.host"); + long port = System.getProperty("legend.test.server.port") == null ? -1 : Long.parseLong(System.getProperty("legend.test.server.port")); + String clientVersion = System.getProperty("legend.test.clientVersion"); + String serverVersion = System.getProperty("legend.test.serverVersion"); + String serializationKind = System.getProperty("legend.test.serializationKind"); + if (host != null) + { + if (port == -1) + { + throw new PureExecutionException("The system variable 'legend.test.server.host' is set to '" + host + "' however 'legend.test.server.port' has not been set!"); + } + if (serializationKind == null || !(serializationKind.equals("text") || serializationKind.equals("json"))) + { + serializationKind = "json"; + } + if (clientVersion == null) + { + throw new PureExecutionException("The system variable 'legend.test.clientVersion' should be set"); + } + if (serverVersion == null) + { + throw new PureExecutionException("The system variable 'legend.test.serverVersion' should be set"); + } + } + return host != null ? Pure.evaluate(es, alloyTest, bridge, clientVersion, serverVersion, serializationKind, host, port) : Pure.evaluate(es, regular, bridge); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteAlloyTest.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteAlloyTest.java new file mode 100644 index 00000000000..6be7de957bd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteAlloyTest.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; + +public class MayExecuteAlloyTest extends AbstractNative +{ + public MayExecuteAlloyTest() + { + super("mayExecuteAlloyTest_Function_1__Function_1__X_k_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + ListIterable parametersValues = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorSupport); + CoreInstance functionType = Instance.getValueForMetaPropertyToOneResolved(parametersValues.get(1), M3Properties.genericType, M3Properties.typeArguments, M3Properties.rawType, processorSupport); + CoreInstance param = functionType.getValueForMetaPropertyToOne(M3Properties.returnType); + String type = TypeProcessor.typeToJavaPrimitiveWithMul(param, functionType.getValueForMetaPropertyToOne(M3Properties.returnMultiplicity), true, processorContext); + return "((" + type + ")FunctionsGen.alloyTest(es, " + transformedParams.get(0) + "," + transformedParams.get(1) + "))"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteLegendTest.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteLegendTest.java new file mode 100644 index 00000000000..314210eddb0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/MayExecuteLegendTest.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; + +public class MayExecuteLegendTest extends AbstractNative +{ + public MayExecuteLegendTest() + { + super("mayExecuteLegendTest_Function_1__Function_1__X_k_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + ListIterable parametersValues = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorSupport); + CoreInstance functionType = Instance.getValueForMetaPropertyToOneResolved(parametersValues.get(1), M3Properties.genericType, M3Properties.typeArguments, M3Properties.rawType, processorSupport); + CoreInstance param = functionType.getValueForMetaPropertyToOne(M3Properties.returnType); + String type = TypeProcessor.typeToJavaPrimitiveWithMul(param, functionType.getValueForMetaPropertyToOne(M3Properties.returnMultiplicity), true, processorContext); + return "((" + type + ")FunctionsGen.legendTest(es, " + transformedParams.get(0) + "," + transformedParams.get(1) + "))"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/Profile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/Profile.java new file mode 100644 index 00000000000..88bae14be51 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/Profile.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; + +public class Profile extends AbstractNative +{ + public Profile() + { + super("profile_T_m__Boolean_1__ProfileResult_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + ListIterable parametersValues = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorSupport); + CoreInstance param = parametersValues.get(0); + String type = TypeProcessor.typeToJavaPrimitiveSingle(Instance.getValueForMetaPropertyToOneResolved(param, M3Properties.genericType, processorSupport), processorSupport); + return "((Root_meta_pure_functions_tools_ProfileResult<" + type + ">)new LambdaZero(){public Object execute(){((CompiledExecutionSupport)es).getConsole().print(\"Profile not supported yet!\");return new Root_meta_pure_functions_tools_ProfileResult_Impl<" + type + ">(\"NOID\")._result(CompiledSupport.toPureCollection(" + transformedParams.get(0) + "))._report(\"Profile not supported yet in compiled\");}}.execute())"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Decrypt.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Decrypt.java new file mode 100644 index 00000000000..cc3fa40afa1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Decrypt.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.cipher; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Decrypt extends AbstractNativeFunctionGeneric +{ + public Decrypt() + { + super("FunctionsGen.decrypt", + new Class[]{String.class, String.class}, + "decrypt_String_1__String_1__String_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Encrypt.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Encrypt.java new file mode 100644 index 00000000000..5b98ce8c42a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/cipher/Encrypt.java @@ -0,0 +1,29 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.cipher; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Encrypt extends AbstractNativeFunctionGeneric +{ + public Encrypt() + { + super("FunctionsGen.encrypt", + new Class[]{String.class, String.class}, + "encrypt_String_1__String_1__String_1_", + "encrypt_Number_1__String_1__String_1_", + "encrypt_Boolean_1__String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Get.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Get.java new file mode 100644 index 00000000000..882ef0b8035 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Get.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.collection; + +import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; + +public class Get extends AbstractNativeFunctionGeneric +{ + public Get() + { + super("FunctionsGen.get", new Class[]{RichIterable.class, String.class}, "get_T_MANY__String_1__T_$0_1$_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + String type = TypeProcessor.typeToJavaPrimitiveSingle(Instance.getValueForMetaPropertyToOneResolved(functionExpression, M3Properties.genericType, processorSupport), processorSupport); + return transformedParams.makeString("(" + type + ")FunctionsGen.get(", ", ", ")"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Repeat.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Repeat.java new file mode 100644 index 00000000000..7bb396480c7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/collection/Repeat.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.collection; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Repeat extends AbstractNativeFunctionGeneric +{ + public Repeat() + { + super("FunctionsGen.repeat", new Class[]{Object.class, Long.class}, "repeat_T_1__Integer_1__T_MANY_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfWeekNumber.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfWeekNumber.java new file mode 100644 index 00000000000..e7cf0e67f60 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfWeekNumber.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date; + +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class DayOfWeekNumber extends AbstractNativeFunctionGeneric +{ + public DayOfWeekNumber() + { + super("FunctionsGen.dayOfWeekNumber", new Class[]{PureDate.class, SourceInformation.class}, true, false, false, "dayOfWeekNumber_Date_1__Integer_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfYear.java new file mode 100644 index 00000000000..efae51df597 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/DayOfYear.java @@ -0,0 +1,27 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date; + +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class DayOfYear extends AbstractNativeFunctionGeneric +{ + public DayOfYear() + { + super("FunctionsGen.dayOfYear", new Class[]{PureDate.class, SourceInformation.class}, true, false, false, "dayOfYear_Date_1__Integer_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Now.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Now.java new file mode 100644 index 00000000000..bc8e33589bf --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Now.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Now extends AbstractNativeFunctionGeneric +{ + public Now() + { + super("FunctionsGen.now", new Class[]{}, "now__DateTime_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Today.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Today.java new file mode 100644 index 00000000000..457cb5ad7d6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/Today.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Today extends AbstractNativeFunctionGeneric +{ + public Today() + { + super("FunctionsGen.today", new Class[]{}, "today__StrictDate_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/WeekOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/WeekOfYear.java new file mode 100644 index 00000000000..67c88ad8688 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/date/WeekOfYear.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.date; + +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class WeekOfYear extends AbstractNativeFunctionGeneric +{ + public WeekOfYear() + { + super("FunctionsGen.weekOfYear", new Class[]{PureDate.class, SourceInformation.class}, true, false, false, "weekOfYear_Date_1__Integer_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/hash/Hash.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/hash/Hash.java new file mode 100644 index 00000000000..6f3f46c62fe --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/hash/Hash.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.hash; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Hash extends AbstractNativeFunctionGeneric +{ + public Hash() + { + super("FunctionsGen.hash", new Class[]{String.class, Object.class}, "hash_String_1__HashType_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/ReadFile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/ReadFile.java new file mode 100644 index 00000000000..e46bb7216b9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/ReadFile.java @@ -0,0 +1,26 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.io; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class ReadFile extends AbstractNativeFunctionGeneric +{ + public ReadFile() + { + super("FunctionsGen.readFile", new Class[]{String.class, String.class, ExecutionSupport.class}, false, true, false, "readFile_String_1__String_$0_1$__String_$0_1$_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/http/Http.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/http/Http.java new file mode 100644 index 00000000000..d0d8df6aba7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/io/http/Http.java @@ -0,0 +1,48 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.io.http; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class Http extends AbstractNative +{ + public Http() + { + super("executeHTTPRaw_URL_1__HTTPMethod_1__String_$0_1$__String_$0_1$__HTTPResponse_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return "FunctionsGen.executeHttpRaw(" + transformedParams.get(0) + "," + transformedParams.get(1) + "," + transformedParams.get(2) + "," + transformedParams.get(3) + ",es)"; + } + + @Override + public String buildBody() + { + + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return FunctionsGen.executeHttpRaw((Root_meta_pure_functions_io_http_URL) vars.get(0), vars.get(1), (String) vars.get(2), (String) vars.get(3), es);" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/lang/MutateAdd.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/lang/MutateAdd.java new file mode 100644 index 00000000000..4e613a90de2 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/lang/MutateAdd.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.lang; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class MutateAdd extends AbstractNative +{ + public MutateAdd() + { + super("mutateAdd_T_1__String_1__Any_MANY__T_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + SourceInformation sourceInformation = functionExpression.getSourceInformation(); + + return "FunctionsGen.mutateAdd(" + + transformedParams.get(0) + "," + + transformedParams.get(1) + "," + + "CompiledSupport.toPureCollection(" + transformedParams.get(2) + ")," + + NativeFunctionProcessor.buildM4LineColumnSourceInformation(sourceInformation) + + ")"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/CompileValueSpecification.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/CompileValueSpecification.java new file mode 100644 index 00000000000..12295dcb79c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/CompileValueSpecification.java @@ -0,0 +1,57 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.multiplicity.Multiplicity; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class CompileValueSpecification extends AbstractNative +{ + public CompileValueSpecification() + { + super("compileValueSpecification_String_m__CompilationResult_m_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + ListIterable parametersValues = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorSupport); + + CoreInstance multiplicity = Instance.getValueForMetaPropertyToOneResolved(parametersValues.get(0), M3Properties.multiplicity, processorSupport); + + return "org.finos.legend.pure.generated.FunctionsGen." + (Multiplicity.isToOne(multiplicity) ? "compileCodeBlock" : "compileCodeBlocks") + "(" + transformedParams.get(0) + ", es)"; + } + + @Override + public String buildBody() + { + + return "new DefendedPureFunction1()\n" + + " {\n" + + " @Override\n" + + " public Object value(Object input, ExecutionSupport es)\n" + + " {\n" + + " return input instanceof RichIterable ? org.finos.legend.pure.generated.FunctionsGen.compileCodeBlocks((RichIterable) input, es) : org.finos.legend.pure.generated.FunctionsGen.compileCodeBlock((String) input, es);\n" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/FunctionDescriptorToId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/FunctionDescriptorToId.java new file mode 100644 index 00000000000..ad2f1dc0e37 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/FunctionDescriptorToId.java @@ -0,0 +1,26 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.essentials.meta.source.SourceInformation; + +public class FunctionDescriptorToId extends AbstractNativeFunctionGeneric +{ + public FunctionDescriptorToId() + { + super("FunctionsGen.functionDescriptorToId", new Class[]{String.class, SourceInformation.class}, true, false, false, "functionDescriptorToId_String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsSourceReadOnly.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsSourceReadOnly.java new file mode 100644 index 00000000000..8c721056d9e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsSourceReadOnly.java @@ -0,0 +1,27 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class IsSourceReadOnly extends AbstractNativeFunctionGeneric +{ + public IsSourceReadOnly() + { + super("FunctionsGen.isSourceReadOnly", new Class[]{String.class, ExecutionSupport.class}, + false, true, false, "isSourceReadOnly_String_1__Boolean_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsValidFunctionDescriptor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsValidFunctionDescriptor.java new file mode 100644 index 00000000000..c8f4a54235f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/IsValidFunctionDescriptor.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class IsValidFunctionDescriptor extends AbstractNativeFunctionGeneric +{ + public IsValidFunctionDescriptor() + { + super("FunctionsGen.isValidFunctionDescriptor", new Class[]{String.class}, "isValidFunctionDescriptor_String_1__Boolean_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewAssociation.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewAssociation.java new file mode 100644 index 00000000000..3ccb8baad66 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewAssociation.java @@ -0,0 +1,48 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class NewAssociation extends AbstractNative +{ + public NewAssociation() + { + super("newAssociation_String_1__Property_1__Property_1__Association_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return "FunctionsGen.newAssociation(" + transformedParams.get(0) + "," + transformedParams.get(1) + "," + transformedParams.get(2) + ",((CompiledExecutionSupport)es).getMetadataAccessor(), " + NativeFunctionProcessor.buildM4SourceInformation(functionExpression.getSourceInformation()) + ")"; + } + + @Override + public String buildBody() + { + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return FunctionsGen.newAssociation((String) vars.get(0), (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property) vars.get(1), (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.Property) vars.get(2), ((CompiledExecutionSupport) es).getMetadataAccessor(), null);\n" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewClass.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewClass.java new file mode 100644 index 00000000000..76ff10c53f8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewClass.java @@ -0,0 +1,49 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class NewClass extends AbstractNative +{ + public NewClass() + { + super("newClass_String_1__Class_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return "FunctionsGen.newClass(" + transformedParams.get(0) + ",((CompiledExecutionSupport)es).getMetadataAccessor(), " + NativeFunctionProcessor.buildM4SourceInformation(functionExpression.getSourceInformation()) + ")"; + } + + @Override + public String buildBody() + { + + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return FunctionsGen.newClass((String) vars.get(0), ((CompiledExecutionSupport) es).getMetadataAccessor(), null);\n" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewEnumeration.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewEnumeration.java new file mode 100644 index 00000000000..c91ba8bbf56 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewEnumeration.java @@ -0,0 +1,49 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.NativeFunctionProcessor; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; + +public class NewEnumeration extends AbstractNative +{ + public NewEnumeration() + { + super("newEnumeration_String_1__String_MANY__Enumeration_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return "FunctionsGen.newEnumeration(" + transformedParams.get(0) + ",CompiledSupport.toPureCollection(" + transformedParams.get(1) + "),((CompiledExecutionSupport)es).getMetadataAccessor(), " + NativeFunctionProcessor.buildM4SourceInformation(functionExpression.getSourceInformation()) + ")"; + } + + @Override + public String buildBody() + { + + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return FunctionsGen.newEnumeration((String) vars.get(0), CompiledSupport.toPureCollection(vars.get(1)), ((CompiledExecutionSupport) es).getMetadataAccessor(), null);\n" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewLambdaFunction.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewLambdaFunction.java new file mode 100644 index 00000000000..5fef9276ac9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewLambdaFunction.java @@ -0,0 +1,57 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; + +import java.text.MessageFormat; + +public class NewLambdaFunction extends AbstractNative +{ + private static final String TEMPLATE = "new " + FullJavaPaths.LambdaFunction_Impl + "(\"NOID\")" + + "._classifierGenericType(new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")._rawType((" + FullJavaPaths.Class + ")((CompiledExecutionSupport)es).getMetadataAccessor().getClass(\"Root::meta::pure::metamodel::function::LambdaFunction\"))" + + "._typeArguments(Lists.immutable.of(new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")._rawType({0}))))"; + + public NewLambdaFunction() + { + super("newLambdaFunction_FunctionType_1__LambdaFunction_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return MessageFormat.format(TEMPLATE, transformedParams.get(0)); + } + + @Override + public String buildBody() + { + + String newLambda = MessageFormat.format(TEMPLATE, "(" + FullJavaPaths.FunctionType + ")vars.get(0)"); + + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return " + newLambda + ";\n" + + " }\n" + + " }"; + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewProperty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewProperty.java new file mode 100644 index 00000000000..13236e27154 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewProperty.java @@ -0,0 +1,60 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; + +import java.text.MessageFormat; + +public class NewProperty extends AbstractNative +{ + private static final String TEMPLATE = "new " + FullJavaPaths.Property_Impl + "(\"NOID\")" + + "._classifierGenericType(new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")._rawType((" + FullJavaPaths.Class + ")((CompiledExecutionSupport)es).getMetadataAccessor().getClass(\"Root::meta::pure::metamodel::function::property::Property\"))" + + " ._multiplicityArguments(Lists.immutable.of({3}))" + + " ._typeArguments(Lists.immutable.of({1},{2})))" + + "._name({0})" + + "._genericType({2})" + + "._multiplicity({3})" + + "._owner((" + FullJavaPaths.Class + ")({1})._rawType())"; + + public NewProperty() + { + super("newProperty_String_1__GenericType_1__GenericType_1__Multiplicity_1__Property_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return MessageFormat.format(TEMPLATE, transformedParams.get(0), transformedParams.get(1), transformedParams.get(2), transformedParams.get(3)); + } + + @Override + public String buildBody() + { + String newProperty = MessageFormat.format(TEMPLATE, "(String) vars.get(0)", "(" + FullJavaPaths.GenericType + ") vars.get(1)", "(" + FullJavaPaths.GenericType + ") vars.get(2)", "(" + FullJavaPaths.Multiplicity + ") vars.get(3)"); + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return " + newProperty + ";\n" + + " }\n" + + " }"; + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewQualifiedProperty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewQualifiedProperty.java new file mode 100644 index 00000000000..cd05eefb7f8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/meta/NewQualifiedProperty.java @@ -0,0 +1,67 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; + +import java.text.MessageFormat; + +public class NewQualifiedProperty extends AbstractNative +{ + private static final String TEMPLATE = "new " + FullJavaPaths.QualifiedProperty_Impl + "(\"NOID\")" + + "._classifierGenericType(new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")._rawType((" + FullJavaPaths.Class + ")((CompiledExecutionSupport)es).getMetadataAccessor().getClass(\"Root::meta::pure::metamodel::function::property::QualifiedProperty\"))" + + " ._typeArguments(Lists.immutable.of(" + + " new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")" + + " ._rawType(new " + FullJavaPaths.FunctionType_Impl + "(\"NOID\")" + + " ._classifierGenericType(new " + FullJavaPaths.GenericType_Impl + "(\"NOID\")._rawType((" + FullJavaPaths.Class + ")((CompiledExecutionSupport)es).getMetadataAccessor().getClass(\"Root::meta::pure::metamodel::type::FunctionType\")))" + + " ._returnType({2})" + + " ._returnMultiplicity({3})" + + " ._parameters((RichIterable) (Object) CompiledSupport.toPureCollection({4}))" + + "))))" + + "._name({0})" + + "._functionName({0})" + + "._genericType({2})" + + "._multiplicity({3})" + + "._owner((" + FullJavaPaths.Class + ")({1})._rawType())"; + + public NewQualifiedProperty() + { + super("newQualifiedProperty_String_1__GenericType_1__GenericType_1__Multiplicity_1__VariableExpression_MANY__QualifiedProperty_1_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + return MessageFormat.format(TEMPLATE, transformedParams.get(0), transformedParams.get(1), transformedParams.get(2), transformedParams.get(3), transformedParams.get(4)); + } + + @Override + public String buildBody() + { + String newQualifiedProperty = MessageFormat.format(TEMPLATE, "(String) vars.get(0)", "(" + FullJavaPaths.GenericType + ") vars.get(1)", "(" + FullJavaPaths.GenericType + ") vars.get(2)", "(" + FullJavaPaths.Multiplicity + ") vars.get(3)", "vars.get(4)"); + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " return " + newQualifiedProperty + ";\n" + + " }\n" + + " }"; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/CurrentUserId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/CurrentUserId.java new file mode 100644 index 00000000000..56eec79a1c4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/CurrentUserId.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class CurrentUserId extends AbstractNativeFunctionGeneric +{ + public CurrentUserId() + { + super("FunctionsGen.currentUserId", new Class[]{}, "currentUserId__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/Guid.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/Guid.java new file mode 100644 index 00000000000..5f20097bde3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/Guid.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Guid extends AbstractNativeFunctionGeneric +{ + public Guid() + { + super("FunctionsGen.guid", new Class[]{}, "generateGuid__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/IsOptionSet.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/IsOptionSet.java new file mode 100644 index 00000000000..212e706041b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/runtime/IsOptionSet.java @@ -0,0 +1,28 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.runtime; + +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class IsOptionSet extends AbstractNativeFunctionGeneric +{ + public IsOptionSet() + { + super("FunctionsGen.isOptionSet", new Class[]{String.class, ExecutionSupport.class}, + false, true, false, "isOptionSet_String_1__Boolean_1_"); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/ASCII.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/ASCII.java new file mode 100644 index 00000000000..34b25f86038 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/ASCII.java @@ -0,0 +1,25 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class ASCII extends AbstractNativeFunctionGeneric +{ + public ASCII() + { + super("FunctionsGen.ascii", new Class[]{String.class}, "ascii_String_1__Integer_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Char.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Char.java new file mode 100644 index 00000000000..51a45fbcb46 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Char.java @@ -0,0 +1,25 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Char extends AbstractNativeFunctionGeneric +{ + public Char() + { + super("FunctionsGen.character", new Class[]{Number.class}, "char_Integer_1__String_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Chunk.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Chunk.java new file mode 100644 index 00000000000..eb99e5efd7e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Chunk.java @@ -0,0 +1,26 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Chunk extends AbstractNativeFunctionGeneric +{ + public Chunk() + { + super("FunctionsGen.chunk", new Class[]{String.class, Long.class, SourceInformation.class}, true, false, false, "chunk_String_1__Integer_1__String_MANY_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeBase64.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeBase64.java new file mode 100644 index 00000000000..3ee8b3895f5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeBase64.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class DecodeBase64 extends AbstractNativeFunctionGeneric +{ + public DecodeBase64() + { + super("FunctionsGen.decodeBase64", new Class[]{String.class}, "decodeBase64_String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeUrl.java new file mode 100644 index 00000000000..b05dcf06786 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/DecodeUrl.java @@ -0,0 +1,25 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class DecodeUrl extends AbstractNativeFunctionGeneric +{ + public DecodeUrl() + { + super("FunctionsGen.decodeUrl", new Class[]{String.class, String.class}, "decodeUrl_String_1__String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeBase64.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeBase64.java new file mode 100644 index 00000000000..babb7143833 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeBase64.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class EncodeBase64 extends AbstractNativeFunctionGeneric +{ + public EncodeBase64() + { + super("FunctionsGen.encodeBase64", new Class[]{String.class}, "encodeBase64_String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeUrl.java new file mode 100644 index 00000000000..d5939ed521e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/EncodeUrl.java @@ -0,0 +1,25 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class EncodeUrl extends AbstractNativeFunctionGeneric +{ + public EncodeUrl() + { + super("FunctionsGen.encodeUrl", new Class[]{String.class, String.class}, "encodeUrl_String_1__String_1__String_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/JaroWinklerSimilarity.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/JaroWinklerSimilarity.java new file mode 100644 index 00000000000..d77085210ce --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/JaroWinklerSimilarity.java @@ -0,0 +1,25 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class JaroWinklerSimilarity extends AbstractNativeFunctionGeneric +{ + public JaroWinklerSimilarity() + { + super("FunctionsGen.jaroWinklerSimilarity", new Class[]{String.class, String.class}, "jaroWinklerSimilarity_String_1__String_1__Float_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/LevenshteinDistance.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/LevenshteinDistance.java new file mode 100644 index 00000000000..92e03c2fddb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/LevenshteinDistance.java @@ -0,0 +1,25 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class LevenshteinDistance extends AbstractNativeFunctionGeneric +{ + public LevenshteinDistance() + { + super("FunctionsGen.levenshteinDistance", new Class[]{String.class, String.class}, "levenshteinDistance_String_1__String_1__Integer_1_"); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Matches.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Matches.java new file mode 100644 index 00000000000..b46a3d7838e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/string/Matches.java @@ -0,0 +1,25 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.string; + +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class Matches extends AbstractNativeFunctionGeneric +{ + public Matches() + { + super("FunctionsGen.matches", new Class[]{String.class, String.class}, "matches_String_1__String_1__Boolean_1_"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/tracing/TraceSpan.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/tracing/TraceSpan.java new file mode 100644 index 00000000000..5f56b99c9d4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/compiled/natives/tracing/TraceSpan.java @@ -0,0 +1,70 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.compiled.natives.tracing; + +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.multiplicity.Multiplicity; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.generation.ProcessorContext; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNative; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.FullJavaPaths; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.type.TypeProcessor; + +public class TraceSpan extends AbstractNative +{ + public TraceSpan() + { + super("traceSpan_Function_1__String_1__V_m_", + "traceSpan_Function_1__String_1__Function_1__V_m_", + "traceSpan_Function_1__String_1__Function_1__Boolean_1__V_m_"); + } + + @Override + public String build(CoreInstance topLevelElement, CoreInstance functionExpression, ListIterable transformedParams, ProcessorContext processorContext) + { + ProcessorSupport processorSupport = processorContext.getSupport(); + ListIterable parametersValues = Instance.getValueForMetaPropertyToManyResolved(functionExpression, M3Properties.parametersValues, processorContext.getSupport()); + String type = TypeProcessor.typeToJavaObjectWithMul(Instance.getValueForMetaPropertyToOneResolved(functionExpression, M3Properties.genericType, processorSupport), + Instance.getValueForMetaPropertyToOneResolved(functionExpression, M3Properties.multiplicity, processorSupport), processorSupport); + CoreInstance multiplicity = Instance.getValueForMetaPropertyToOneResolved(functionExpression, M3Properties.multiplicity, processorSupport); + String operationName = transformedParams.get(1); + String functionToExec = transformedParams.get(0); + String functionToGetTags = transformedParams.size() > 2 ? transformedParams.get(2) : "null"; + String tagsCritical = transformedParams.size() > 3 ? transformedParams.get(3) : "true"; + String eval = "FunctionsGen.traceSpan(es," + functionToExec + "," + operationName + "," + functionToGetTags + "," + tagsCritical + ")"; + return "((" + type + ")(Object)" + (Multiplicity.isToOne(multiplicity, false) ? eval : "CompiledSupport.toPureCollection(" + eval + ")") + ")"; + } + + @Override + public String buildBody() + { + return "new SharedPureFunction()\n" + + " {\n" + + " @Override\n" + + " public Object execute(ListIterable vars, final ExecutionSupport es)\n" + + " {\n" + + " Object value = FunctionsGen.traceSpan(es, (" + FullJavaPaths.Function + ") vars.get(0), \n" + + " CompiledSupport.pureToString(vars.get(1), es), \n" + + " vars.size() > 2 ? (" + FullJavaPaths.Function + ") vars.get(2) : null,\n" + + " vars.size() > 3 ? Boolean.valueOf(CompiledSupport.pureToString(vars.get(1), es)) : true);\n" + + " return value instanceof Iterable ? CompiledSupport.toPureCollection(value) : value;\n" + + " }\n" + + " }"; + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..ad7d53ce9dc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.functions.compiled.Base_Compiled_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension new file mode 100644 index 00000000000..067882e8fbf --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.functions.compiled.FunctionsExtensionCompiled \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledClassloaderStateVerifier.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledClassloaderStateVerifier.java new file mode 100644 index 00000000000..203c8ff190a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledClassloaderStateVerifier.java @@ -0,0 +1,40 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.RuntimeVerifier; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiled; +import org.junit.Assert; + +public class CompiledClassloaderStateVerifier implements RuntimeVerifier.FunctionExecutionStateVerifier +{ + private int classLoaderClassCount; + + @Override + public void snapshotState(FunctionExecution functionExecution) + { + FunctionExecutionCompiled functionExecutionCompiled = (FunctionExecutionCompiled)functionExecution; + this.classLoaderClassCount = functionExecutionCompiled.getJavaCompiler().getClassLoader().loadedClassCount(); + } + + @Override + public void assertStateSame(FunctionExecution functionExecution) + { + FunctionExecutionCompiled functionExecutionCompiled = (FunctionExecutionCompiled)functionExecution; + Assert.assertEquals(this.classLoaderClassCount, functionExecutionCompiled.getJavaCompiler().getClassLoader().loadedClassCount()); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledMetadataStateVerifier.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledMetadataStateVerifier.java new file mode 100644 index 00000000000..ee1fe7790df --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/CompiledMetadataStateVerifier.java @@ -0,0 +1,53 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.RuntimeVerifier; +import org.finos.legend.pure.runtime.java.compiled.execution.CompiledProcessorSupport; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiled; +import org.finos.legend.pure.runtime.java.compiled.metadata.MetadataEager; +import org.junit.Assert; + +public class CompiledMetadataStateVerifier implements RuntimeVerifier.FunctionExecutionStateVerifier +{ + private int classCacheSizeBefore; + private int metadataCount; + + @Override + public void snapshotState(FunctionExecution functionExecution) + { + FunctionExecutionCompiled functionExecutionCompiled = (FunctionExecutionCompiled)functionExecution; + + MetadataEager metamodel = this.getMetamodel(functionExecutionCompiled); + this.classCacheSizeBefore = functionExecutionCompiled.getClassCacheSize(); + this.metadataCount = metamodel.getSize(); + } + + @Override + public void assertStateSame(FunctionExecution functionExecution) + { + FunctionExecutionCompiled functionExecutionCompiled = (FunctionExecutionCompiled)functionExecution; + MetadataEager metamodel = this.getMetamodel(functionExecutionCompiled); + Assert.assertEquals(this.classCacheSizeBefore, functionExecutionCompiled.getClassCacheSize()); + Assert.assertEquals(this.metadataCount, metamodel.getSize()); + } + + private MetadataEager getMetamodel(FunctionExecutionCompiled functionExecutionCompiled) + { + CompiledProcessorSupport compiledProcessorSupport = (CompiledProcessorSupport)functionExecutionCompiled.getProcessorSupport(); + return (MetadataEager)compiledProcessorSupport.getMetadata(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestFunctionDefinitionModify.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestFunctionDefinitionModify.java new file mode 100644 index 00000000000..c6b523d4463 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestFunctionDefinitionModify.java @@ -0,0 +1,47 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.AbstractTestFunctionDefinitionModify; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TestFunctionDefinitionModify extends AbstractTestFunctionDefinitionModify +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestFunctionDefinitionModify.getCodeStorage(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Test + @Ignore(value = "Further fixes needed for clone as source information is copied over currently") + @Override + public void testConcreteFunctionDefinitionModifyWithCopyConstructor() + { + super.testConcreteFunctionDefinitionModifyWithCopyConstructor(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestPCRReport.java new file mode 100644 index 00000000000..b3c11d9e168 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/TestPCRReport.java @@ -0,0 +1,29 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals("Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); + Assert.assertEquals(3, PCTReportProviderLoader.gatherReports().size()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileAnd.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileAnd.java new file mode 100644 index 00000000000..6c422127fc9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileAnd.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestAnd; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompileAnd extends AbstractTestAnd +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileNot.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileNot.java new file mode 100644 index 00000000000..beee16e4a26 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileNot.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestNot; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompileNot extends AbstractTestNot +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileOr.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileOr.java new file mode 100644 index 00000000000..ba6c145a426 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompileOr.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestOr; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompileOr extends AbstractTestOr +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompilePrecedence.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompilePrecedence.java new file mode 100644 index 00000000000..ca7d5e708b1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/_boolean/TestCompilePrecedence.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestPrecedence; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompilePrecedence extends AbstractTestPrecedence +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/asserts/TestAssert.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/asserts/TestAssert.java new file mode 100644 index 00000000000..83f78af1498 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/asserts/TestAssert.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.asserts.AbstractTestAssert; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestAssert extends AbstractTestAssert +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestAtCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestAtCompiled.java new file mode 100644 index 00000000000..7ec8f1ec629 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestAtCompiled.java @@ -0,0 +1,37 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestAt; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestAtCompiled extends AbstractTestAt +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledFirst.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledFirst.java new file mode 100644 index 00000000000..30490ce5bd7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledFirst.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestFirst; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledFirst extends AbstractTestFirst +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledGetAll.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledGetAll.java new file mode 100644 index 00000000000..8fc0572f34a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledGetAll.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestGetAll; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledGetAll extends AbstractTestGetAll +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledInit.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledInit.java new file mode 100644 index 00000000000..8fa9946df55 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledInit.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestInit; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledInit extends AbstractTestInit +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledIsEmpty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledIsEmpty.java new file mode 100644 index 00000000000..423b17594e8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledIsEmpty.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestIsEmpty; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledIsEmpty extends AbstractTestIsEmpty +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledLast.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledLast.java new file mode 100644 index 00000000000..5a2ffb8cdad --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledLast.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestLast; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledLast extends AbstractTestLast +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledReverse.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledReverse.java new file mode 100644 index 00000000000..2d32781f3dd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledReverse.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestReverse; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledReverse extends AbstractTestReverse +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledTail.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledTail.java new file mode 100644 index 00000000000..ba7d3a5921b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestCompiledTail.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestTail; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledTail extends AbstractTestTail +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCollection.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCollection.java new file mode 100644 index 00000000000..abb56f8ac5e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCollection.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestMapCollection; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestMapCollection extends AbstractTestMapCollection +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCompiled.java new file mode 100644 index 00000000000..471c9d7f96e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestMap; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestMapCompiled extends AbstractTestMap +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapZeroOneCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapZeroOneCompiled.java new file mode 100644 index 00000000000..f66e0a90717 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestMapZeroOneCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestMapZeroOne; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestMapZeroOneCompiled extends AbstractTestMapZeroOne +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestRangeCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestRangeCompiled.java new file mode 100644 index 00000000000..77b6da386b4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestRangeCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestRange; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestRangeCompiled extends AbstractTestRange +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestSlice.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestSlice.java new file mode 100644 index 00000000000..c5f821db707 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/collection/TestSlice.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestSlice; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestSlice extends AbstractTestSlice +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfMonth.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfMonth.java new file mode 100644 index 00000000000..d6aa78e106f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfMonth.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestDayOfMonth; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestDayOfMonth extends AbstractTestDayOfMonth +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfWeekNumber.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfWeekNumber.java new file mode 100644 index 00000000000..e4c8f12465d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestDayOfWeekNumber.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestDayOfWeekNumber; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestDayOfWeekNumber extends AbstractTestDayOfWeekNumber +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestHour.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestHour.java new file mode 100644 index 00000000000..2e44b0b5b68 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestHour.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestHour; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestHour extends AbstractTestHour +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestMinute.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestMinute.java new file mode 100644 index 00000000000..21e39de610f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestMinute.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestMinute; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestMinute extends AbstractTestMinute +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNewDate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNewDate.java new file mode 100644 index 00000000000..7437c78c9b5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNewDate.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestNewDate; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNewDate extends AbstractTestNewDate +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNowCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNowCompiled.java new file mode 100644 index 00000000000..dee2325bb2d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestNowCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestNow; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNowCompiled extends AbstractTestNow +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestSecond.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestSecond.java new file mode 100644 index 00000000000..fe9c3c4b683 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestSecond.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestSecond; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestSecond extends AbstractTestSecond +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestTodayCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestTodayCompiled.java new file mode 100644 index 00000000000..8f2994789ce --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestTodayCompiled.java @@ -0,0 +1,48 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestToday; +import org.finos.legend.pure.m3.tools.test.ToFix; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TestTodayCompiled extends AbstractTestToday +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @ToFix + @Ignore + @Test + @Override + public void testToday() + { + // TODO fix this by allowing native functions to be called directly in compiled mode + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestWeekOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestWeekOfYear.java new file mode 100644 index 00000000000..9f20f5b66b6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/date/TestWeekOfYear.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestWeekOfYear; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestWeekOfYear extends AbstractTestWeekOfYear +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestHttpCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestHttpCompiled.java new file mode 100644 index 00000000000..2b33c60fb19 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestHttpCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestHttp; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestHttpCompiled extends AbstractTestHttp +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestPrintCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestPrintCompiled.java new file mode 100644 index 00000000000..8230a5d2eab --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestPrintCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestPrint; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestPrintCompiled extends AbstractTestPrint +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestReadFile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestReadFile.java new file mode 100644 index 00000000000..6b94566b94c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/io/TestReadFile.java @@ -0,0 +1,35 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestReadFile; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestReadFile extends AbstractTestReadFile +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCastCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCastCompiled.java new file mode 100644 index 00000000000..876cffe8540 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCastCompiled.java @@ -0,0 +1,152 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCast; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.finos.legend.pure.runtime.java.compiled.generation.JavaPackageAndImportBuilder; +import org.junit.Assert; +import org.junit.BeforeClass; + +import javax.lang.model.SourceVersion; + +public class TestCastCompiled extends AbstractTestCast +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestCast.getCodeStorage(), JavaModelFactoryRegistryLoader.loader(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Override + protected void checkInvalidCastWithTypeParametersTopLevelException(PureExecutionException e) + { + AbstractPureTestWithCoreCompiled.assertPureException(PureExecutionException.class, "Unexpected error executing function", "fromString.pure", 1, 1, 1, 10, 4, 1, e); + } + + @Override + protected void checkInvalidCastWithTypeParametersRootException(PureExecutionException e) + { + Exception root = findRootException(e); + Assert.assertTrue(root instanceof ClassCastException); + String message = root.getMessage(); + if (SourceVersion.latest().compareTo(SourceVersion.RELEASE_8) > 0) + { + String expectedStart = "class " + JavaPackageAndImportBuilder.rootPackage() + ".Root_X_Impl cannot be cast to class " + JavaPackageAndImportBuilder.rootPackage() + ".Root_Y"; + if (!message.startsWith(expectedStart)) + { + Assert.assertEquals("should start with expected", expectedStart, message); + } + } + else + { + String expectedMessage = JavaPackageAndImportBuilder.rootPackage() + ".Root_X_Impl incompatible with " + JavaPackageAndImportBuilder.rootPackage() + ".Root_Y"; + Assert.assertEquals(expectedMessage, message); + } + } + + @Override + protected void checkPrimitiveConcreteOneTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkPrimitiveConcreteManyTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkNonPrimitiveConcreteOneTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkNonPrimitiveConcreteManyTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkEnumToStringCastTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkPrimitiveNonConcreteOneTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkPrimitiveNonConcreteOneRootException(PureExecutionException e) + { + checkException(findRootException(e), "Cast exception: Integer cannot be cast to String", "/test/cast.pure", 51, 10); + } + + @Override + protected void checkNonPrimitiveNonConcreteOneTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkNonPrimitiveNonConcreteOneRootException(PureExecutionException e) + { + checkException(findRootException(e), "Cast exception: X cannot be cast to Y", "/test/cast.pure", 61, 12); + } + + @Override + protected void checkPrimitiveNonConcreteManyTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkPrimitiveNonConcreteManyRootException(PureExecutionException e) + { + checkException(findRootException(e), "Cast exception: String cannot be cast to Number", "/test/cast.pure", 56, 13); + } + + @Override + protected void checkNonPrimitiveNonConcreteManyTopLevelException(PureExecutionException e) + { + Assert.assertSame(e, findRootException(e)); + } + + @Override + protected void checkNonPrimitiveNonConcreteManyRootException(PureExecutionException e) + { + checkException(findRootException(e), "Cast exception: X cannot be cast to Y", "/test/cast.pure", 61, 12); + } + + @Override + protected void checkStringToEnumCastTopLevelException(PureExecutionException e) + { + checkException(e, "Cast exception: String cannot be cast to Enum", "fromString.pure", 3, 17); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCompareCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCompareCompiled.java new file mode 100644 index 00000000000..6e11a229e4d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCompareCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCompare; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompareCompiled extends AbstractTestCompare +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCopyCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCopyCompiled.java new file mode 100644 index 00000000000..31dbae55556 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestCopyCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCopyAtRuntime; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCopyCompiled extends AbstractTestCopyAtRuntime +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNew.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNew.java new file mode 100644 index 00000000000..d9f6856e988 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNew.java @@ -0,0 +1,46 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestDynamicNew; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestDynamicNew extends AbstractTestDynamicNew +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestDynamicNew.getCodeStorage(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + public void testDefaultValueWithDynamicNew() + { + + } + + public void testDefaultValueWithKeyValuePassedAsVariableToDynamicNew() + { + + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewConstraintsHandler.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewConstraintsHandler.java new file mode 100644 index 00000000000..cf2c89266da --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewConstraintsHandler.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestDynamicNewConstraintsHandler; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestDynamicNewConstraintsHandler extends AbstractTestDynamicNewConstraintsHandler +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewGetterOverrideCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewGetterOverrideCompiled.java new file mode 100644 index 00000000000..59c8890b427 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestDynamicNewGetterOverrideCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestDynamicNewGetterOverride; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestDynamicNewGetterOverrideCompiled extends AbstractTestDynamicNewGetterOverride +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateCompiled.java new file mode 100644 index 00000000000..edc6498a7a3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateCompiled.java @@ -0,0 +1,86 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestEvaluate; +import org.finos.legend.pure.m3.tools.test.ToFix; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Ignore; + +public class TestEvaluateCompiled extends AbstractTestEvaluate +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Override + public boolean checkLineNumbers() + { + return false; + } + + @Override + @Ignore + @ToFix + public void testEvaluateAssert() + { + } + + @Override + @Ignore + @ToFix + public void testEvaluateUnboundedMultiplicity() + { + } + + @Override + @Ignore + @ToFix + public void testEvaluateViolateUpperBound() + { + } + + @Override + @Ignore + @ToFix + public void testEvaluateViolateLowerBound() + { + } + + @Override + @Ignore + @ToFix + public void testEvaluateAnyWrongMultiplicity() + { + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateFunctions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateFunctions.java new file mode 100644 index 00000000000..cff5a290bbf --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestEvaluateFunctions.java @@ -0,0 +1,78 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestEvaluateFunctions extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + AbstractPureTestWithCoreCompiled.runtime.compile(); + } + + @Test + public void testFilterSimple() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", + "function test():Boolean[1]\n" + + "{\n" + + " assert('test' == ['a','b','test']->filter(x|$x == 'test'), |'')\n" + + "}"); + this.compileAndExecute("test():Boolean[1]"); + } + + @Test + public void testFilterReflectiveEval() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", + "function test():Boolean[1]\n" + + "{\n" + + " assert('test' == filter_T_MANY__Function_1__T_MANY_->eval(['a','b','test'], x:String[1]|$x == 'test'), |'')\n" + + "}"); + this.compileAndExecute("test():Boolean[1]"); + } + + @Test + public void testFilterReflectiveEvaluate() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", + "function test():Boolean[1]\n" + + "{\n" + + " assert('test' == filter_T_MANY__Function_1__T_MANY_->evaluate([list(['a','b','test']), list(x:String[1]|$x == 'test')]), |'')\n" + + "}"); + this.compileAndExecute("test():Boolean[1]"); + + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestIfCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestIfCompiled.java new file mode 100644 index 00000000000..4517ffc35fd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestIfCompiled.java @@ -0,0 +1,131 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.impl.test.Verify; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.InstanceValue; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestIfCompiled extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + @Test + public void testUnAssignedIfInFuncExpression() + { + compileTestSource( + "fromString.pure", + "function meta::pure::functions::lang::tests::if::testUnAssignedIfInFuncExpression():String[1]\n" + + "{\n" + + " let ifVar = if(true, | let b = 'true', | if(true, | let b = 'true', | 'false'););\n" + + " if(true, | let b = 'true', | if(true, | let b = 'true', | 'false'););\n" + + " if(true, | let b = 'true', | if(true, | let b = 'true', | 'false'););\n" + + " let iff = if(true, | let b = 'true', | if(true, | let b = 'true', | 'false'););\n" + + " if(true, | let b = 'true'; if(true, | let b = 'true', | 'false'); let bb = 'bb';, | let c = 'see');\n" + + " let a = 'be';\n" + + " if(true, | let b = 'true', | 'false');\n" + + "}"); + } + + @Test + public void testIfWithDifferentMultiplicities() + { + compileTestSource( + "fromString.pure", + "Class A\n" + + "{\n" + + " id : Integer[1];\n" + + "}\n" + + "\n" + + "function testFn(ids:Integer[*]):A[*]\n" + + "{\n" + + " if ($ids->isEmpty(),\n" + + " | let id = -1;\n" + + " ^A(id=$id);,\n" + + " | let newIds = $ids->tail();\n" + + " $ids->map(id | $newIds->testFn());)\n" + + "}"); + } + + @Test + public void testIfWithFloatVersusInteger() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "import test::*;\n" + + "function test::testFn(test:Boolean[1]):Number[1]\n" + + "{\n" + + " let result = if($test, |1.0, |3);\n" + + " $result;\n" + + "}\n" + + "\n" + + "function test::testTrue():Any[*]\n" + + "{\n" + + " let result = testFn(true);\n" + + " assert(1.0 == $result, |'');\n" + + " $result;\n" + + "}\n" + + "\n" + + "function test::testFalse():Any[*]\n" + + "{\n" + + " let result = testFn(false);\n" + + " assert(3 == $result, |'');\n" + + " $result;\n" + + "}\n"); + + CoreInstance testTrue = runtime.getFunction("test::testTrue():Any[*]"); + Assert.assertNotNull(testTrue); + CoreInstance resultTrue = functionExecution.start(testTrue, Lists.immutable.empty()); + Verify.assertInstanceOf(InstanceValue.class, resultTrue); + InstanceValue trueInstanceValue = (InstanceValue) resultTrue; + Verify.assertSize(1, trueInstanceValue._values()); + Object trueValue = trueInstanceValue._values().getFirst(); + Verify.assertInstanceOf(Double.class, trueValue); + Assert.assertEquals(1.0d, trueValue); + + CoreInstance testFalse = runtime.getFunction("test::testFalse():Any[*]"); + Assert.assertNotNull(testFalse); + CoreInstance resultFalse = functionExecution.start(testFalse, Lists.immutable.empty()); + Verify.assertInstanceOf(InstanceValue.class, resultFalse); + InstanceValue falseInstanceValue = (InstanceValue) resultFalse; + Verify.assertSize(1, falseInstanceValue._values()); + Object falseValue = falseInstanceValue._values().getFirst(); + Verify.assertInstanceOf(Long.class, falseValue); + Assert.assertEquals(3L, falseValue); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestLetCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestLetCompiled.java new file mode 100644 index 00000000000..e5239a30e54 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestLetCompiled.java @@ -0,0 +1,113 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestLetCompiled extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Test + public void testLetCollectionWithAnyCastIssue() + { + try + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "function testLetCollectionWithAnyCastIssue():Boolean[1]\n" + + "{\n" + + " let a = [A, B];\n" + + " if($a->size() == 2, | true, | false);" + + "}\n" + + "Class A" + + "{" + + "}" + + "\n" + + "Class B" + + "{" + + "}"); + MutableList l = FastList.newListWith(""); + } + catch (Exception e) + { + //e.printStackTrace(); + Assert.fail(); + } + } + + @Test + public void testLetLarge() + { + String reallyLargeString = getLargeString(); + + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "function testLargeString():String[1]\n" + + "{\n" + + " let a = \'" + reallyLargeString + "\';\n" + + " $a;" + + "}\n"); + + } + + @Test + public void testLetLargeAlreadySplit() + { + String reallyLargeString = getLargeString(); + + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "function testLargeString():String[1]\n" + + "{\n" + + " let a = \'" + reallyLargeString + "\' + \'" + reallyLargeString + "\';\n" + + " $a;" + + "}\n"); + + } + + private String getLargeString() + { + String reallyLargeString = ""; + + for (int i = 0; i <= 6600; i++) + { + reallyLargeString += "aaaaaaaaaa"; + } + + Assert.assertTrue("Large string not large enough:" + reallyLargeString.length(), reallyLargeString.length() > 65535); + return reallyLargeString; + } + + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMatchCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMatchCompiled.java new file mode 100644 index 00000000000..01934586617 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMatchCompiled.java @@ -0,0 +1,75 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestMatch; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestMatchCompiled extends AbstractTestMatch +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Test + public void testUnAssignedMatchInFuncExpression() + { + try + { + String func = "function testMatch(v:Any[1]):String[1]\n" + + "{\n" + + " $v->match( [\n" + + " a:AA[1] | 'AA',\n" + + " b:BB[1] | 'BB'\n" + + " ]\n" + + " );\n" + + "\n" + + " $v->match( [\n" + + " a:AA[1] | 'AA',\n" + + " b:BB[1] | 'BB'\n" + + " ]\n" + + " );\n" + + "}\n" + + "\n" + + "Class AA\n" + + "{\n" + + " name:String[*];\n" + + "}\n" + + "\n" + + "Class BB\n" + + "{\n" + + " name:String[*];\n" + + "}\n"; + this.compileTestSource("fromString.pure", func); + } + catch (Exception e) + { + Assert.fail(e.getMessage()); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMutateAddCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMutateAddCompiled.java new file mode 100644 index 00000000000..f816877fb1b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestMutateAddCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestMutateAdd; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestMutateAddCompiled extends AbstractTestMutateAdd +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestNewCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestNewCompiled.java new file mode 100644 index 00000000000..cdd603b5e56 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestNewCompiled.java @@ -0,0 +1,136 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestNewAtRuntime; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.Assert; +import org.junit.BeforeClass; + +public class TestNewCompiled extends AbstractTestNewAtRuntime +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestNewAtRuntime.getCodeStorage(), JavaModelFactoryRegistryLoader.loader()); + } + + public static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Override + protected void assertNewNilException(Exception e) + { + assertOriginatingPureException(PureExecutionException.class, "Cannot instantiate meta::pure::metamodel::type::Nil", e); + } + + @Override + public void testNewWithInheritenceAndOverriddenAssociationEndWithReverseOneToOneProperty() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "function test(): Any[*]\n" + + "{\n" + + " let car = ^test::FastCar(name='Bugatti', owner= ^test::Owner(firstName='John', lastName='Roe'));\n" + + " print($car.owner.car->size()->toString(), 1);\n" + + " $car;" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::FastCar extends test::Car\n" + + "{\n" + + " owner : test::Owner[1];\n" + + "}" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " car : test::Car[1];\n" + + "}"); + try + { + execute("test():Any[*]"); + String result = AbstractPureTestWithCoreCompiled.functionExecution.getConsole().getLine(0); + Assert.assertEquals("'0'", result); + } + catch (Exception e) + { + Assert.fail("Failed to set the reverse properties for a one-to-one association."); + } + } + + @Override + public void testNewWithInheritenceAndOverriddenAssociationEndWithReverseOneToManyProperty() + { + AbstractPureTestWithCoreCompiled.compileTestSource("fromString.pure", "function test(): Any[*]\n" + + "{\n" + + " let car = ^test::FastCar(name='Bugatti', owner= ^test::Owner(firstName='John', lastName='Roe'));\n" + + " print($car.owner.cars->size()->toString(), 1);\n" + + " $car;" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::FastCar extends test::Car\n" + + "{\n" + + " owner : test::Owner[1];\n" + + "}" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " cars : test::Car[1..*];\n" + + "}"); + try + { + execute("test():Any[*]"); + String result = AbstractPureTestWithCoreCompiled.functionExecution.getConsole().getLine(0); + Assert.assertEquals("'0'", result); + } + catch (Exception e) + { + Assert.fail("Failed to set the reverse properties for a one-to-one association."); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestRawEvalPropertyCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestRawEvalPropertyCompiled.java new file mode 100644 index 00000000000..0276c6f36ad --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/lang/TestRawEvalPropertyCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestRawEvalProperty; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestRawEvalPropertyCompiled extends AbstractTestRawEvalProperty +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcCosine.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcCosine.java new file mode 100644 index 00000000000..f8746badd05 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcCosine.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestArcCosine; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestArcCosine extends AbstractTestArcCosine +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcSine.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcSine.java new file mode 100644 index 00000000000..ea3bf96f5f9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestArcSine.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestArcSine; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestArcSine extends AbstractTestArcSine +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledCeiling.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledCeiling.java new file mode 100644 index 00000000000..3d032f73401 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledCeiling.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestCeiling; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledCeiling extends AbstractTestCeiling +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledDivide.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledDivide.java new file mode 100644 index 00000000000..9d9fd4dae42 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledDivide.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestDivide; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledDivide extends AbstractTestDivide +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledFloor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledFloor.java new file mode 100644 index 00000000000..b7078b15069 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledFloor.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestFloor; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledFloor extends AbstractTestFloor +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledPrecedence.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledPrecedence.java new file mode 100644 index 00000000000..d39cee4dc5c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledPrecedence.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestPrecedence; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledPrecedence extends AbstractTestPrecedence +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledRound.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledRound.java new file mode 100644 index 00000000000..7d21b482c79 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledRound.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestRound; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledRound extends AbstractTestRound +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledTimes.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledTimes.java new file mode 100644 index 00000000000..9537237d8ab --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestCompiledTimes.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestTimes; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledTimes extends AbstractTestTimes +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestPowCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestPowCompiled.java new file mode 100644 index 00000000000..5d3426973b5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestPowCompiled.java @@ -0,0 +1,48 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestPow; +import org.finos.legend.pure.m3.tools.test.ToFix; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TestPowCompiled extends AbstractTestPow +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @ToFix + @Ignore + @Test + @Override + public void testPow() throws Exception + { + super.testPow(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestRem.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestRem.java new file mode 100644 index 00000000000..ceb8e0ffaf0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestRem.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestRem; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestRem extends AbstractTestRem +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestSqrt.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestSqrt.java new file mode 100644 index 00000000000..96f68db8fed --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/math/TestSqrt.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestSqrt; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestSqrt extends AbstractTestSqrt +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompileValueSpecification.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompileValueSpecification.java new file mode 100644 index 00000000000..a0f3a490177 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompileValueSpecification.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.RuntimeVerifier; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestCompileValueSpecification; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.CompiledMetadataStateVerifier; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TestCompileValueSpecification extends AbstractTestCompileValueSpecification +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Ignore + @Test + public void testExecuteSimpleBlockDeactivated() + { + //Not implemented in compiled mode due to function not available for classloader + } + + @Override + public ListIterable getExecutionVerifiers() + { + return Lists.fixedSize.with(new CompiledMetadataStateVerifier()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledCanReactivateDynamically.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledCanReactivateDynamically.java new file mode 100644 index 00000000000..b9c430c6ef4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledCanReactivateDynamically.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestCanReactivateDynamically; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompiledCanReactivateDynamically extends AbstractTestCanReactivateDynamically +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledId.java new file mode 100644 index 00000000000..467b43032ef --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestCompiledId.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestId; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestCompiledId extends AbstractTestId +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestFunctionDescriptorToIdCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestFunctionDescriptorToIdCompiled.java new file mode 100644 index 00000000000..9d226d81272 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestFunctionDescriptorToIdCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestFunctionDescriptorToId; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestFunctionDescriptorToIdCompiled extends AbstractTestFunctionDescriptorToId +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestInstanceOfCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestInstanceOfCompiled.java new file mode 100644 index 00000000000..b1d624e178b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestInstanceOfCompiled.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestInstanceOf; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInstanceOfCompiled extends AbstractTestInstanceOf +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewAssociationCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewAssociationCompiled.java new file mode 100644 index 00000000000..fa68df4f828 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewAssociationCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2021 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewAssociation; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNewAssociationCompiled extends AbstractTestNewAssociation +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewClassCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewClassCompiled.java new file mode 100644 index 00000000000..5f4f30f4518 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewClassCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewClass; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNewClassCompiled extends AbstractTestNewClass +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewLambdaFunctionCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewLambdaFunctionCompiled.java new file mode 100644 index 00000000000..3d4d73a345b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewLambdaFunctionCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewLambdaFunction; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNewLambdaFunctionCompiled extends AbstractTestNewLambdaFunction +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewQualifiedPropertyCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewQualifiedPropertyCompiled.java new file mode 100644 index 00000000000..48b89788e49 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestNewQualifiedPropertyCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewQualifiedProperty; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestNewQualifiedPropertyCompiled extends AbstractTestNewQualifiedProperty +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestPathToElement.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestPathToElement.java new file mode 100644 index 00000000000..e0053b9c9cc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestPathToElement.java @@ -0,0 +1,34 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestPathToElement; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.junit.BeforeClass; + +public class TestPathToElement extends AbstractTestPathToElement +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestReactivate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestReactivate.java new file mode 100644 index 00000000000..88a99b14ad8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/meta/TestReactivate.java @@ -0,0 +1,61 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestReactivate; +import org.finos.legend.pure.m3.tools.ThrowableTools; +import org.finos.legend.pure.runtime.java.compiled.compiler.PureJavaCompileException; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.finos.legend.pure.runtime.java.compiled.generation.JavaPackageAndImportBuilder; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TestReactivate extends AbstractTestReactivate +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @Test + public void testVariableScopeFail() + { + Exception e = Assert.assertThrows(Exception.class, this::compileAndExecuteVariableScopeFailure); + Throwable cause = ThrowableTools.findRootThrowable(e); + Assert.assertEquals(PureJavaCompileException.class, cause.getClass()); + + String expected = Pattern.quote("1 error compiling /" + JavaPackageAndImportBuilder.rootPackageFolder() + "/DynaClass.java\n" + + "/" + JavaPackageAndImportBuilder.rootPackageFolder() + "/DynaClass.java:") + "\\d*" + Pattern.quote(": error: cannot find symbol\n" + + " return (long)CompiledSupport.plus(Lists.mutable.with(_a,3l));\n" + + " ^\n" + + " symbol: variable _a\n" + + " location: class " + JavaPackageAndImportBuilder.rootPackage() + ".DynaClass\n"); + Pattern expectedPattern = Pattern.compile(expected); + Matcher matcher = expectedPattern.matcher(cause.getMessage()); + Assert.assertTrue("Failed to find pattern in message:\n" + cause.getMessage(), matcher.find()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToMultiplicity.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToMultiplicity.java new file mode 100644 index 00000000000..edc628cbea6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToMultiplicity.java @@ -0,0 +1,50 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToMultiplicity; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOne; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToMultiplicity extends AbstractTestToMultiplicity +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } + + @Override + public void testError() + { + // Can't throw the error in compiled (because [o] is unknown at compile time + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOne.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOne.java new file mode 100644 index 00000000000..9447dacc3a4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOne.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOne; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToOne extends AbstractTestToOne +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOneMany.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOneMany.java new file mode 100644 index 00000000000..b739e8709c0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/multiplicity/TestToOneMany.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOneMany; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToOneMany extends AbstractTestToOneMany +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/runtime/TestIsOptionSetCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/runtime/TestIsOptionSetCompiled.java new file mode 100644 index 00000000000..c708b87c61c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/runtime/TestIsOptionSetCompiled.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.runtime; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.runtime.AbstractTestIsOptionSet; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestIsOptionSetCompiled extends AbstractTestIsOptionSet +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestIsOptionSet.getOptions(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestCharCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestCharCompiled.java new file mode 100644 index 00000000000..5f336cf87a1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestCharCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestChar; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCharCompiled extends AbstractTestChar +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestChunk.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestChunk.java new file mode 100644 index 00000000000..f75ab41580c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestChunk.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestChunk; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestChunk extends AbstractTestChunk +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), AbstractTestChunk.getCodeStorage(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestDecodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestDecodeUrl.java new file mode 100644 index 00000000000..98d930f7d5a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestDecodeUrl.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestDecodeUrl; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestDecodeUrl extends AbstractTestDecodeUrl +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestEncodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestEncodeUrl.java new file mode 100644 index 00000000000..63d316df75d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestEncodeUrl.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestEncodeUrl; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestEncodeUrl extends AbstractTestEncodeUrl +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestFormat.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestFormat.java new file mode 100644 index 00000000000..b5c9156386a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestFormat.java @@ -0,0 +1,35 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestFormat; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestFormat extends AbstractTestFormat +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestIndexOfCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestIndexOfCompiled.java new file mode 100644 index 00000000000..2d1e41295d5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestIndexOfCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestIndexOf; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestIndexOfCompiled extends AbstractTestIndexOf +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestLengthCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestLengthCompiled.java new file mode 100644 index 00000000000..5064c7b3cea --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestLengthCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestLength; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestLengthCompiled extends AbstractTestLength +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseBooleanCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseBooleanCompiled.java new file mode 100644 index 00000000000..c36f83f395a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseBooleanCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseBoolean; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseBooleanCompiled extends AbstractTestParseBoolean +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseDateCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseDateCompiled.java new file mode 100644 index 00000000000..7fcd043e9fe --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseDateCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseDate; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseDateCompiled extends AbstractTestParseDate +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseFloatCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseFloatCompiled.java new file mode 100644 index 00000000000..a637282e89c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseFloatCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseFloat; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseFloatCompiled extends AbstractTestParseFloat +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseIntegerCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseIntegerCompiled.java new file mode 100644 index 00000000000..edfa20ff7bb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestParseIntegerCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseInteger; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseIntegerCompiled extends AbstractTestParseInteger +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestSubstringCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestSubstringCompiled.java new file mode 100644 index 00000000000..785bfb1c8b0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestSubstringCompiled.java @@ -0,0 +1,35 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestSubstring; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.BeforeClass; + +public class TestSubstringCompiled extends AbstractTestSubstring +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestToStringCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestToStringCompiled.java new file mode 100644 index 00000000000..2b14d3c72fb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestToStringCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestToString; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToStringCompiled extends AbstractTestToString +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestTrimCompiled.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestTrimCompiled.java new file mode 100644 index 00000000000..b4e113ed68e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/string/TestTrimCompiled.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestTrim; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestTrimCompiled extends AbstractTestTrim +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + } + + @After + public void cleanRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/tracing/TestCompiledTraceSpan.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/tracing/TestCompiledTraceSpan.java new file mode 100644 index 00000000000..4cffa275842 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/base/tracing/TestCompiledTraceSpan.java @@ -0,0 +1,45 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.base.tracing; + +import io.opentracing.util.GlobalTracer; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tests.function.base.tracing.AbstractTestTraceSpan; +import org.finos.legend.pure.runtime.java.compiled.execution.FunctionExecutionCompiledBuilder; +import org.finos.legend.pure.runtime.java.compiled.factory.JavaModelFactoryRegistryLoader; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCompiledTraceSpan extends AbstractTestTraceSpan +{ + @BeforeClass + public static void setUp() + { + AbstractPureTestWithCoreCompiled.setUpRuntime(getFunctionExecution(), JavaModelFactoryRegistryLoader.loader()); + GlobalTracer.registerIfAbsent(AbstractTestTraceSpan.tracer); + } + + @After + public void clearRuntime() + { + AbstractPureTestWithCoreCompiled.runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionCompiledBuilder().build(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/cipher/AESCipherUtilTest.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/cipher/AESCipherUtilTest.java new file mode 100644 index 00000000000..6172e8ea116 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/cipher/AESCipherUtilTest.java @@ -0,0 +1,46 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.cipher; + +import org.apache.commons.codec.binary.Base64; +import org.finos.legend.pure.runtime.java.extension.functions.shared.cipher.AESCipherUtil; +import org.junit.Assert; +import org.junit.Test; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +public class AESCipherUtilTest +{ + @Test + public void testEncryptDeCrypt() throws NoSuchPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException + { + SecureRandom secureRandom = new SecureRandom(); + byte[] key = new byte[16]; // 128 bits + secureRandom.nextBytes(key); + String keyString = Base64.encodeBase64String(key); + + String plainText = "This is a secret!"; + + byte[] cipherMessage = AESCipherUtil.encrypt(keyString, plainText.getBytes()); + byte[] decrypted = AESCipherUtil.decrypt(keyString, cipherMessage); + Assert.assertEquals(plainText, new String(decrypted)); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/TestBaseFunctions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/TestBaseFunctions.java new file mode 100644 index 00000000000..a522cb347fb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/TestBaseFunctions.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.pure; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class TestBaseFunctions +{ + public static Test suite() + { + return PureTestBuilderCompiled.buildSuite("meta::pure::functions"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/Test_Compiled_UnclassifiedFunctions_PCT.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/Test_Compiled_UnclassifiedFunctions_PCT.java new file mode 100644 index 00000000000..a27852122fb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-compiled-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/compiled/generation/processors/support/function/pure/Test_Compiled_UnclassifiedFunctions_PCT.java @@ -0,0 +1,65 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.pure; + +import junit.framework.Test; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.code.core.CoreUnclassifiedFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled.getClassLoaderExecutionSupport; + +public class Test_Compiled_UnclassifiedFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreUnclassifiedFunctionsCodeRepositoryProvider.unclassifiedFunctions; + private static final Adapter adapter = PlatformCodeRepositoryProvider.nativeAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.empty(); + + public static Test suite() + { + return PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/pom.xml new file mode 100644 index 00000000000..44fba096b53 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/pom.xml @@ -0,0 +1,161 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-unclassified + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified + jar + Legend Pure - Runtime - Java Extension - Interpreted - Functions - Base + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + org.finos.legend.pure + legend-pure-maven-generation-pct + + Interpreted + ${project.build.directory}/classes/pct-reports/ + + org.finos.legend.pure.runtime.java.interpreted.function.pure.Test_Interpreted_UnclassifiedFunctions_PCT + + + + + PCT-Generation + process-test-classes + + generate-pct-report + + + + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-interpreted + + + + org.finos.legend.pure + legend-pure-runtime-java-engine-shared + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + + io.opentracing + opentracing-api + + + io.opentracing + opentracing-util + + + + commons-codec + commons-codec + + + org.apache.commons + commons-text + + + + junit + junit + runtime + + + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + test + + + org.eclipse.collections + eclipse-collections-testutils + test + + + org.slf4j + jcl-over-slf4j + test + + + org.finos.legend.pure + legend-pure-m3-core + test-jar + test + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + test + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/Base_Interpreted_PCTReportProvider.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/Base_Interpreted_PCTReportProvider.java new file mode 100644 index 00000000000..d05afcd8394 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/Base_Interpreted_PCTReportProvider.java @@ -0,0 +1,39 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; +import org.finos.legend.pure.m3.pct.functions.model.Functions; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; + +public class Base_Interpreted_PCTReportProvider implements PCTReportProvider +{ + @Override + public MutableList getFunctions() + { + return Lists.mutable.empty(); + } + + @Override + public MutableList getAdapterReports() + { + return PCTReportProviderTool.load(Base_Interpreted_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_unclassified_interpreted_Native.json" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/FunctionExtensionInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/FunctionExtensionInterpreted.java new file mode 100644 index 00000000000..d0a51bf2bac --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/FunctionExtensionInterpreted.java @@ -0,0 +1,141 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted; + +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.AlloyTest; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.LegendTest; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.Profile; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.cipher.Cipher; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.cipher.Decipher; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.collection.Get; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.collection.Repeat; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date.DayOfWeekNumber; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date.DayOfYear; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date.Now; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date.Today; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date.WeekOfYear; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.hash.Hash; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.io.ReadFile; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.io.http.Http; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.lang.MutateAdd; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.CompileValueSpecification; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.FunctionDescriptorToId; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.IsSourceReadOnly; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.IsValidFunctionDescriptor; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewAssociation; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewClass; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewEnumeration; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewLambdaFunction; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewProperty; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta.NewQualifiedProperty; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime.CurrentUserId; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime.Guid; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime.IsOptionSet; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.ASCII; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.Char; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.Chunk; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.DecodeBase64; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.DecodeUrl; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.EncodeBase64; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.EncodeUrl; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.JaroWinklerSimilarity; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.LevenshteinDistance; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string.Matches; +import org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.tracing.TraceSpan; +import org.finos.legend.pure.runtime.java.interpreted.extension.BaseInterpretedExtension; + +public class FunctionExtensionInterpreted extends BaseInterpretedExtension +{ + public FunctionExtensionInterpreted() + { + super(//Cipher + Tuples.pair("encrypt_String_1__String_1__String_1_", Cipher::new), + Tuples.pair("encrypt_Number_1__String_1__String_1_", Cipher::new), + Tuples.pair("encrypt_Boolean_1__String_1__String_1_", Cipher::new), + Tuples.pair("decrypt_String_1__String_1__String_1_", Decipher::new), + + //Collection + Tuples.pair("get_T_MANY__String_1__T_$0_1$_", Get::new), + Tuples.pair("repeat_T_1__Integer_1__T_MANY_", Repeat::new), + + //Date + Tuples.pair("dayOfWeekNumber_Date_1__Integer_1_", DayOfWeekNumber::new), + Tuples.pair("dayOfYear_Date_1__Integer_1_", DayOfYear::new), + Tuples.pair("now__DateTime_1_", Now::new), + Tuples.pair("today__StrictDate_1_", Today::new), + Tuples.pair("weekOfYear_Date_1__Integer_1_", WeekOfYear::new), + + //Hash + Tuples.pair("hash_String_1__HashType_1__String_1_", Hash::new), + + //IO + Tuples.pair("executeHTTPRaw_URL_1__HTTPMethod_1__String_$0_1$__String_$0_1$__HTTPResponse_1_", Http::new), + Tuples.pair("readFile_String_1__String_$0_1$__String_$0_1$_", ReadFile::new), + + //Lang + Tuples.pair("mutateAdd_T_1__String_1__Any_MANY__T_1_", MutateAdd::new), + + //Meta + Tuples.pair("compileValueSpecification_String_m__CompilationResult_m_", CompileValueSpecification::new), + Tuples.pair("functionDescriptorToId_String_1__String_1_", FunctionDescriptorToId::new), + Tuples.pair("isSourceReadOnly_String_1__Boolean_1_", IsSourceReadOnly::new), + Tuples.pair("isValidFunctionDescriptor_String_1__Boolean_1_", IsValidFunctionDescriptor::new), + Tuples.pair("newAssociation_String_1__Property_1__Property_1__Association_1_", NewAssociation::new), + Tuples.pair("newClass_String_1__Class_1_", NewClass::new), + Tuples.pair("newEnumeration_String_1__String_MANY__Enumeration_1_", NewEnumeration::new), + Tuples.pair("newLambdaFunction_FunctionType_1__LambdaFunction_1_", NewLambdaFunction::new), + Tuples.pair("newProperty_String_1__GenericType_1__GenericType_1__Multiplicity_1__Property_1_", NewProperty::new), + Tuples.pair("newQualifiedProperty_String_1__GenericType_1__GenericType_1__Multiplicity_1__VariableExpression_MANY__QualifiedProperty_1_", NewQualifiedProperty::new), + + + //Runtime + Tuples.pair("currentUserId__String_1_", CurrentUserId::new), + Tuples.pair("generateGuid__String_1_", Guid::new), + Tuples.pair("isOptionSet_String_1__Boolean_1_", IsOptionSet::new), + + + //String + Tuples.pair("ascii_String_1__Integer_1_", ASCII::new), + Tuples.pair("char_Integer_1__String_1_", Char::new), + Tuples.pair("chunk_String_1__Integer_1__String_MANY_", Chunk::new), + Tuples.pair("encodeBase64_String_1__String_1_", EncodeBase64::new), + Tuples.pair("decodeBase64_String_1__String_1_", DecodeBase64::new), + Tuples.pair("encodeUrl_String_1__String_1__String_1_", EncodeUrl::new), + Tuples.pair("decodeUrl_String_1__String_1__String_1_", DecodeUrl::new), + Tuples.pair("matches_String_1__String_1__Boolean_1_", Matches::new), + Tuples.pair("jaroWinklerSimilarity_String_1__String_1__Float_1_", JaroWinklerSimilarity::new), + Tuples.pair("levenshteinDistance_String_1__String_1__Integer_1_", LevenshteinDistance::new), + + //Tracing + Tuples.pair("traceSpan_Function_1__String_1__V_m_", TraceSpan::new), + Tuples.pair("traceSpan_Function_1__String_1__Function_1__V_m_", TraceSpan::new), + Tuples.pair("traceSpan_Function_1__String_1__Function_1__Boolean_1__V_m_", TraceSpan::new), + + //LegendTests + Tuples.pair("mayExecuteLegendTest_Function_1__Function_1__X_k_", LegendTest::new), + Tuples.pair("mayExecuteAlloyTest_Function_1__Function_1__X_k_", AlloyTest::new), + + //Tools + Tuples.pair("profile_T_m__Boolean_1__ProfileResult_1_", Profile::new) + + ); + } + + public static FunctionExtensionInterpreted extension() + { + return new FunctionExtensionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/AlloyTest.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/AlloyTest.java new file mode 100644 index 00000000000..6385dd226cb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/AlloyTest.java @@ -0,0 +1,101 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.FunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class AlloyTest extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + private final ModelRepository repository; + + public AlloyTest(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, final ProcessorSupport processorSupport) throws PureExecutionException + { + String clientVersion = System.getProperty("alloy.test.clientVersion"); + String serverVersion = System.getProperty("alloy.test.serverVersion"); + String host = System.getProperty("alloy.test.server.host"); + int port = System.getProperty("alloy.test.server.port") == null ? -1 : Integer.parseInt(System.getProperty("alloy.test.server.port")); + + if (host != null) + { + if (port == -1) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'alloy.test.server.host' is set to '" + host + "' however 'alloy.test.server.port' has not been set!"); + } + if (clientVersion == null) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'alloy.test.clientVersion' should be set"); + } + if (serverVersion == null) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'alloy.test.serverVersion' should be set"); + } + MutableList fParams = Lists.mutable.with( + ValueSpecificationBootstrap.newStringLiteral(this.repository, clientVersion, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newStringLiteral(this.repository, serverVersion, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newStringLiteral(this.repository, host, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newIntegerLiteral(this.repository, port, this.functionExecution.getProcessorSupport())); + + return this.functionExecution.executeFunctionExecuteParams(FunctionCoreInstanceWrapper.toFunction(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport)), + fParams, + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + } + else + { + return this.functionExecution.executeFunctionExecuteParams(FunctionCoreInstanceWrapper.toFunction(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)), + Lists.immutable.empty(), + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/LegendTest.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/LegendTest.java new file mode 100644 index 00000000000..f8af71f063d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/LegendTest.java @@ -0,0 +1,108 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.FunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class LegendTest extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + private final ModelRepository repository; + + public LegendTest(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String clientVersion = System.getProperty("legend.test.clientVersion"); + String serverVersion = System.getProperty("legend.test.serverVersion"); + String serializationKind = System.getProperty("legend.test.serializationKind"); + String host = System.getProperty("legend.test.server.host"); + int port = System.getProperty("legend.test.server.port") == null ? -1 : Integer.parseInt(System.getProperty("legend.test.server.port")); + + if (host != null) + { + if (port == -1) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'legend.test.server.host' is set to '" + host + "' however 'legend.test.server.port' has not been set!"); + } + if (serializationKind == null || !(serializationKind.equals("text") || serializationKind.equals("json"))) + { + serializationKind = "json"; + } + if (clientVersion == null) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'legend.test.clientVersion' should be set"); + } + if (serverVersion == null) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "The system variable 'legend.test.serverVersion' should be set"); + } + MutableList fParams = Lists.mutable.with( + ValueSpecificationBootstrap.newStringLiteral(this.repository, clientVersion, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newStringLiteral(this.repository, serverVersion, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newStringLiteral(this.repository, serializationKind, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newStringLiteral(this.repository, host, this.functionExecution.getProcessorSupport()), + ValueSpecificationBootstrap.newIntegerLiteral(this.repository, port, this.functionExecution.getProcessorSupport())); + + return this.functionExecution.executeFunctionExecuteParams(FunctionCoreInstanceWrapper.toFunction(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport)), + fParams, + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + } + else + { + return this.functionExecution.executeFunctionExecuteParams(FunctionCoreInstanceWrapper.toFunction(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)), + Lists.immutable.empty(), + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/Profile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/Profile.java new file mode 100644 index 00000000000..297be67cf29 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/Profile.java @@ -0,0 +1,90 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.io.Print; +import org.finos.legend.pure.runtime.java.interpreted.profiler.ActiveProfiler; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Profile extends NativeFunction +{ + private static final int PRINT_DEPTH = 10; + + private final Print print; + private final FunctionExecutionInterpreted functionExecution; + private final ModelRepository repository; + + public Profile(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + this.repository = repository; + this.print = new Print(functionExecution, repository); + } + + @Override + public boolean deferParameterExecution() + { + return true; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + ActiveProfiler activeProfiler = new ActiveProfiler(processorSupport, PrimitiveUtilities.getBooleanValue(params.get(1).getValueForMetaPropertyToOne(M3Properties.values))); + activeProfiler.start(functionExpressionToUseInStack); + CoreInstance result = this.functionExecution.executeValueSpecification(params.get(0), resolvedTypeParameters, resolvedMultiplicityParameters, functionExpressionToUseInStack, + this.getParentOrEmptyVariableContext(variableContext), activeProfiler, instantiationContext, executionSupport); + activeProfiler.end(functionExpressionToUseInStack); + this.print.execute(Lists.immutable.with(ValueSpecificationBootstrap.newStringLiteral(this.repository, activeProfiler.getReport(), processorSupport), ValueSpecificationBootstrap.newIntegerLiteral(this.repository, PRINT_DEPTH, processorSupport)), resolvedTypeParameters, resolvedMultiplicityParameters, variableContext, functionExpressionToUseInStack, profiler, instantiationContext, executionSupport, context, processorSupport); + + CoreInstance profileResultType = processorSupport.package_getByUserPath("meta::pure::functions::tools::ProfileResult"); + CoreInstance profileResult = this.repository.newEphemeralAnonymousCoreInstance(null, profileResultType); + + CoreInstance genericTypeType = processorSupport.package_getByUserPath(M3Paths.GenericType); + CoreInstance classifierGenericType = this.repository.newAnonymousCoreInstance(functionExpressionToUseInStack.getSourceInformation(), genericTypeType); + Instance.addValueToProperty(classifierGenericType, M3Properties.rawType, profileResultType, processorSupport); + CoreInstance T = Instance.extractGenericTypeFromInstance(result, processorSupport); + Instance.addValueToProperty(classifierGenericType, M3Properties.typeArguments, T, processorSupport); + CoreInstance m = Instance.getValueForMetaPropertyToOneResolved(result, M3Properties.multiplicity, processorSupport); + Instance.addValueToProperty(classifierGenericType, M3Properties.multiplicityArguments, m, processorSupport); + + Instance.addValueToProperty(profileResult, M3Properties.classifierGenericType, classifierGenericType, processorSupport); + + Instance.addValueToProperty(profileResult, "report", this.repository.newEphemeralCoreInstance(activeProfiler.getReport(), processorSupport.package_getByUserPath("String"), null), processorSupport); + Instance.addValueToProperty(profileResult, "result", result.getValueForMetaPropertyToMany(M3Properties.values), processorSupport); + + return ValueSpecificationBootstrap.wrapValueSpecification(profileResult, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Cipher.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Cipher.java new file mode 100644 index 00000000000..999a70c98a4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Cipher.java @@ -0,0 +1,65 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.cipher; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.extension.functions.shared.cipher.AESCipherUtil; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Cipher extends NativeFunction +{ + private final ModelRepository repository; + + public Cipher(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String value = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String key = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + + byte[] encrypted; + try + { + encrypted = AESCipherUtil.encrypt(key, value.getBytes()); + } + catch (Exception e) + { + throw new PureExecutionException("Error ciphering value '" + value + "' with key '" + key + "'.", e); + } + + CoreInstance result = this.repository.newStringCoreInstance(new String(encrypted)); + return ValueSpecificationBootstrap.wrapValueSpecification(result, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Decipher.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Decipher.java new file mode 100644 index 00000000000..2acd801e5d4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/cipher/Decipher.java @@ -0,0 +1,65 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.cipher; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.extension.functions.shared.cipher.AESCipherUtil; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Decipher extends NativeFunction +{ + private final ModelRepository repository; + + public Decipher(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String value = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String key = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + + byte[] decrypted; + try + { + decrypted = AESCipherUtil.decrypt(key, value.getBytes()); + } + catch (Exception e) + { + throw new PureExecutionException("Error deciphering value '" + value + "' with key '" + key + "'.", e); + } + + CoreInstance result = this.repository.newStringCoreInstance(new String(decrypted)); + return ValueSpecificationBootstrap.wrapValueSpecification(result, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Get.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Get.java new file mode 100644 index 00000000000..74332d9c3a8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Get.java @@ -0,0 +1,57 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.collection; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Get extends NativeFunction +{ + public Get(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + ListIterable values = Instance.getValueForMetaPropertyToManyResolved(params.get(0), M3Properties.values, processorSupport); + String key = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + for (CoreInstance value : values) + { + if (key.equals(value.getName())) + { + return ValueSpecificationBootstrap.wrapValueSpecification(value, ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } + } + return ValueSpecificationBootstrap.wrapValueSpecification(Lists.immutable.empty(), true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Repeat.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Repeat.java new file mode 100644 index 00000000000..c9e5ba5f6ce --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/collection/Repeat.java @@ -0,0 +1,69 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.collection; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Repeat extends NativeFunction +{ + public Repeat(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + int n = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)).intValue(); + if (n == 1) + { + return params.get(0); + } + + if (n <= 0) + { + return ValueSpecificationBootstrap.wrapValueSpecification(Lists.immutable.empty(), true, processorSupport); + } + + CoreInstance element = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport); + boolean executable = ValueSpecification.isExecutable(params.get(0), processorSupport); + MutableList elements = FastList.newList(n); + for (; n > 0; n--) + { + elements.add(element); + } + return ValueSpecificationBootstrap.wrapValueSpecification(elements, executable, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfWeekNumber.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfWeekNumber.java new file mode 100644 index 00000000000..9cb3a19f4ac --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfWeekNumber.java @@ -0,0 +1,74 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import java.util.Calendar; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.date.extract.NativeDateElementFunction; + +public class DayOfWeekNumber extends NativeDateElementFunction +{ + public DayOfWeekNumber(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected int getDateElement(PureDate date) throws InvalidDateElementException + { + if (!date.hasDay()) + { + throw new InvalidDateElementException("Cannot get day of week for " + date); + } + switch (date.getCalendar().get(Calendar.DAY_OF_WEEK)) + { + case Calendar.MONDAY: + { + return 1; + } + case Calendar.TUESDAY: + { + return 2; + } + case Calendar.WEDNESDAY: + { + return 3; + } + case Calendar.THURSDAY: + { + return 4; + } + case Calendar.FRIDAY: + { + return 5; + } + case Calendar.SATURDAY: + { + return 6; + } + case Calendar.SUNDAY: + { + return 7; + } + default: + { + throw new RuntimeException("Error getting day of week for " + date); + } + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfYear.java new file mode 100644 index 00000000000..d0ca7f76421 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/DayOfYear.java @@ -0,0 +1,40 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.date.extract.NativeDateElementFunction; + +import java.util.Calendar; + +public class DayOfYear extends NativeDateElementFunction +{ + public DayOfYear(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected int getDateElement(PureDate date) throws InvalidDateElementException + { + if (!date.hasDay()) + { + throw new InvalidDateElementException("Cannot get day of year for " + date); + } + return date.getCalendar().get(Calendar.DAY_OF_YEAR); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/NativeDateIndexicalFunction.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/NativeDateIndexicalFunction.java new file mode 100644 index 00000000000..598f044cbd5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/NativeDateIndexicalFunction.java @@ -0,0 +1,50 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +abstract class NativeDateIndexicalFunction extends NativeFunction +{ + private final ModelRepository repository; + + protected NativeDateIndexicalFunction(ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + return ValueSpecificationBootstrap.newDateLiteral(this.repository, getDate(), processorSupport); + } + + protected abstract PureDate getDate(); +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Now.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Now.java new file mode 100644 index 00000000000..78bb2968a4b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Now.java @@ -0,0 +1,36 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; + +import java.time.Instant; + +public class Now extends NativeDateIndexicalFunction +{ + public Now(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected PureDate getDate() + { + return DateFunctions.fromInstant(Instant.now(), 3); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Today.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Today.java new file mode 100644 index 00000000000..9c1a49e20aa --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/Today.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; + +public class Today extends NativeDateIndexicalFunction +{ + public Today(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected PureDate getDate() + { + return DateFunctions.today(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/WeekOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/WeekOfYear.java new file mode 100644 index 00000000000..d40f51d4a1b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/date/WeekOfYear.java @@ -0,0 +1,40 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.date; + +import java.util.Calendar; + +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.date.extract.NativeDateElementFunction; + +public class WeekOfYear extends NativeDateElementFunction +{ + public WeekOfYear(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected int getDateElement(PureDate date) throws InvalidDateElementException + { + if (!date.hasDay()) + { + throw new InvalidDateElementException("Cannot get week of year for " + date); + } + return date.getCalendar().get(Calendar.WEEK_OF_YEAR); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/hash/Hash.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/hash/Hash.java new file mode 100644 index 00000000000..ebcad23e850 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/hash/Hash.java @@ -0,0 +1,70 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.hash; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.shared.hash.HashType; +import org.finos.legend.pure.runtime.java.shared.hash.HashingUtil; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Hash extends NativeFunction +{ + private final ModelRepository modelRepository; + + public Hash(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.modelRepository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + // Parameter 0: text + String text = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport)); + + // Parameter 1: hashType + CoreInstance enumeration = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + String enumName = enumeration.getName(); + HashType hashType = HashType.valueOf(enumName); + + try + { + String hashResult = HashingUtil.hash(text, hashType); + CoreInstance result = this.modelRepository.newStringCoreInstance(hashResult); + return ValueSpecificationBootstrap.wrapValueSpecification(result, true, processorSupport); + } + catch (Exception e) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Error occurred in hashing: " + e.getMessage(), e); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/ReadFile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/ReadFile.java new file mode 100644 index 00000000000..7491986b979 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/ReadFile.java @@ -0,0 +1,62 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.io; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.RepositoryCodeStorage; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class ReadFile extends NativeFunction +{ + private final ModelRepository repository; + private final RepositoryCodeStorage codeStorage; + + public ReadFile(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + this.codeStorage = functionExecution.getStorage(); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String filePath = PrimitiveUtilities.getStringValue(params.get(0).getValueForMetaPropertyToOne(M3Properties.values)); + if ((this.codeStorage == null) || !this.codeStorage.exists(filePath)) + { + return ValueSpecificationBootstrap.wrapValueSpecification(Lists.immutable.empty(), true, processorSupport); + } + + String lineSep = PrimitiveUtilities.getStringValue(params.get(1).getValueForMetaPropertyToOne(M3Properties.values), null); + String content = this.codeStorage.getContentAsText(filePath); + return ValueSpecificationBootstrap.newStringLiteral(this.repository, (lineSep == null) ? content : content.replaceAll("\\R", lineSep), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/http/Http.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/http/Http.java new file mode 100644 index 00000000000..a0be59cb816 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/io/http/Http.java @@ -0,0 +1,84 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.io.http; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.finos.legend.pure.runtime.java.shared.http.HttpMethod; +import org.finos.legend.pure.runtime.java.shared.http.URLScheme; +import org.finos.legend.pure.runtime.java.shared.http.HttpRawHelper; +import org.finos.legend.pure.runtime.java.shared.http.SimpleHttpResponse; + +import java.util.Stack; + +public class Http extends NativeFunction +{ + private ModelRepository repository; + + public Http(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + // URL: param 0 + CoreInstance urlInstance = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport); + + URLScheme urlScheme = URLScheme.http; + CoreInstance scheme = Instance.getValueForMetaPropertyToOneResolved(urlInstance, "scheme", processorSupport); + if (scheme != null) + { + urlScheme = URLScheme.valueOf(scheme.getName()); + } + String host = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(urlInstance, M3Properties.host, processorSupport)); + Integer port = (Integer)PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(urlInstance, M3Properties.port, processorSupport)); + String path = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(urlInstance, M3Properties.path, processorSupport)); + + // HTTPMethod: param 1 + CoreInstance enumeration = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + String enumName = enumeration.getName(); + HttpMethod httpMethod = HttpMethod.valueOf(enumName); + + // String (mimeType): param 2 + CoreInstance mimeTypeInstance = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + String mimeType = mimeTypeInstance == null ? null : PrimitiveUtilities.getStringValue(mimeTypeInstance); + + // String (body): param 3 + CoreInstance bodyInstance = Instance.getValueForMetaPropertyToOneResolved(params.get(3), M3Properties.values, processorSupport); + String body = bodyInstance == null ? null : PrimitiveUtilities.getStringValue(bodyInstance); + + SimpleHttpResponse response = HttpRawHelper.executeHttpService(urlScheme, host, port, path, httpMethod, mimeType, body); + + return ValueSpecificationBootstrap.wrapValueSpecification(HttpRawHelper.toHttpResponseInstance(response, processorSupport), true, processorSupport); + } + +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/lang/MutateAdd.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/lang/MutateAdd.java new file mode 100644 index 00000000000..2938c7f0070 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/lang/MutateAdd.java @@ -0,0 +1,51 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.lang; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class MutateAdd extends NativeFunction +{ + public MutateAdd(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + CoreInstance obj = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport); + String propertyName = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + ListIterable values = Instance.getValueForMetaPropertyToManyResolved(params.get(2), M3Properties.values, processorSupport); + //Instance.removeProperty(obj, propertyName); + Instance.addValueToProperty(obj, propertyName, values, processorSupport); + return params.get(0); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/CompileValueSpecification.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/CompileValueSpecification.java new file mode 100644 index 00000000000..7238e13a482 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/CompileValueSpecification.java @@ -0,0 +1,115 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.serialization.grammar.antlr.PureParserException; +import org.finos.legend.pure.m3.serialization.runtime.IncrementalCompiler.IncrementalCompilerTransaction; +import org.finos.legend.pure.m3.serialization.runtime.PureRuntime; +import org.finos.legend.pure.m3.serialization.runtime.Source; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.exception.PureCompilationException; +import org.finos.legend.pure.m4.transaction.framework.ThreadLocalTransactionContext; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.essentials.meta.source.SourceInformation; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class CompileValueSpecification extends NativeFunction +{ + private static final String COMPILATION_RESULT_CLASS = "meta::pure::functions::meta::CompilationResult"; + private static final String COMPILATION_FAILURE_CLASS = "meta::pure::functions::meta::CompilationFailure"; + + private final PureRuntime runtime; + + public CompileValueSpecification(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.runtime = functionExecution.getRuntime(); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + ListIterable codeBlocks = Instance.getValueForMetaPropertyToManyResolved(params.get(0), M3Properties.values, processorSupport); + MutableList results = FastList.newList(codeBlocks.size()); + + for (CoreInstance codeBlock : codeBlocks) + { + String code = codeBlock.getName(); + + CoreInstance functionInstance = null; + CoreInstance expression = null; + String failureMessage = null; + org.finos.legend.pure.m4.coreinstance.SourceInformation failureSourceInfo = null; + IncrementalCompilerTransaction transaction = this.runtime.getIncrementalCompiler().newTransaction(false); + try (ThreadLocalTransactionContext ignore = transaction.openInCurrentThread()) + { + Source source = this.runtime.createInMemoryCodeBlock(code); + this.runtime.getIncrementalCompiler().compileInCurrentTransaction(source); + functionInstance = source.getNewInstances().getFirst(); + expression = functionInstance.getValueForMetaPropertyToOne(M3Properties.expressionSequence); + } + catch (PureCompilationException | PureParserException ex) + { + failureMessage = ex.getOriginatingPureException().getInfo(); + failureSourceInfo = ex.getOriginatingPureException().getSourceInformation(); + } + finally + { + transaction.rollback(); + } + + //Now build a result - THIS MUST BE DONE LAST, otherwise it will be rolled back along with the changes above + CoreInstance result = this.runtime.getModelRepository().newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(COMPILATION_RESULT_CLASS)); + + if (failureMessage != null) + { + CoreInstance failure = this.runtime.getModelRepository().newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(COMPILATION_FAILURE_CLASS)); + CoreInstance message = this.runtime.getModelRepository().newStringCoreInstance(failureMessage); + Instance.addValueToProperty(failure, "message", message, processorSupport); + + if (failureSourceInfo != null) + { + CoreInstance sourceInfoCoreInstance = SourceInformation.createSourceInfoCoreInstanceWithoutSourceId(this.runtime.getModelRepository(), processorSupport, failureSourceInfo); + Instance.addValueToProperty(failure, "sourceInformation", sourceInfoCoreInstance, processorSupport); + } + + Instance.addValueToProperty(result, "failure", failure, processorSupport); + } + else if (expression != null) + { + Instance.addValueToProperty(result, "result", ValueSpecificationBootstrap.wrapValueSpecification(expression, false, processorSupport), processorSupport); + } + + results.add(result); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(results, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/FunctionDescriptorToId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/FunctionDescriptorToId.java new file mode 100644 index 00000000000..22eb8eee484 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/FunctionDescriptorToId.java @@ -0,0 +1,62 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.function.FunctionDescriptor; +import org.finos.legend.pure.m3.navigation.function.InvalidFunctionDescriptorException; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class FunctionDescriptorToId extends NativeFunction +{ + private final ModelRepository repository; + + public FunctionDescriptorToId(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String functionDescriptor = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String id = null; + try + { + id = FunctionDescriptor.functionDescriptorToId(functionDescriptor); + } + catch (InvalidFunctionDescriptorException e) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Invalid function descriptor: " + functionDescriptor, e); + } + return ValueSpecificationBootstrap.newStringLiteral(this.repository, id, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsSourceReadOnly.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsSourceReadOnly.java new file mode 100644 index 00000000000..d7a7209ad91 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsSourceReadOnly.java @@ -0,0 +1,51 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.serialization.runtime.PureRuntime; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class IsSourceReadOnly extends NativeFunction +{ + private final PureRuntime pureRuntime; + + public IsSourceReadOnly(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.pureRuntime = functionExecution.getPureRuntime(); + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + return ValueSpecificationBootstrap.newBooleanLiteral(this.pureRuntime.getModelRepository(), this.pureRuntime.isSourceImmutable(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName()), processorSupport); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsValidFunctionDescriptor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsValidFunctionDescriptor.java new file mode 100644 index 00000000000..fbc61f2d047 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/IsValidFunctionDescriptor.java @@ -0,0 +1,53 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.function.FunctionDescriptor; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class IsValidFunctionDescriptor extends NativeFunction +{ + private final ModelRepository repository; + + public IsValidFunctionDescriptor(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String possiblyFunctionDescriptor = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + boolean isValidFunctionDescriptor = FunctionDescriptor.isValidFunctionDescriptor(possiblyFunctionDescriptor); + return ValueSpecificationBootstrap.newBooleanLiteral(this.repository, isValidFunctionDescriptor, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewAssociation.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewAssociation.java new file mode 100644 index 00000000000..f5b201aea5f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewAssociation.java @@ -0,0 +1,75 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.compiler.postprocessing.PostProcessor; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.serialization.grammar.ParserLibrary; +import org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSLLibrary; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewAssociation extends NativeFunction +{ + private final ModelRepository repository; + + public NewAssociation(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String fullPathString = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.getFirst(), M3Properties.values, processorSupport)); + ListIterable fullPath = PackageableElement.splitUserPath(fullPathString); + if (fullPath.isEmpty()) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Cannot create a new Association: '" + fullPathString + "'"); + } + String name = fullPath.getLast(); + CoreInstance pack = _Package.findOrCreatePackageFromUserPath(fullPath.subList(0, fullPath.size() - 1), this.repository, processorSupport); + + CoreInstance newAssociation = this.repository.newCoreInstance(name, processorSupport.package_getByUserPath(M3Paths.Association), null); + Instance.addValueToProperty(newAssociation, M3Properties.name, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + Instance.addValueToProperty(newAssociation, M3Properties.properties, Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport), processorSupport); + Instance.addValueToProperty(newAssociation, M3Properties.properties, Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport), processorSupport); + PostProcessor.process(Lists.immutable.with(newAssociation), this.repository, new ParserLibrary(), new InlineDSLLibrary(), null, context, processorSupport, null, null); + + Instance.addValueToProperty(newAssociation, M3Properties._package, pack, processorSupport); + + return ValueSpecificationBootstrap.wrapValueSpecification(newAssociation, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewClass.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewClass.java new file mode 100644 index 00000000000..5ff5df76e81 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewClass.java @@ -0,0 +1,86 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.navigation.type.Type; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewClass extends NativeFunction +{ + private final ModelRepository repository; + + public NewClass(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String fullPathString = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.getFirst(), M3Properties.values, processorSupport)); + ListIterable fullPath = PackageableElement.splitUserPath(fullPathString); + if (fullPath.isEmpty()) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Cannot create a new Class: '" + fullPathString + "'"); + } + String name = fullPath.getLast(); + + CoreInstance pack = _Package.findOrCreateEphemeralPackageFromUserPath(fullPath.subList(0, fullPath.size() - 1), this.repository, processorSupport); + CoreInstance newClass = this.repository.newEphemeralCoreInstance(name, processorSupport.package_getByUserPath(M3Paths.Class), null); + + //classifierGenericType + CoreInstance selfGenericType = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(selfGenericType, M3Properties.rawType, newClass, processorSupport); + CoreInstance genericType = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(genericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.Class), processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, selfGenericType, processorSupport); + + // generalizations + CoreInstance generalization = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.Generalization)); + Instance.addValueToProperty(generalization, M3Properties.specific, newClass, processorSupport); + Instance.addValueToProperty(generalization, M3Properties.general, Type.wrapGenericType(processorSupport.type_TopType(), processorSupport), processorSupport); + + Instance.addValueToProperty(newClass, M3Properties.classifierGenericType, genericType, processorSupport); + Instance.addValueToProperty(newClass, M3Properties.generalizations, generalization, processorSupport); + + // name + Instance.addValueToProperty(newClass, M3Properties.name, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + + Instance.addValueToProperty(newClass, M3Properties._package, pack, processorSupport); + + return ValueSpecificationBootstrap.wrapValueSpecification(newClass, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewEnumeration.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewEnumeration.java new file mode 100644 index 00000000000..3b638586e14 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewEnumeration.java @@ -0,0 +1,93 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation._package._Package; +import org.finos.legend.pure.m3.navigation.type.Type; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewEnumeration extends NativeFunction +{ + private final ModelRepository repository; + + public NewEnumeration(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String fullPathString = PrimitiveUtilities.getStringValue(Instance.getValueForMetaPropertyToOneResolved(params.getFirst(), M3Properties.values, processorSupport)); + ListIterable fullPath = PackageableElement.splitUserPath(fullPathString); + if (fullPath.isEmpty()) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Cannot create a new Enumeration: '" + fullPathString + "'"); + } + String name = fullPath.getLast(); + CoreInstance pack = _Package.findOrCreatePackageFromUserPath(fullPath.subList(0, fullPath.size() - 1), this.repository, processorSupport); + + CoreInstance newEnumeration = this.repository.newCoreInstance(name, processorSupport.package_getByUserPath(M3Paths.Enumeration), null); + + //classifierGenericType + CoreInstance selfGenericType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(selfGenericType, M3Properties.rawType, newEnumeration, processorSupport); + CoreInstance genericType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(genericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.Enumeration), processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, selfGenericType, processorSupport); + + // generalizations + CoreInstance generalization = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.Generalization)); + Instance.addValueToProperty(generalization, M3Properties.specific, newEnumeration, processorSupport); + Instance.addValueToProperty(generalization, M3Properties.general, Type.wrapGenericType(processorSupport.package_getByUserPath(M3Paths.Enum), processorSupport), processorSupport); + + Instance.addValueToProperty(newEnumeration, M3Properties.classifierGenericType, genericType, processorSupport); + Instance.addValueToProperty(newEnumeration, M3Properties.generalizations, generalization, processorSupport); + + // name + Instance.addValueToProperty(newEnumeration, M3Properties.name, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + + Instance.addValueToProperty(newEnumeration, M3Properties._package, pack, processorSupport); + + // Enum values + ListIterable values = Instance.getValueForMetaPropertyToManyResolved(params.get(1), M3Properties.values, processorSupport); + for (CoreInstance val : values) + { + Instance.addValueToProperty(newEnumeration, M3Properties.values, this.repository.newCoreInstance(val.getName(), newEnumeration, null), processorSupport); + } + + return ValueSpecificationBootstrap.wrapValueSpecification(newEnumeration, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewLambdaFunction.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewLambdaFunction.java new file mode 100644 index 00000000000..f557a529543 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewLambdaFunction.java @@ -0,0 +1,59 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewLambdaFunction extends NativeFunction +{ + private final ModelRepository repository; + + public NewLambdaFunction(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + CoreInstance genericType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(genericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.LambdaFunction), processorSupport); + CoreInstance funcTypeGenericType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(funcTypeGenericType, M3Properties.rawType, Instance.getValueForMetaPropertyToOneResolved(params.getFirst(), M3Properties.values, processorSupport), processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, funcTypeGenericType, processorSupport); + + CoreInstance newFunction = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.LambdaFunction)); + Instance.addValueToProperty(newFunction, M3Properties.classifierGenericType, genericType, processorSupport); + return ValueSpecificationBootstrap.wrapValueSpecification(newFunction, true, processorSupport); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewProperty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewProperty.java new file mode 100644 index 00000000000..b93067594e1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewProperty.java @@ -0,0 +1,89 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.generictype.GenericType; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewProperty extends NativeFunction +{ + private final ModelRepository repository; + + public NewProperty(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String name = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + CoreInstance ownerGenericType = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + CoreInstance targetGenericType = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + CoreInstance multiplicity = Instance.getValueForMetaPropertyToOneResolved(params.get(3), M3Properties.values, processorSupport); + + CoreInstance newProperty = this.repository.newEphemeralCoreInstance(name, processorSupport.package_getByUserPath(M3Paths.Property), null); + + // validate property owner + CoreInstance owner = Instance.getValueForMetaPropertyToOneResolved(ownerGenericType, M3Properties.rawType, processorSupport); + if ((owner == null) || !Instance.instanceOf(owner, M3Paths.PropertyOwner, processorSupport)) + { + StringBuilder message = new StringBuilder("Invalid property owner: "); + GenericType.print(message, ownerGenericType, processorSupport); + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), message.toString()); + } + + // classifierGenericType + CoreInstance genericType = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(genericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.Property), processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, ownerGenericType, processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, targetGenericType, processorSupport); + Instance.addValueToProperty(genericType, M3Properties.multiplicityArguments, multiplicity, processorSupport); + + Instance.addValueToProperty(newProperty, M3Properties.classifierGenericType, genericType, processorSupport); + + Instance.addValueToProperty(newProperty, M3Properties.genericType, targetGenericType, processorSupport); + Instance.addValueToProperty(newProperty, M3Properties.multiplicity, multiplicity, processorSupport); + + // name + Instance.addValueToProperty(newProperty, M3Properties.name, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + + // aggregation + Instance.addValueToProperty(newProperty, M3Properties.aggregation, processorSupport.package_getByUserPath(M3Paths.AggregationKind).getValueInValueForMetaPropertyToMany(M3Properties.values, "None"), processorSupport); + + // owner + Instance.addValueToProperty(newProperty, M3Properties.owner, Instance.getValueForMetaPropertyToOneResolved(ownerGenericType, M3Properties.rawType, processorSupport), processorSupport); + + return ValueSpecificationBootstrap.wrapValueSpecification(newProperty, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewQualifiedProperty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewQualifiedProperty.java new file mode 100644 index 00000000000..404f148a316 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/meta/NewQualifiedProperty.java @@ -0,0 +1,97 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.meta; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.generictype.GenericType; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class NewQualifiedProperty extends NativeFunction +{ + private final ModelRepository repository; + + public NewQualifiedProperty(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String name = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + CoreInstance ownerGenericType = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport); + CoreInstance targetGenericType = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + CoreInstance multiplicity = Instance.getValueForMetaPropertyToOneResolved(params.get(3), M3Properties.values, processorSupport); + ListIterable variableExpressions = Instance.getValueForMetaPropertyToManyResolved(params.get(4), M3Properties.values, processorSupport); + + CoreInstance newQualifiedProperty = this.repository.newEphemeralCoreInstance(name, processorSupport.package_getByUserPath(M3Paths.QualifiedProperty), null); + + // validate property owner + CoreInstance owner = Instance.getValueForMetaPropertyToOneResolved(ownerGenericType, M3Properties.rawType, processorSupport); + if ((owner == null) || !Instance.instanceOf(owner, M3Paths.PropertyOwner, processorSupport)) + { + StringBuilder message = new StringBuilder("Invalid property owner: "); + GenericType.print(message, ownerGenericType, processorSupport); + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), message.toString()); + } + + // construct function type + CoreInstance functionType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.FunctionType)); + CoreInstance funcTypeClassifierGenericType = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(funcTypeClassifierGenericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.FunctionType), processorSupport); + Instance.addValueToProperty(functionType, M3Properties.classifierGenericType, funcTypeClassifierGenericType, processorSupport); + Instance.addValueToProperty(functionType, M3Properties.returnType, targetGenericType, processorSupport); + Instance.addValueToProperty(functionType, M3Properties.returnMultiplicity, multiplicity, processorSupport); + Instance.addValueToProperty(functionType, M3Properties.parameters, variableExpressions, processorSupport); + + // classifierGenericType + CoreInstance genericType = this.repository.newEphemeralAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(genericType, M3Properties.rawType, processorSupport.package_getByUserPath(M3Paths.QualifiedProperty), processorSupport); + CoreInstance funcTypeGenericType = this.repository.newAnonymousCoreInstance(null, processorSupport.package_getByUserPath(M3Paths.GenericType)); + Instance.addValueToProperty(funcTypeGenericType, M3Properties.rawType, functionType, processorSupport); + Instance.addValueToProperty(genericType, M3Properties.typeArguments, funcTypeGenericType, processorSupport); + + Instance.addValueToProperty(newQualifiedProperty, M3Properties.classifierGenericType, genericType, processorSupport); + + Instance.addValueToProperty(newQualifiedProperty, M3Properties.genericType, targetGenericType, processorSupport); + Instance.addValueToProperty(newQualifiedProperty, M3Properties.multiplicity, multiplicity, processorSupport); + + // name + Instance.addValueToProperty(newQualifiedProperty, M3Properties.name, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + Instance.addValueToProperty(newQualifiedProperty, M3Properties.functionName, this.repository.newCoreInstance(name, this.repository.getTopLevel(M3Paths.String), null), processorSupport); + + // owner + Instance.addValueToProperty(newQualifiedProperty, M3Properties.owner, Instance.getValueForMetaPropertyToOneResolved(ownerGenericType, M3Properties.rawType, processorSupport), processorSupport); + + return ValueSpecificationBootstrap.wrapValueSpecification(newQualifiedProperty, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/CurrentUserId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/CurrentUserId.java new file mode 100644 index 00000000000..cac7e1a4931 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/CurrentUserId.java @@ -0,0 +1,49 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime; + +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.runtime.java.shared.identity.IdentityManager; + +import java.util.Stack; + +public class CurrentUserId extends NativeFunction +{ + private final ModelRepository repository; + + public CurrentUserId(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + return ValueSpecificationBootstrap.newStringLiteral(this.repository, IdentityManager.getAuthenticatedUserId(), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/Guid.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/Guid.java new file mode 100644 index 00000000000..c6e93e94376 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/Guid.java @@ -0,0 +1,50 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; +import java.util.UUID; + +public class Guid extends NativeFunction +{ + private final ModelRepository repository; + + public Guid(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + String res = UUID.randomUUID().toString(); + return ValueSpecificationBootstrap.newStringLiteral(this.repository, res, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/IsOptionSet.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/IsOptionSet.java new file mode 100644 index 00000000000..bc15e98fcdc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/runtime/IsOptionSet.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.runtime; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.serialization.runtime.PureRuntime; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class IsOptionSet extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + + public IsOptionSet(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + PureRuntime runtime = functionExecution.getRuntime(); + String name = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + CoreInstance result = runtime.getModelRepository().newBooleanCoreInstance(runtime.getOptions().isOptionSet(name)); + return ValueSpecificationBootstrap.wrapValueSpecification(result, true, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/ASCII.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/ASCII.java new file mode 100644 index 00000000000..bc05fad7b90 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/ASCII.java @@ -0,0 +1,50 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class ASCII extends NativeFunction +{ + private final ModelRepository repository; + + public ASCII(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String str = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + return ValueSpecificationBootstrap.newIntegerLiteral(this.repository, str.length() > 0 ? (int) str.charAt(0) : 0, processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Char.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Char.java new file mode 100644 index 00000000000..4737d506896 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Char.java @@ -0,0 +1,53 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.NumericUtilities; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Char extends NativeFunction +{ + private final ModelRepository repository; + + public Char(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + Number input = NumericUtilities.toJavaNumber(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport), processorSupport); + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(String.valueOf((char) input.intValue()), processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Chunk.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Chunk.java new file mode 100644 index 00000000000..8131b2762bd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Chunk.java @@ -0,0 +1,78 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.list.mutable.FastList; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Chunk extends NativeFunction +{ + private final ModelRepository repository; + + public Chunk(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String text = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + int chunkSize = PrimitiveUtilities.getIntegerValue(Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport)).intValue(); + + if (chunkSize < 1) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Invalid chunk size: " + chunkSize); + } + + if (text.isEmpty()) + { + return ValueSpecificationBootstrap.wrapValueSpecification(Lists.immutable.empty(), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } + + if (text.length() <= chunkSize) + { + return params.get(0); + } + + MutableList chunks = FastList.newList((text.length() + chunkSize - 1) / chunkSize); + for (int startIndex = 0; startIndex < text.length(); startIndex += chunkSize) + { + chunks.add(this.repository.newStringCoreInstance(text.substring(startIndex, Math.min(text.length(), startIndex + chunkSize)))); + } + return ValueSpecificationBootstrap.wrapValueSpecification(chunks, ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeBase64.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeBase64.java new file mode 100644 index 00000000000..44fd31a4a9c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeBase64.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.apache.commons.codec.binary.Base64; + +import java.util.Stack; + +public class DecodeBase64 extends NativeFunction +{ + private final ModelRepository repository; + + public DecodeBase64(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String string = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String decodedString = new String(Base64.decodeBase64(string)); + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(decodedString, processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeUrl.java new file mode 100644 index 00000000000..213788c3e5d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/DecodeUrl.java @@ -0,0 +1,64 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.Stack; + +public class DecodeUrl extends NativeFunction +{ + private final ModelRepository repository; + + public DecodeUrl(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String string = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String charset = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + String decodedString = null; + try + { + decodedString = URLDecoder.decode(string, charset); + } + catch (UnsupportedEncodingException e) + { + throw new RuntimeException(e); + } + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(decodedString, processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeBase64.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeBase64.java new file mode 100644 index 00000000000..c2119c50d56 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeBase64.java @@ -0,0 +1,54 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; +import org.apache.commons.codec.binary.Base64; + +import java.util.Stack; + +public class EncodeBase64 extends NativeFunction +{ + private final ModelRepository repository; + + public EncodeBase64(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String string = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String encodedString = Base64.encodeBase64URLSafeString(string.getBytes()); + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(encodedString, processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeUrl.java new file mode 100644 index 00000000000..4b9b03759df --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/EncodeUrl.java @@ -0,0 +1,64 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m3.navigation.valuespecification.ValueSpecification; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Stack; + +public class EncodeUrl extends NativeFunction +{ + private final ModelRepository repository; + + public EncodeUrl(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + String string = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String charset = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + String encodedString = null; + try + { + encodedString = URLEncoder.encode(string, charset); + } + catch (UnsupportedEncodingException e) + { + throw new RuntimeException(e); + } + return ValueSpecificationBootstrap.wrapValueSpecification(this.repository.newCoreInstance(encodedString, processorSupport.package_getByUserPath(M3Paths.String), null), ValueSpecification.isExecutable(params.get(0), processorSupport), processorSupport); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/JaroWinklerSimilarity.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/JaroWinklerSimilarity.java new file mode 100644 index 00000000000..0356e92cb2f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/JaroWinklerSimilarity.java @@ -0,0 +1,52 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.NumericUtilities; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class JaroWinklerSimilarity extends NativeFunction +{ + private final ModelRepository repository; + + public JaroWinklerSimilarity(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + final String str1 = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + final String str2 = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + final Double result = new org.apache.commons.text.similarity.JaroWinklerSimilarity().apply(str1, str2); + return NumericUtilities.toPureNumberValueExpression(result, false, this.repository, processorSupport); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/LevenshteinDistance.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/LevenshteinDistance.java new file mode 100644 index 00000000000..0cf79f1311b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/LevenshteinDistance.java @@ -0,0 +1,52 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.natives.NumericUtilities; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class LevenshteinDistance extends NativeFunction +{ + private final ModelRepository repository; + + public LevenshteinDistance(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.repository = repository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) + { + final String str1 = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + final String str2 = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + final Integer result = new org.apache.commons.text.similarity.LevenshteinDistance().apply(str1, str2); + return NumericUtilities.toPureNumberValueExpression(result, false, this.repository, processorSupport); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Matches.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Matches.java new file mode 100644 index 00000000000..8a659b4b620 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/string/Matches.java @@ -0,0 +1,50 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.string; + +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativePredicate; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class Matches extends NativePredicate +{ + public Matches(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + super(repository); + } + + @Override + protected boolean executeBoolean(Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, ListIterable params, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, ProcessorSupport processorSupport) throws PureExecutionException + { + String string = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + String regexp = Instance.getValueForMetaPropertyToOneResolved(params.get(1), M3Properties.values, processorSupport).getName(); + return string.matches(regexp); + } + + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/tracing/TraceSpan.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/tracing/TraceSpan.java new file mode 100644 index 00000000000..126cbc47418 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/interpreted/natives/tracing/TraceSpan.java @@ -0,0 +1,234 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.interpreted.natives.tracing; + +import io.opentracing.Scope; +import io.opentracing.Span; +import io.opentracing.util.GlobalTracer; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.LambdaFunctionCoreInstanceWrapper; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Paths; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.PrimitiveUtilities; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.BooleanCoreInstance; +import org.finos.legend.pure.m4.coreinstance.primitive.StringCoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.MapCoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; + +public class TraceSpan extends NativeFunction +{ + private final FunctionExecutionInterpreted functionExecution; + + private static final ExecutorService traceAsyncExecutor = Executors.newCachedThreadPool(new ThreadFactory() + { + private final ThreadGroup group = System.getSecurityManager() == null ? Thread.currentThread().getThreadGroup() : System.getSecurityManager().getThreadGroup(); + private final AtomicInteger threadNumber = new AtomicInteger(1); + + @Override + public Thread newThread(Runnable r) + { + Thread thread = new Thread(this.group, r, "trace-async-executor-thread-" + this.threadNumber.getAndIncrement(), 0); + if (!thread.isDaemon()) + { + thread.setDaemon(true); + } + if (thread.getPriority() != Thread.NORM_PRIORITY) + { + thread.setPriority(Thread.NORM_PRIORITY); + } + return thread; + } + }); + + public TraceSpan(FunctionExecutionInterpreted functionExecution, ModelRepository repository) + { + this.functionExecution = functionExecution; + } + + @Override + public CoreInstance execute(ListIterable params, + Stack> resolvedTypeParameters, + Stack> resolvedMultiplicityParameters, + VariableContext variableContext, CoreInstance functionExpressionToUseInStack, + Profiler profiler, + InstantiationContext instantiationContext, + ExecutionSupport executionSupport, + Context context, + ProcessorSupport processorSupport) + { + if (Instance.instanceOf(Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport), M3Paths.Nil, processorSupport)) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), "Evaluate can't take an instance of Nil as a function"); + } + + // add check to disable tracing - use isRegistered() + CoreInstance functionToApplyTo = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport); + String traceName = ((StringCoreInstance) Instance.getValueForMetaPropertyToManyResolved(params.get(1), + M3Properties.values, + processorSupport).getFirst()).getValue(); + + if (!GlobalTracer.isRegistered()) + { + return this.functionExecution.executeLambda( + LambdaFunctionCoreInstanceWrapper.toLambdaFunction(functionToApplyTo), + Lists.mutable.empty(), + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + } + + return executeWithTrace(params, + resolvedTypeParameters, + resolvedMultiplicityParameters, + variableContext, + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport, + processorSupport, + functionToApplyTo, + traceName); + } + + private CoreInstance executeWithTrace(ListIterable params, + Stack> resolvedTypeParameters, + Stack> resolvedMultiplicityParameters, + VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, + InstantiationContext instantiationContext, ExecutionSupport executionSupport, + ProcessorSupport processorSupport, CoreInstance functionToApplyTo, String traceName) + { + Span span = GlobalTracer.get().buildSpan(traceName).start(); + try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) + { + if (params.size() > 2) + { + boolean tagsCritical = true; + if (params.size() > 3) + { + tagsCritical = ((BooleanCoreInstance) Instance.getValueForMetaPropertyToOneResolved(params.get(3), M3Properties.values, processorSupport)).getValue(); + } + + resolveTagsAndAddToTrace(params, resolvedTypeParameters, resolvedMultiplicityParameters, + variableContext, functionExpressionToUseInStack, profiler, + instantiationContext, executionSupport, processorSupport, + tagsCritical, span); + } + + return this.functionExecution.executeLambda( + LambdaFunctionCoreInstanceWrapper.toLambdaFunction(functionToApplyTo), + Lists.mutable.empty(), + resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, + profiler, + instantiationContext, + executionSupport); + } + finally + { + if (span != null) + { + span.finish(); + } + } + } + + private void resolveTagsAndAddToTrace(ListIterable params, + Stack> resolvedTypeParameters, + Stack> resolvedMultiplicityParameters, + VariableContext variableContext, CoreInstance functionExpressionToUseInStack, + Profiler profiler, InstantiationContext instantiationContext, + ExecutionSupport executionSupport, ProcessorSupport processorSupport, + boolean tagsCritical, Span span) + { + try + { + Future future = traceAsyncExecutor.submit(() -> + { + try (Scope scope = GlobalTracer.get().scopeManager().activate(span)) + { + CoreInstance tagsFunction = Instance.getValueForMetaPropertyToOneResolved(params.get(2), M3Properties.values, processorSupport); + CoreInstance coreInstance = functionExecution.executeLambda( + LambdaFunctionCoreInstanceWrapper.toLambdaFunction(tagsFunction), + Lists.mutable.empty(), resolvedTypeParameters, + resolvedMultiplicityParameters, + getParentOrEmptyVariableContext(variableContext), + functionExpressionToUseInStack, profiler, instantiationContext, + executionSupport); + MutableMap tagsMap = ((MapCoreInstance) Instance.getValueForMetaPropertyToManyResolved(coreInstance, M3Properties.values, processorSupport).getFirst()).getMap(); + addTags(span, tagsMap); + } + }); + future.get(60, TimeUnit.SECONDS); + } + catch (TimeoutException e) + { + if (span != null) + { + span.setTag("Exception", "Timeout received before tags could be resolved"); + } + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); + } + catch (Exception e) + { + if (tagsCritical) + { + throw new RuntimeException(e); + } + if (span != null) + { + span.setTag("Exception", String.format("Unable to resolve tags - [%s]", e.getMessage())); + } + } + } + + private void addTags(Span span, MutableMap tagsMap) + { + if (span != null) + { + tagsMap.forEachKeyValue((k, v) -> span.setTag(PrimitiveUtilities.getStringValue(k), PrimitiveUtilities.getStringValue(v))); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider new file mode 100644 index 00000000000..ff805f8cffb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.functions.interpreted.Base_Interpreted_PCTReportProvider \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension new file mode 100644 index 00000000000..e06ec66fc08 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension @@ -0,0 +1 @@ +org.finos.legend.pure.runtime.java.extension.functions.interpreted.FunctionExtensionInterpreted \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestEqualityFunctionIntegrity.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestEqualityFunctionIntegrity.java new file mode 100644 index 00000000000..2ebd3cb1fb0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestEqualityFunctionIntegrity.java @@ -0,0 +1,91 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m4.exception.PureCompilationException; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestEqualityFunctionIntegrity extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(); + } + + @After + public void cleanRuntime() + { + runtime.delete("testSource.pure"); + } + + @Test + public void testCannotOverrideIs() + { + try + { + compileTestSource("testSource.pure", + "function is(left:String[1], right:String[1]):Boolean[1]\n" + + "{\n" + + " true\n" + + "}\n"); + Assert.fail("Expected compilation exception"); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, "It is forbidden to override the function 'is'", "testSource.pure", 1, 10, 4, 1, e); + } + } + + @Test + public void testCannotOverrideEq() + { + try + { + compileTestSource("testSource.pure", + "function eq(left:String[1], right:String[1]):Boolean[1]\n" + + "{\n" + + " true\n" + + "}\n"); + Assert.fail("Expected compilation exception"); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, "It is forbidden to override the function 'eq'", "testSource.pure", 1, 10, 4, 1, e); + } + } + + @Test + public void testCannotOverrideEqual() + { + try + { + compileTestSource("testSource.pure", + "function equal(left:String[1], right:String[1]):Boolean[1]\n" + + "{\n" + + " true\n" + + "}\n"); + Assert.fail("Expected compilation exception"); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, "It is forbidden to override the function 'equal'", "testSource.pure", 1, 10, 4, 1, e); + } + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionAsAResult.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionAsAResult.java new file mode 100644 index 00000000000..9ebfaffcca4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionAsAResult.java @@ -0,0 +1,62 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m3.tools.test.ToFix; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore +public class TestFunctionAsAResult extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + @Ignore + @ToFix + public void testLambda() + { + compileTestSource("Class Person\n" + + "{\n" + + " name:String[1];\n" + + "}\n" + + "\n" + + "function ascend(p:Property[1]):Function<{T[1],T[1]->Integer[1]}>[1]\n" + + "{\n" + + " {a,b|$p->eval($a)->compare($p->eval($b))}\n" + + "}\n" + + "\n" + + "function test():Nil[0]\n" + + "{\n" + + " print(ascend(Person.property('name')->toOne()->cast(@Property)));\n" + + "}\n"); + this.execute("test():Nil[0]"); + Assert.assertEquals("okeee", functionExecution.getConsole().getLine(0)); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionDefinitionModify.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionDefinitionModify.java new file mode 100644 index 00000000000..13046442961 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestFunctionDefinitionModify.java @@ -0,0 +1,34 @@ +// Copyright 2022 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.AbstractTestFunctionDefinitionModify; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestFunctionDefinitionModify extends AbstractTestFunctionDefinitionModify +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestLambda.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestLambda.java new file mode 100644 index 00000000000..c4223c975a5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestLambda.java @@ -0,0 +1,145 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m4.coreinstance.SourceInformation; +import org.finos.legend.pure.m4.exception.PureCompilationException; +import org.finos.legend.pure.m4.exception.PureException; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestLambda extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + + //set observer +// System.setProperty("pure.typeinference.test", "true"); + } + + @After + public void cleanRuntime() + { + runtime.delete("inferenceTest.pure"); + } + + @AfterClass + public static void unsetObserver() + { + System.clearProperty("pure.typeinference.test"); + } + + @Test + public void testLambdaParametersInferenceWithLet() + { + try + { + compileTestSource("inferenceTest.pure", "" + + "function myFunc(func:Function<{String[1],Boolean[1]->String[1]}>[1], b: Boolean[1]):String[1]\n" + + "{\n" + + " $func->eval('ok', $b);\n" + + "}\n" + + "\n" + + "function testMany():Nil[0]\n" + + "{\n" + + " let l = {a,b|$a+if($b,|'eee',|'rrrr')};\n" + + " print($l->myFunc(true)+$l->myFunc(false));\n" + + "}\n"); + Assert.fail(); + } + catch (Exception e) + { + PureException pe = PureException.findPureException(e); + Assert.assertNotNull(pe); + Assert.assertTrue(pe instanceof PureCompilationException); + Assert.assertEquals("Can't infer the parameters' types for the lambda. Please specify it in the signature.", pe.getInfo()); + + SourceInformation sourceInfo = pe.getSourceInformation(); + Assert.assertNotNull(sourceInfo); + Assert.assertEquals(8, sourceInfo.getLine()); + Assert.assertEquals(14, sourceInfo.getColumn()); + } + } + + @Test + public void testLambdaParametersInferenceWithFunctionAnyAsTemplate() + { + try + { + compileTestSource("inferenceTest.pure", "" + + "function myFunc(func:Function[1]):String[1]\n" + + "{\n" + + " 'ok'\n" + + "}\n" + + "" + + "function testMany():String[1]\n" + + "{\n" + + " myFunc(a|$a+'eee');\n" + + "}\n"); + Assert.fail(); + } + catch (Exception e) + { + PureException pe = PureException.findPureException(e); + Assert.assertNotNull(pe); + Assert.assertTrue(pe instanceof PureCompilationException); + Assert.assertEquals("Can't infer the parameters' types for the lambda. Please specify it in the signature.", pe.getInfo()); + + SourceInformation sourceInfo = pe.getSourceInformation(); + Assert.assertNotNull(sourceInfo); + Assert.assertEquals(7, sourceInfo.getLine()); + Assert.assertEquals(12, sourceInfo.getColumn()); + } + } + + @Test + public void testLambdaWithUnknownTypeAsParameter() + { + try + { + compileTestSource("inferenceTest.pure", "" + + "function test():Nil[0]\n" + + "{\n" + + " print({a:Employee[1], b:Integer[1]|$b});\n" + + "}\n"); + Assert.fail(); + } + catch (Exception e) + { + PureException pe = PureException.findPureException(e); + Assert.assertNotNull(pe); + Assert.assertTrue(pe instanceof PureCompilationException); + Assert.assertEquals("Employee has not been defined!", pe.getInfo()); + + SourceInformation sourceInfo = pe.getSourceInformation(); + Assert.assertNotNull(sourceInfo); + Assert.assertEquals(3, sourceInfo.getLine()); + Assert.assertEquals(14, sourceInfo.getColumn()); + } + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestManyPromotion.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestManyPromotion.java new file mode 100644 index 00000000000..e8893e500fb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestManyPromotion.java @@ -0,0 +1,99 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m4.exception.PureCompilationException; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestManyPromotion extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + @Test + public void testString() + { + compileTestSource("fromString.pure", "function func():String[*]\n" + + "{\n" + + " 'ok';\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " print(func(),1);" + + "}\n"); + this.execute("test():Nil[0]"); + Assert.assertEquals("'ok'", functionExecution.getConsole().getLine(0)); + } + + @Test + public void testStringError() + { + try + { + compileTestSource("fromString.pure", + "function func():String[1]\n" + + "{\n" + + " ['ok','ok2'];\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " print(func());" + + "}\n"); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, "Return multiplicity error in function 'func'; found: [2]; expected: [1]", "fromString.pure", 3, 5, e); + } + } + + + @Test + public void testFunctionMatchingMultiplicity() + { + compileTestSource("fromString.pure", "function func(a:Any[1]):Any[*]\n" + + "{\n" + + " $a;\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " print(func(test__Nil_0_)->size(), 1);" + + " print(test__Nil_0_->map(c|func($c))->size(), 1);" + + "}\n"); + this.execute("test():Nil[0]"); + Assert.assertEquals("1", functionExecution.getConsole().getLine(0)); + Assert.assertEquals("1", functionExecution.getConsole().getLine(1)); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestPCRReport.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestPCRReport.java new file mode 100644 index 00000000000..c86fb75cabb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestPCRReport.java @@ -0,0 +1,29 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderLoader; +import org.junit.Assert; +import org.junit.Test; + +public class TestPCRReport +{ + @Test + public void canFindPCTReport() + { + Assert.assertEquals("Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); + Assert.assertEquals(3, PCTReportProviderLoader.gatherReports().size()); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestParameters.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestParameters.java new file mode 100644 index 00000000000..19f080e2967 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestParameters.java @@ -0,0 +1,124 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.exception.PureUnmatchedFunctionException; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.m4.exception.PureCompilationException; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestParameters extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + @Test + public void testFunctionParametersTypes() + { + try + { + compileTestSource("fromString.pure", "function called(param:Integer[1]):Nil[0]\n" + + "{\n" + + " print($param, 1);\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " called('aaa');\n" + + "}\n"); + Assert.fail(); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, PureUnmatchedFunctionException.FUNCTION_UNMATCHED_MESSAGE + "called(_:String[1])\n" + + PureUnmatchedFunctionException.NONEMPTY_CANDIDATES_WITH_PACKAGE_IMPORTED_MESSAGE + + "\tcalled(Integer[1]):Nil[0]\n" + + PureUnmatchedFunctionException.EMPTY_CANDIDATES_WITH_PACKAGE_NOT_IMPORTED_MESSAGE, 7, 5, e); + } + } + + + @Test + public void testFunctionParametersNestedValidation() + { + try + { + compileTestSource("fromString.pure", "Class Employee\n" + + "{\n" + + " name:String[1];\n" + + "}\n" + + "function called(employee:Employee[1]):Nil[0]\n" + + "{\n" + + " print($employee, 1);\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " called(^Employee(name=['ee','err']));\n" + + "}\n"); + this.execute("test():Nil[0]"); + Assert.fail(); + } + catch (Exception e) + { + assertOriginatingPureException(PureCompilationException.class, "Multiplicity Error: [2] is not compatible with [1]", 11, 26, e); + } + } + + @Test + public void testFunctionParameterTypeError() + { + try + { + compileTestSource("fromString.pure", "function test():Nil[0]\n" + + "{\n" + + " print(a:String[1]|'a'+$a->eval('errre'));\n" + + "}\n"); + Assert.fail(); + } + catch (Exception e) + { + assertPureException(PureCompilationException.class, PureUnmatchedFunctionException.FUNCTION_UNMATCHED_MESSAGE + "eval(_:String[1],_:String[1])\n" + + PureUnmatchedFunctionException.EMPTY_CANDIDATES_WITH_PACKAGE_IMPORTED_MESSAGE + + PureUnmatchedFunctionException.NONEMPTY_CANDIDATES_WITH_PACKAGE_NOT_IMPORTED_MESSAGE + + "\tmeta::pure::functions::lang::eval(Function<{->V[m]}>[1]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{S[n], T[o], U[p], W[q], X[r], Y[s], Z[t]->V[m]}>[1], S[n], T[o], U[p], W[q], X[r], Y[s], Z[t]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n], U[p], W[q], X[r], Y[s], Z[t]->V[m]}>[1], T[n], U[p], W[q], X[r], Y[s], Z[t]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n], U[p], W[q], X[r], Y[s]->V[m]}>[1], T[n], U[p], W[q], X[r], Y[s]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n], U[p], W[q], X[r]->V[m]}>[1], T[n], U[p], W[q], X[r]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n], U[p], W[q]->V[m]}>[1], T[n], U[p], W[q]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n], U[p]->V[m]}>[1], T[n], U[p]):V[m]\n" + + "\tmeta::pure::functions::lang::eval(Function<{T[n]->V[m]}>[1], T[n]):V[m]\n", 3, 31, e); + } + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestReturn.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestReturn.java new file mode 100644 index 00000000000..2802137e693 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/TestReturn.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.elements.function.AbstractTestReturn; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestReturn extends AbstractTestReturn +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedAnd.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedAnd.java new file mode 100644 index 00000000000..2d903f49a4f --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedAnd.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestAnd; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedAnd extends AbstractTestAnd +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedNot.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedNot.java new file mode 100644 index 00000000000..7d07a708cbe --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedNot.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestNot; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedNot extends AbstractTestNot +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedOr.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedOr.java new file mode 100644 index 00000000000..b23c791750b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedOr.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestOr; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedOr extends AbstractTestOr +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedPrecedence.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedPrecedence.java new file mode 100644 index 00000000000..4dd78a8b9ab --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/_boolean/TestInterpretedPrecedence.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base._boolean; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base._boolean.AbstractTestPrecedence; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedPrecedence extends AbstractTestPrecedence +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssert.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssert.java new file mode 100644 index 00000000000..ce1d2b448b5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssert.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.asserts.AbstractTestAssert; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestAssert extends AbstractTestAssert +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertContains.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertContains.java new file mode 100644 index 00000000000..443baacd6f5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertContains.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertContains extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getExtra()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("[1, 2, 5, 2, 'a', true, %2014-02-01, 'c'] does not contain false", 3, 9, "assertContains([1, 2, 5, 2, 'a', true, %2014-02-01, 'c'], false)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEmpty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEmpty.java new file mode 100644 index 00000000000..2e9f162af99 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEmpty.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertEmpty extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("[1, 2] is not empty", 3, 9, "assertEmpty([1, 2])"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEqWithinTolerance.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEqWithinTolerance.java new file mode 100644 index 00000000000..9901d86ecc6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEqWithinTolerance.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertEqWithinTolerance extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("\nexpected: 1\nactual: 0", 3, 9, "assertEqWithinTolerance(1, 0, 0)"); + assertExpressionRaisesPureException("\nexpected: 2.718271828459045\nactual: 2.718281828459045", 3, 9, "assertEqWithinTolerance(2.718271828459045, 2.718281828459045, 0.000000001)"); + assertExpressionRaisesPureException("\nexpected: 2.718281828459045\nactual: 2.7182818284590455", 3, 9, "assertEqWithinTolerance(2.718281828459045, 2.7182818284590455, 0.0000000000000001)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEquals.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEquals.java new file mode 100644 index 00000000000..86ec88f3488 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertEquals.java @@ -0,0 +1,49 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertEquals extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("\nexpected: 1\nactual: 2", 3, 9, "assertEquals(1, 2)"); + } + + @Test + public void testFailureWithCollections() + { + assertExpressionRaisesPureException("\nexpected: [1, 3, 2]\nactual: [2, 4, 1, 5]", 3, 9, "assertEquals([1, 3, 2], [2, 4, 1, 5])"); + assertExpressionRaisesPureException("\nexpected: [1, 2]\nactual: [2, 1]", 3, 9, "assertEquals([1, 2], [2, 1])"); + assertExpressionRaisesPureException("\nexpected: ['aaa', 2]\nactual: [2, 'aaa']", 3, 9, "assertEquals(['aaa', 2], [2, 'aaa'])"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertFalse.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertFalse.java new file mode 100644 index 00000000000..fb2a3a0d72c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertFalse.java @@ -0,0 +1,63 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertFalse extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailWithoutMessage() + { + assertExpressionRaisesPureException("Assert failed", 3, 9, "assertFalse(true)"); + assertExpressionRaisesPureException("Assert failed", 3, 9, "assertFalse(2 == 2)"); + } + + @Test + public void testFailWithMessageString() + { + assertExpressionRaisesPureException("Test message", 3, 9, "assertFalse(true, 'Test message')"); + assertExpressionRaisesPureException("Test message", 3, 9, "assertFalse(2 == 2, 'Test message')"); + } + + @Test + public void testFailWithFormattedMessage() + { + assertExpressionRaisesPureException("Test message: 5", 3, 9, "assertFalse(true, 'Test message: %d', 2 + 3)"); + assertExpressionRaisesPureException("Test message: 5", 3, 9, "assertFalse(2 == 2, 'Test message: %d', 2 + 3)"); + } + + @Test + public void testFailWithMessageFunction() + { + assertExpressionRaisesPureException("Test message: 5", 3, 9, "assertFalse(true, |format('Test message: %d', 2 + 3))"); + assertExpressionRaisesPureException("Test message: 5", 3, 9, "assertFalse(2 == 2, |format('Test message: %d', 2 + 3))"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertInstanceOf.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertInstanceOf.java new file mode 100644 index 00000000000..0b65c45b608 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertInstanceOf.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertInstanceOf extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("expected 3 to be an instance of Boolean, actual: Integer", 3, 9, "assertInstanceOf(3, Boolean)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotContains.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotContains.java new file mode 100644 index 00000000000..965ebdbd476 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotContains.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertNotContains extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("[1, 2, 5, 2, 'a', true, %2014-02-01, 'c'] should not contain true", 3, 9, "assertNotContains([1, 2, 5, 2, 'a', true, %2014-02-01, 'c'], true)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEmpty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEmpty.java new file mode 100644 index 00000000000..ce7290c12a4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEmpty.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertNotEmpty extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("Expected non-empty collection", 3, 9, "assertNotEmpty([1, 2, 3]->filter(x | $x == 5))"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEquals.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEquals.java new file mode 100644 index 00000000000..e5a39e0194a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotEquals.java @@ -0,0 +1,82 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertNotEquals extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("1 should not equal 1", 3, 9, "assertNotEquals(1, 1)"); + } + + @Test + public void testFailureWithCollections() + { + assertExpressionRaisesPureException("[1, 2] should not equal [1, 2]", 3, 9, "assertNotEquals([1, 2], [1, 2])"); + assertExpressionRaisesPureException("['aaa', 'bb'] should not equal ['aaa', 'bb']", 3, 9, "assertNotEquals(['aaa', 'bb'], ['aaa', 'bb'])"); + assertExpressionRaisesPureException("['aaa', 2] should not equal ['aaa', 2]", 3, 9, "assertNotEquals(['aaa', 2], ['aaa', 2])"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + + public static Pair getExtra() + { + return Tuples.pair("testAssertNotEquals.pure", + "function meta::pure::functions::asserts::assertNotEquals(notExpected:Any[*], actual:Any[*]):Boolean[1]\n" + + "{\n" + + " if(eq($notExpected->size(), 1) && eq($actual->size(), 1),\n" + + " | assertNotEquals($notExpected, $actual, '%r should not equal %r', [$notExpected->toOne(), $actual->toOne()]),\n" + + " | assertNotEquals($notExpected, $actual, | $notExpected->map(e | $e->toRepresentation())->joinStrings('[', ', ', ']') + ' should not equal ' + $actual->map(a | $a->toRepresentation())->joinStrings('[', ', ', ']')))\n" + + "}\n" + + "\n" + + "function meta::pure::functions::asserts::assertNotEquals(notExpected:Any[*], actual:Any[*], message:String[1]):Boolean[1]\n" + + "{\n" + + " assert(!equal($notExpected, $actual), $message);\n" + + "}\n" + + "\n" + + "function meta::pure::functions::asserts::assertNotEquals(notExpected:Any[*], actual:Any[*], formatString:String[1], formatArgs:Any[*]):Boolean[1]\n" + + "{\n" + + " assert(!equal($notExpected, $actual), $formatString, $formatArgs);\n" + + "}\n" + + "\n" + + "function meta::pure::functions::asserts::assertNotEquals(notExpected:Any[*], actual:Any[*], message:Function<{->String[1]}>[1]):Boolean[1]\n" + + "{\n" + + " assert(!equal($notExpected, $actual), $message);\n" + + "}\n" + + "function meta::pure::functions::asserts::assert(condition:Boolean[1], formatString:String[1], formatArgs:Any[*]):Boolean[1]\n" + + "{\n" + + " assert($condition, | format($formatString, $formatArgs));\n" + + "}" + ); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotSize.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotSize.java new file mode 100644 index 00000000000..2b492088fbd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertNotSize.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertNotSize extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getExtra()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("size should not equal: 2", 3, 9, "assertNotSize([1, 2], 2)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSameElements.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSameElements.java new file mode 100644 index 00000000000..3005b7a229b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSameElements.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertSameElements extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("\nexpected: [1, 2, 3]\nactual: [1, 2, 4, 5]", 3, 9, "assertSameElements([1, 3, 2], [2, 4, 1, 5])"); + assertExpressionRaisesPureException("\nexpected: [1, 3, '2']\nactual: [1, 4, 5, '2']", 3, 9, "assertSameElements([1, 3, '2'], ['2', 4, 1, 5])"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSize.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSize.java new file mode 100644 index 00000000000..336e2dfe6b3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestAssertSize.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAssertSize extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFailure() + { + assertExpressionRaisesPureException("expected size: 3, actual size: 2", 3, 9, "assertSize([1, 2], 3)"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestFail.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestFail.java new file mode 100644 index 00000000000..9217af346fa --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/asserts/TestFail.java @@ -0,0 +1,47 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.asserts; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestFail extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testFail() + { + assertExpressionRaisesPureException("Assert failed", 3, 9, "fail()"); + } + + @Test + public void testFailWithMessage() + { + assertExpressionRaisesPureException("Error Here", 3, 9, "fail('Error Here')"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAppendTreeToNode.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAppendTreeToNode.java new file mode 100644 index 00000000000..a2f9747e4b5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAppendTreeToNode.java @@ -0,0 +1,151 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestAppendTreeToNode extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testSimple() + { + compileTestSource("Class MyNode extends TreeNode\n" + + "{\n" + + " value :String[1];\n" + + " children(){$this.childrenData->cast(@MyNode)}:MyNode[*];\n" + + "}\n" + + "\n" + + "function meta::pure::functions::collection::appendTreeToNode(root:TreeNode[1], position: TreeNode[1], joinTree:TreeNode[1]): TreeNode[1]\n" + + "{\n" + + " $root->meta::pure::functions::collection::replaceTreeNode($position, ^$position(childrenData += $joinTree));\n" + + "}\n" + + "function test():Nil[0]\n" + + "{\n" + + " let tree = ^MyNode(value='1', childrenData = [^MyNode(value ='2', childrenData=[^MyNode(value ='4')]), ^MyNode(value='3')]);\n" + + " let subTree = ^MyNode(value='10', childrenData = [^MyNode(value ='11'), ^MyNode(value='12', childrenData=[^MyNode(value ='13')])]);\n" + + " let point = $tree.children()->filter(n|$n.value == '3')->at(0);\n" + + " print($tree->appendTreeToNode($point, $subTree),10);\n" + + " print($tree,10);\n" + + "}\n"); + this.execute("test():Nil[0]"); + Assert.assertEquals("Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 4 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 2 instance String\n" + + " Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 11 instance String\n" + + " Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 13 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 12 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 10 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 3 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 1 instance String", functionExecution.getConsole().getLine(0)); + Assert.assertEquals("Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " childrenData(Property):\n" + + " Anonymous_StripedId instance MyNode\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 4 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 2 instance String\n" + + " Anonymous_StripedId instance MyNode\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 3 instance String\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] MyNode instance Class\n" + + " value(Property):\n" + + " 1 instance String", functionExecution.getConsole().getLine(1)); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAt.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAt.java new file mode 100644 index 00000000000..4f26d96ba80 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestAt.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestAt; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestAt extends AbstractTestAt +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedFirst.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedFirst.java new file mode 100644 index 00000000000..0c8a3940b6b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedFirst.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestFirst; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedFirst extends AbstractTestFirst +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedGetAll.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedGetAll.java new file mode 100644 index 00000000000..3f0eeb6e931 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedGetAll.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestGetAll; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedGetAll extends AbstractTestGetAll +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedInit.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedInit.java new file mode 100644 index 00000000000..3ea8398739d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedInit.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestInit; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedInit extends AbstractTestInit +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedLast.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedLast.java new file mode 100644 index 00000000000..09a5cdcfb15 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedLast.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestLast; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedLast extends AbstractTestLast +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedReverse.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedReverse.java new file mode 100644 index 00000000000..7b8f282d73a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedReverse.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestReverse; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedReverse extends AbstractTestReverse +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedTail.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedTail.java new file mode 100644 index 00000000000..c2e7ce03bf7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestInterpretedTail.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestTail; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedTail extends AbstractTestTail +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMap.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMap.java new file mode 100644 index 00000000000..d681bd6498b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMap.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestMap; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestMap extends AbstractTestMap +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMapCollection.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMapCollection.java new file mode 100644 index 00000000000..213ae2b9e76 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestMapCollection.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestMapCollection; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestMapCollection extends AbstractTestMapCollection +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestRange.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestRange.java new file mode 100644 index 00000000000..53aed8fe144 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestRange.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestRange; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestRange extends AbstractTestRange +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestSlice.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestSlice.java new file mode 100644 index 00000000000..1e9dd4d8278 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/collection/TestSlice.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.collection; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.collection.AbstractTestSlice; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestSlice extends AbstractTestSlice +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfMonth.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfMonth.java new file mode 100644 index 00000000000..a6f8f4ea90a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfMonth.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestDayOfMonth; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestDayOfMonth extends AbstractTestDayOfMonth +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfWeekNumber.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfWeekNumber.java new file mode 100644 index 00000000000..3fa83c80427 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestDayOfWeekNumber.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestDayOfWeekNumber; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestDayOfWeekNumber extends AbstractTestDayOfWeekNumber +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestHour.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestHour.java new file mode 100644 index 00000000000..b3cde0f2965 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestHour.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestHour; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestHour extends AbstractTestHour +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestMinute.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestMinute.java new file mode 100644 index 00000000000..1cf4c579090 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestMinute.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestMinute; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestMinute extends AbstractTestMinute +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNewDate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNewDate.java new file mode 100644 index 00000000000..a980076e089 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNewDate.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestNewDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNewDate extends AbstractTestNewDate +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNow.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNow.java new file mode 100644 index 00000000000..b2862e8c126 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestNow.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestNow; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNow extends AbstractTestNow +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestSecond.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestSecond.java new file mode 100644 index 00000000000..ba759c08f76 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestSecond.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestSecond; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestSecond extends AbstractTestSecond +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestToday.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestToday.java new file mode 100644 index 00000000000..4558355a7f5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestToday.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestToday; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestToday extends AbstractTestToday +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestWeekOfYear.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestWeekOfYear.java new file mode 100644 index 00000000000..d84f18f4742 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/date/TestWeekOfYear.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.date; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.date.AbstractTestWeekOfYear; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestWeekOfYear extends AbstractTestWeekOfYear +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestHttp.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestHttp.java new file mode 100644 index 00000000000..f923617e284 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestHttp.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestHttp; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestHttp extends AbstractTestHttp +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestPrint.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestPrint.java new file mode 100644 index 00000000000..99cab5cfc73 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestPrint.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestPrint; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestPrint extends AbstractTestPrint +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestReadFile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestReadFile.java new file mode 100644 index 00000000000..91702560dd0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/io/TestReadFile.java @@ -0,0 +1,34 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.io; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.io.AbstractTestReadFile; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestReadFile extends AbstractTestReadFile +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCast.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCast.java new file mode 100644 index 00000000000..fa7297534d7 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCast.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCast; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestCast extends AbstractTestCast +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCompare.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCompare.java new file mode 100644 index 00000000000..47f82ac43bb --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCompare.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCompare; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestCompare extends AbstractTestCompare +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCopy.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCopy.java new file mode 100644 index 00000000000..e9168c22d5d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestCopy.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestCopyAtRuntime; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestCopy extends AbstractTestCopyAtRuntime +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNew.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNew.java new file mode 100644 index 00000000000..e4dbaec0ab4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNew.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestDynamicNew; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestDynamicNew extends AbstractTestDynamicNew +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNewGetterOverrideInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNewGetterOverrideInterpreted.java new file mode 100644 index 00000000000..fbc77d54fa6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestDynamicNewGetterOverrideInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestDynamicNewGetterOverride; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestDynamicNewGetterOverrideInterpreted extends AbstractTestDynamicNewGetterOverride +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestEvaluate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestEvaluate.java new file mode 100644 index 00000000000..715a88ca181 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestEvaluate.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestEvaluate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestEvaluate extends AbstractTestEvaluate +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMatch.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMatch.java new file mode 100644 index 00000000000..e3a9bc6849d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMatch.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestMatch; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestMatch extends AbstractTestMatch +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMutateAdd.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMutateAdd.java new file mode 100644 index 00000000000..748bd65930c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestMutateAdd.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestMutateAdd; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestMutateAdd extends AbstractTestMutateAdd +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestNew.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestNew.java new file mode 100644 index 00000000000..2161629c7e5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestNew.java @@ -0,0 +1,225 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestNewAtRuntime; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestNew extends AbstractTestNewAtRuntime +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage()); + } + + @Test + public void testNewWithMultiplicityParameter() + { + compileTestSource("fromString.pure", + "Class MyClass<|m>\n" + + "{\n" + + " value:String[m];\n" + + "}\n" + + "\n" + + "function testFn():Any[*]\n" + + "{\n" + + " ^MyClass<|1>(value='hello');\n" + + "}"); + execute("testFn():Any[*]"); + // TODO add asserts + } + + @Test + public void testNewWithMissingOneToOneProperty() + { + compileTestSource("fromString.pure", + "function test(): Any[*]\n" + + "{\n" + + " ^test::Owner(firstName='John', lastName='Roe')\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " car : test::Car[1];\n" + + "}"); + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("test():Any[*]")); + assertPureException(PureExecutionException.class, "Error instantiating class 'Owner'. The following properties have multiplicity violations: 'car' requires 1 value, got 0", "fromString.pure", 3, 4, e); + } + + @Test + public void testNewWithMissingOneToManyProperty() + { + compileTestSource("fromString.pure", + "function test(): Any[*]\n" + + "{\n" + + " ^test::Owner(firstName='John', lastName='Roe')\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " cars : test::Car[1..*];\n" + + "}"); + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("test():Any[*]")); + assertPureException(PureExecutionException.class, "Error instantiating class 'Owner'. The following properties have multiplicity violations: 'cars' requires 1..* values, got 0", "fromString.pure", 3, 4, e); + } + + @Test + public void testNewWithChildWithMismatchedReverseOneToOneProperty() + { + compileTestSource("fromString.pure", + "function test(): Any[*]\n" + + "{\n" + + " ^test::Car(name='Bugatti', owner= ^test::Owner(firstName='John', lastName='Roe', car=^test::Car(name='Audi')))\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " car : test::Car[1];\n" + + "}"); + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("test():Any[*]")); + assertPureException(PureExecutionException.class, "Error instantiating the type 'Owner'. The property 'car' has a multiplicity range of [1] when the given list has a cardinality equal to 2", "fromString.pure", 3, 4, e); + } + + @Override + public void testNewWithInheritenceAndOverriddenAssociationEndWithReverseOneToOneProperty() + { + compileTestSource("fromString.pure", + "function test(): Any[*]\n" + + "{\n" + + " let car = ^test::FastCar(name='Bugatti', owner= ^test::Owner(firstName='John', lastName='Roe'));\n" + + " print($car.owner.car->size()->toString(), 1);\n" + + " $car;" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::FastCar extends test::Car\n" + + "{\n" + + " owner : test::Owner[1];\n" + + "}" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " car : test::Car[1];\n" + + "}"); + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("test():Any[*]")); + assertPureException(PureExecutionException.class, "Error instantiating class 'Owner'. The following properties have multiplicity violations: 'car' requires 1 value, got 0", "fromString.pure", 3, 14, e); + } + + @Override + public void testNewWithInheritenceAndOverriddenAssociationEndWithReverseOneToManyProperty() + { + compileTestSource("fromString.pure", + "function test(): Any[*]\n" + + "{\n" + + " let car = ^test::FastCar(name='Bugatti', owner= ^test::Owner(firstName='John', lastName='Roe'));\n" + + " print($car.owner.cars->size()->toString(), 1);\n" + + " $car;" + + "}\n" + + "\n" + + "Class\n" + + "test::Car\n" + + "{\n" + + " name : String[1];\n" + + "}\n" + + "\n" + + "Class\n" + + "test::FastCar extends test::Car\n" + + "{\n" + + " owner : test::Owner[1];\n" + + "}" + + "\n" + + "Class\n" + + "test::Owner\n" + + "{\n" + + " firstName: String[1];\n" + + " lastName: String[1];\n" + + "}\n" + + "\n" + + "Association test::Car_Owner\n" + + "{\n" + + " owner : test::Owner[1];\n" + + " cars : test::Car[1..*];\n" + + "}"); + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, () -> execute("test():Any[*]")); + assertPureException(PureExecutionException.class, "Error instantiating class 'Owner'. The following properties have multiplicity violations: 'cars' requires 1..* values, got 0", "fromString.pure", 3, 14, e); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestRawEvalProperty.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestRawEvalProperty.java new file mode 100644 index 00000000000..2105bf837c8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/lang/TestRawEvalProperty.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.lang; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.lang.AbstractTestRawEvalProperty; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestRawEvalProperty extends AbstractTestRawEvalProperty +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcCosine.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcCosine.java new file mode 100644 index 00000000000..a94f22d25f1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcCosine.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestArcCosine; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestArcCosine extends AbstractTestArcCosine +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcSine.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcSine.java new file mode 100644 index 00000000000..317ae306ab3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestArcSine.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestArcSine; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestArcSine extends AbstractTestArcSine +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedCeiling.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedCeiling.java new file mode 100644 index 00000000000..8b83f1d813d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedCeiling.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestCeiling; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedCeiling extends AbstractTestCeiling +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedDivide.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedDivide.java new file mode 100644 index 00000000000..8e4c6882386 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedDivide.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestDivide; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedDivide extends AbstractTestDivide +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedFloor.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedFloor.java new file mode 100644 index 00000000000..d25a6489b80 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedFloor.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestFloor; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedFloor extends AbstractTestFloor +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedPrecedence.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedPrecedence.java new file mode 100644 index 00000000000..61db0aaa3da --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedPrecedence.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestPrecedence; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedPrecedence extends AbstractTestPrecedence +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedRound.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedRound.java new file mode 100644 index 00000000000..03cb40fe132 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedRound.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestRound; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedRound extends AbstractTestRound +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedTimes.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedTimes.java new file mode 100644 index 00000000000..1c30e22fdf4 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestInterpretedTimes.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestTimes; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedTimes extends AbstractTestTimes +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestPow.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestPow.java new file mode 100644 index 00000000000..9d40405e169 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestPow.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestPow; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestPow extends AbstractTestPow +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestRem.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestRem.java new file mode 100644 index 00000000000..0c2b8af6916 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestRem.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestRem; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestRem extends AbstractTestRem +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestSqrt.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestSqrt.java new file mode 100644 index 00000000000..b71f18f16a9 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/math/TestSqrt.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.math; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.math.AbstractTestSqrt; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestSqrt extends AbstractTestSqrt +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestCompileValueSpecification.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestCompileValueSpecification.java new file mode 100644 index 00000000000..72e3bcc756c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestCompileValueSpecification.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.ListIterable; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.RuntimeVerifier; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestCompileValueSpecification; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestCompileValueSpecification extends AbstractTestCompileValueSpecification +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } + + @Override + public ListIterable getExecutionVerifiers() + { + return Lists.fixedSize.empty(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestFunctionDescriptorToId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestFunctionDescriptorToId.java new file mode 100644 index 00000000000..14c8025a12b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestFunctionDescriptorToId.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestFunctionDescriptorToId; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestFunctionDescriptorToId extends AbstractTestFunctionDescriptorToId +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInstanceOf.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInstanceOf.java new file mode 100644 index 00000000000..3aa8a2a7b46 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInstanceOf.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestInstanceOf; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInstanceOf extends AbstractTestInstanceOf +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedCanReactivateDynamically.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedCanReactivateDynamically.java new file mode 100644 index 00000000000..8c89488baa0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedCanReactivateDynamically.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestCanReactivateDynamically; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedCanReactivateDynamically extends AbstractTestCanReactivateDynamically +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedId.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedId.java new file mode 100644 index 00000000000..672abece1da --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestInterpretedId.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestId; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestInterpretedId extends AbstractTestId +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewAssociationInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewAssociationInterpreted.java new file mode 100644 index 00000000000..eefb807dabe --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewAssociationInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2021 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewAssociation; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNewAssociationInterpreted extends AbstractTestNewAssociation +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewClassInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewClassInterpreted.java new file mode 100644 index 00000000000..2fc606d0c3d --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewClassInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewClass; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNewClassInterpreted extends AbstractTestNewClass +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewLambdaFunctionInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewLambdaFunctionInterpreted.java new file mode 100644 index 00000000000..b021cec0574 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewLambdaFunctionInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewLambdaFunction; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNewLambdaFunctionInterpreted extends AbstractTestNewLambdaFunction +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewQualifiedPropertyInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewQualifiedPropertyInterpreted.java new file mode 100644 index 00000000000..331a3f4e4f3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestNewQualifiedPropertyInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestNewQualifiedProperty; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestNewQualifiedPropertyInterpreted extends AbstractTestNewQualifiedProperty +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestPathToElement.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestPathToElement.java new file mode 100644 index 00000000000..75f4d45deec --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestPathToElement.java @@ -0,0 +1,34 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestPathToElement; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestPathToElement extends AbstractTestPathToElement +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage(), getExtra()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestReactivate.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestReactivate.java new file mode 100644 index 00000000000..d2f8c74f357 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/meta/TestReactivate.java @@ -0,0 +1,44 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.meta; + +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.meta.AbstractTestReactivate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestReactivate extends AbstractTestReactivate +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testVariableScopeFail() + { + PureExecutionException e = Assert.assertThrows(PureExecutionException.class, this::compileAndExecuteVariableScopeFailure); + assertOriginatingPureException("Variable 'a' is not defined in the current variable context", e); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestGetUpperBound.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestGetUpperBound.java new file mode 100644 index 00000000000..6abbc591fcc --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestGetUpperBound.java @@ -0,0 +1,47 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.PureExpressionTest; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestGetUpperBound extends PureExpressionTest +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testGetUpperBoundZeroManyError() + { + assertExpressionRaisesPureException("Cannot cast a collection of size 0 to multiplicity [1]", 3, 19, "ZeroMany->getUpperBound()"); + } + + @Test + public void testGetUpperBoundOneManyError() + { + assertExpressionRaisesPureException("Cannot cast a collection of size 0 to multiplicity [1]", 3, 18, "OneMany->getUpperBound()"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToMultiplicity.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToMultiplicity.java new file mode 100644 index 00000000000..80b5bf3406b --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToMultiplicity.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToMultiplicity; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOneMany; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToMultiplicity extends AbstractTestToMultiplicity +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOne.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOne.java new file mode 100644 index 00000000000..0141cffa8f6 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOne.java @@ -0,0 +1,41 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOne; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToOne extends AbstractTestToOne +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOneMany.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOneMany.java new file mode 100644 index 00000000000..f51a95406ec --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/multiplicity/TestToOneMany.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.multiplicity; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.multiplicity.AbstractTestToOneMany; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToOneMany extends AbstractTestToOneMany +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/runtime/TestIsOptionSetInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/runtime/TestIsOptionSetInterpreted.java new file mode 100644 index 00000000000..b78c2b0f2b1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/runtime/TestIsOptionSetInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.runtime; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.runtime.AbstractTestIsOptionSet; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestIsOptionSetInterpreted extends AbstractTestIsOptionSet +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getOptions()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestCharInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestCharInterpreted.java new file mode 100644 index 00000000000..a50543f08a1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestCharInterpreted.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestChar; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestCharInterpreted extends AbstractTestChar +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestChunk.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestChunk.java new file mode 100644 index 00000000000..9db9869de4a --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestChunk.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestChunk; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestChunk extends AbstractTestChunk +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution(), getCodeStorage()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestDecodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestDecodeUrl.java new file mode 100644 index 00000000000..a6b9d746009 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestDecodeUrl.java @@ -0,0 +1,42 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestDecodeUrl; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestDecodeUrl extends AbstractTestDecodeUrl +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestEncodeUrl.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestEncodeUrl.java new file mode 100644 index 00000000000..f6063d162ff --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestEncodeUrl.java @@ -0,0 +1,42 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestEncodeUrl; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestEncodeUrl extends AbstractTestEncodeUrl +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestFormat.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestFormat.java new file mode 100644 index 00000000000..e94bacb4f19 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestFormat.java @@ -0,0 +1,34 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestFormat; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestFormat extends AbstractTestFormat +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestIndexOfInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestIndexOfInterpreted.java new file mode 100644 index 00000000000..7206a1a64e8 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestIndexOfInterpreted.java @@ -0,0 +1,43 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestIndexOf; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestIndexOfInterpreted extends AbstractTestIndexOf +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestLengthInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestLengthInterpreted.java new file mode 100644 index 00000000000..c5fdaaf7d03 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestLengthInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestLength; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestLengthInterpreted extends AbstractTestLength +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseBooleanInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseBooleanInterpreted.java new file mode 100644 index 00000000000..4a3b8474f10 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseBooleanInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseBoolean; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseBooleanInterpreted extends AbstractTestParseBoolean +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseDateInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseDateInterpreted.java new file mode 100644 index 00000000000..cc0557696ae --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseDateInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseDate; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseDateInterpreted extends AbstractTestParseDate +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseFloatInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseFloatInterpreted.java new file mode 100644 index 00000000000..d9ab09db42e --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseFloatInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseFloat; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseFloatInterpreted extends AbstractTestParseFloat +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseIntegerInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseIntegerInterpreted.java new file mode 100644 index 00000000000..8e28d1c06c0 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestParseIntegerInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestParseInteger; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestParseIntegerInterpreted extends AbstractTestParseInteger +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestSubstringInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestSubstringInterpreted.java new file mode 100644 index 00000000000..35b879665f5 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestSubstringInterpreted.java @@ -0,0 +1,34 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestSubstring; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.BeforeClass; + +public class TestSubstringInterpreted extends AbstractTestSubstring +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestToStringInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestToStringInterpreted.java new file mode 100644 index 00000000000..178f9364a2c --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestToStringInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestToString; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestToStringInterpreted extends AbstractTestToString +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestTrimInterpreted.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestTrimInterpreted.java new file mode 100644 index 00000000000..27988f8d021 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/string/TestTrimInterpreted.java @@ -0,0 +1,42 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.string; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.string.AbstractTestTrim; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestTrimInterpreted extends AbstractTestTrim +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + runtime.compile(); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tools/TestProfile.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tools/TestProfile.java new file mode 100644 index 00000000000..900574a5a66 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tools/TestProfile.java @@ -0,0 +1,103 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.tools; + +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.AbstractPureTestWithCoreCompiled; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestProfile extends AbstractPureTestWithCoreCompiled +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + } + + @Test + public void testPathToElementProfile() + { + compileTestSource("Class A::B::C::D::E\n" + + "{\n" + + "}\n" + + "\n" + + "Class A::B::C::K::D\n" + + "{\n" + + "}\n" + + "\n" + + "function test::findElement(path:String[1], separator:String[1]):PackageableElement[1]\n" + + "{\n" + + " $path->split($separator)->fold({str:String[1], pkg:PackageableElement[1] | let p = $pkg->cast(@Package).children->filter(c | $c.name == $str);\n" + + " if ($p->isEmpty(), | fail(| $path + ' is not a valid PackageableElement. Package \\'' + $str + '\\' not found'); $p->toOne();, | $p->toOne());\n" + + " }, ::)\n" + + "}\n" + + "\n" + + "function test::testProfile():Nil[0]\n" + + "{\n" + + " print('A::B::C::K::D'->test::findElement('::')->profile(false).result, 1);\n" + + "}\n"); + this.execute("test::testProfile():Nil[0]"); + Assert.assertEquals("'\n" + + "################################################## Profiler report ##################################################\n" + + " ##---------------------------- TreeStart\n" + + " + 1 profile_T_m__Boolean_1__ProfileResult_1_\n" + + " + 1 findElement_String_1__String_1__PackageableElement_1_\n" + + " + 1 fold_T_MANY__Function_1__V_m__V_m_\n" + + " + 1 split_String_1__String_1__String_MANY_\n" + + " + 5 letFunction_String_1__T_m__T_m_\n" + + " + 5 filter_T_MANY__Function_1__T_MANY_\n" + + " + 5 children(P)\n" + + " + 5 cast_Any_m__T_1__T_m_\n" + + " + 9 equal_Any_MANY__Any_MANY__Boolean_1_\n" + + " + 9 name(P)\n" + + " + 5 if_Boolean_1__Function_1__Function_1__T_m_\n" + + " + 5 isEmpty_Any_MANY__Boolean_1_\n" + + " + 5 toOne_T_MANY__T_1_\n" + + " ##---------------------------- TreeEnd\n" + + "################################################## Finished Report ##################################################\n'", functionExecution.getConsole().getLine(0)); + + Assert.assertEquals("D instance Class\n" + + " classifierGenericType(Property):\n" + + " Anonymous_StripedId instance GenericType\n" + + " rawType(Property):\n" + + " [X] Class instance Class\n" + + " typeArguments(Property):\n" + + " [>1] Anonymous_StripedId instance GenericType\n" + + " generalizations(Property):\n" + + " Anonymous_StripedId instance Generalization\n" + + " general(Property):\n" + + " [>1] Anonymous_StripedId instance GenericType\n" + + " specific(Property):\n" + + " [>1] D instance Class\n" + + " name(Property):\n" + + " D instance String\n" + + " package(Property):\n" + + " K instance Package\n" + + " children(Property):\n" + + " [>1] D instance Class\n" + + " name(Property):\n" + + " [>1] K instance String\n" + + " package(Property):\n" + + " [>1] C instance Package", functionExecution.getConsole().getLine(1)); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tracing/TestInterpretedTraceSpan.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tracing/TestInterpretedTraceSpan.java new file mode 100644 index 00000000000..950d36a3c76 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/base/tracing/TestInterpretedTraceSpan.java @@ -0,0 +1,43 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.base.tracing; + +import io.opentracing.util.GlobalTracer; +import org.finos.legend.pure.m3.execution.FunctionExecution; +import org.finos.legend.pure.m3.tests.function.base.tracing.AbstractTestTraceSpan; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.junit.After; +import org.junit.BeforeClass; + +public class TestInterpretedTraceSpan extends AbstractTestTraceSpan +{ + @BeforeClass + public static void setUp() + { + setUpRuntime(getFunctionExecution()); + GlobalTracer.registerIfAbsent(tracer); + } + + @After + public void cleanRuntime() + { + runtime.delete("fromString.pure"); + } + + protected static FunctionExecution getFunctionExecution() + { + return new FunctionExecutionInterpreted(); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/TestBaseFunctions.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/TestBaseFunctions.java new file mode 100644 index 00000000000..a70abcc84f2 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/TestBaseFunctions.java @@ -0,0 +1,26 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.pure; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.interpreted.testHelper.PureTestBuilderInterpreted; + +public class TestBaseFunctions +{ + public static Test suite() + { + return PureTestBuilderInterpreted.buildSuite("meta::pure::functions"); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/Test_Interpreted_UnclassifiedFunctions_PCT.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/Test_Interpreted_UnclassifiedFunctions_PCT.java new file mode 100644 index 00000000000..83cffeeb5a3 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified/src/test/java/org/finos/legend/pure/runtime/java/interpreted/function/pure/Test_Interpreted_UnclassifiedFunctions_PCT.java @@ -0,0 +1,63 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.interpreted.function.pure; + +import junit.framework.Test; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.pure.code.core.CoreUnclassifiedFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.interpreted.testHelper.PureTestBuilderInterpreted; + +public class Test_Interpreted_UnclassifiedFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreUnclassifiedFunctionsCodeRepositoryProvider.unclassifiedFunctions; + private static final Adapter adapter = PlatformCodeRepositoryProvider.nativeAdapter; + private static final String platform = "interpreted"; + private static final MutableList expectedFailures = Lists.mutable.empty(); + + public static Test suite() + { + return PureTestBuilderInterpreted.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/pom.xml new file mode 100644 index 00000000000..4f42fca7640 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/pom.xml @@ -0,0 +1,43 @@ + + + + + + 4.0.0 + + + org.finos.legend.engine + legend-engine-pure-code-functions-unclassified + 4.50.2-SNAPSHOT + + + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + jar + Legend Pure - Runtime - Java Extension - Shared - Functions - Base + + + + org.bouncycastle + bcprov-jdk15on + + + + commons-codec + commons-codec + + + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/shared/cipher/AESCipherUtil.java b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/shared/cipher/AESCipherUtil.java new file mode 100644 index 00000000000..f04dc33fedd --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-runtime-java-extension-shared-functions-unclassified/src/main/java/org/finos/legend/pure/runtime/java/extension/functions/shared/cipher/AESCipherUtil.java @@ -0,0 +1,83 @@ +// Copyright 2020 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.pure.runtime.java.extension.functions.shared.cipher; + +import org.apache.commons.codec.binary.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.ByteBuffer; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; + +public class AESCipherUtil +{ + static + { + Security.addProvider(new BouncyCastleProvider()); + } + + private static final int IV_LEN = 12; + + public static byte[] encrypt(String keyString, byte[] bytes) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException + { + byte[] key = Base64.decodeBase64(keyString); + SecretKey secretKey = new SecretKeySpec(key, "AES"); + + SecureRandom secureRandom = new SecureRandom(); + byte[] iv = new byte[IV_LEN]; + secureRandom.nextBytes(iv); + + Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); + GCMParameterSpec parameterSpec = new GCMParameterSpec(128, iv); + cipher.init(Cipher.ENCRYPT_MODE, secretKey, parameterSpec); + + byte[] cipherText = cipher.doFinal(bytes); + + ByteBuffer byteBuffer = ByteBuffer.allocate(iv.length + cipherText.length); + byteBuffer.put(iv); + byteBuffer.put(cipherText); + byte[] cipherMessage = byteBuffer.array(); + return Base64.encodeBase64String(cipherMessage).getBytes(); + } + + public static byte[] decrypt(String keyString, byte[] encrypted) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException + { + byte[] key = Base64.decodeBase64(keyString); + SecretKey secretKey = new SecretKeySpec(key, "AES"); + + ByteBuffer byteBuffer = ByteBuffer.wrap(Base64.decodeBase64(encrypted)); + byte[] iv = new byte[IV_LEN]; + byteBuffer.get(iv); + byte[] cipherText = new byte[byteBuffer.remaining()]; + byteBuffer.get(cipherText); + + Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); + GCMParameterSpec parameterSpec = new GCMParameterSpec(128, iv); + + cipher.init(Cipher.DECRYPT_MODE, secretKey, parameterSpec); + + return cipher.doFinal(cipherText); + } +} diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/pom.xml new file mode 100644 index 00000000000..62e09df5513 --- /dev/null +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/pom.xml @@ -0,0 +1,35 @@ + + + + + org.finos.legend.engine + legend-engine-core-pure + 4.50.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-code-functions-unclassified + pom + Legend Engine - Pure - Code - Core - Functions - Unclassified + + + legend-engine-pure-functions-unclassified-pure + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-graph-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-graph-java/pom.xml index d5efc128222..f73ded2234a 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-graph-java/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-graph-java/pom.xml @@ -64,14 +64,14 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} @@ -108,7 +108,7 @@ - + diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-mapping-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-mapping-java/pom.xml index 2bf8c3d6a9f..b96d19e26f7 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-mapping-java/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-dsl-mapping-java/pom.xml @@ -69,14 +69,14 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} @@ -117,10 +117,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.eclipse.collections diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-java/pom.xml deleted file mode 100644 index eb3dd2b65ff..00000000000 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-java/pom.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - 4.0.0 - - - org.finos.legend.engine - legend-engine-pure-platform-modular-generation - 4.50.2-SNAPSHOT - - - legend-engine-pure-platform-functions-java - jar - Legend Engine - Pure - Platform - Functions - JAVA - - - - - org.finos.legend.pure - legend-pure-maven-generation-java - - - compile - - build-pure-compiled-jar - - - true - true - modular - true - - platform_functions - - - - - - - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} - - - - - - - - - org.finos.legend.pure - legend-pure-m4 - - - org.finos.legend.pure - legend-pure-m3-core - - - - org.finos.legend.pure - legend-pure-runtime-java-engine-compiled - - - org.finos.legend.pure - legend-pure-runtime-java-engine-shared - - - - org.finos.legend.engine - legend-engine-pure-platform-java - - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - - - - org.eclipse.collections - eclipse-collections-api - - - org.eclipse.collections - eclipse-collections - - - - diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-json-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-json-java/pom.xml deleted file mode 100644 index f228bee50d0..00000000000 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-json-java/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - 4.0.0 - - - org.finos.legend.engine - legend-engine-pure-platform-modular-generation - 4.50.2-SNAPSHOT - - - legend-engine-pure-platform-functions-json-java - jar - Legend Engine - Pure - Platform - Function - JSON - JAVA - - - - - org.finos.legend.pure - legend-pure-maven-generation-java - - - compile - - build-pure-compiled-jar - - - true - true - modular - true - - platform_functions_json - - - - - - - org.finos.legend.pure - legend-pure-m2-functions-json-pure - ${legend.pure.version} - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - ${legend.pure.version} - - - - - - - - - org.finos.legend.pure - legend-pure-m4 - - - org.finos.legend.pure - legend-pure-m3-core - - - - org.finos.legend.pure - legend-pure-runtime-java-engine-compiled - - - - - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - - - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json - - - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-conversion - - - - org.finos.legend.engine - legend-engine-pure-platform-java - - - - - - - - org.eclipse.collections - eclipse-collections-api - - - org.eclipse.collections - eclipse-collections - - - - diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-relation-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-relation-java/pom.xml deleted file mode 100644 index 64db10ae798..00000000000 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-functions-relation-java/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - 4.0.0 - - - org.finos.legend.engine - legend-engine-pure-platform-modular-generation - 4.50.2-SNAPSHOT - - - legend-engine-pure-platform-functions-relation-java - jar - Legend Engine - Pure - Platform - Function - Relation - JAVA - - - - - org.finos.legend.pure - legend-pure-maven-generation-java - - - compile - - build-pure-compiled-jar - - - true - true - modular - true - - platform_functions_relation - - - - - - - org.finos.legend.pure - legend-pure-m2-functions-relation-pure - ${legend.pure.version} - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-relation - ${legend.pure.version} - - - - - - - - - org.finos.legend.pure - legend-pure-m4 - - - org.finos.legend.pure - legend-pure-m3-core - - - org.finos.legend.pure - legend-pure-m2-dsl-tds-pure - - - - org.finos.legend.pure - legend-pure-runtime-java-engine-compiled - - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-relation - - - - org.finos.legend.engine - legend-engine-pure-platform-java - - - - org.eclipse.collections - eclipse-collections-api - - - org.eclipse.collections - eclipse-collections - - - - diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-store-relational-java/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-store-relational-java/pom.xml index bfc3af42d50..eec96e73f39 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-store-relational-java/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/legend-engine-pure-platform-store-relational-java/pom.xml @@ -75,14 +75,14 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} @@ -140,10 +140,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/pom.xml b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/pom.xml index 45d36ada760..52e8eab86c8 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-platform-modular-generation/pom.xml @@ -26,8 +26,6 @@ pom Legend Engine - Pure - Platform - Modular - Generation - JAVA - - legend-engine-pure-platform-dsl-diagram-java legend-engine-pure-platform-dsl-graph-java @@ -35,10 +33,7 @@ legend-engine-pure-platform-dsl-store-java legend-engine-pure-platform-dsl-path-java legend-engine-pure-platform-dsl-tds-java - legend-engine-pure-platform-functions-java - legend-engine-pure-platform-functions-json-java legend-engine-pure-platform-java legend-engine-pure-platform-store-relational-java - legend-engine-pure-platform-functions-relation-java \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-pure/pom.xml b/legend-engine-core/legend-engine-core-pure/pom.xml index 41e403a3908..3b2d0cc0102 100644 --- a/legend-engine-core/legend-engine-core-pure/pom.xml +++ b/legend-engine-core/legend-engine-core-pure/pom.xml @@ -28,7 +28,10 @@ legend-engine-pure-code-compiled-core - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-functions-standard + legend-engine-pure-code-functions-json + legend-engine-pure-code-functions-relation + legend-engine-pure-code-functions-unclassified legend-engine-pure-code-core-extension legend-engine-pure-platform-modular-generation diff --git a/legend-engine-core/legend-engine-core-query-pure-http-api/pom.xml b/legend-engine-core/legend-engine-core-query-pure-http-api/pom.xml index 4e5b4f146e2..5ea39c994ec 100644 --- a/legend-engine-core/legend-engine-core-query-pure-http-api/pom.xml +++ b/legend-engine-core/legend-engine-core-query-pure-http-api/pom.xml @@ -206,8 +206,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/pom.xml b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/pom.xml index e2fb6a318e2..01c0bb5d1f8 100644 --- a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/pom.xml +++ b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/pom.xml @@ -26,6 +26,10 @@ Legend Engine - Shared - Extensions + + org.finos.legend.engine + legend-engine-shared-structures + org.eclipse.collections eclipse-collections-api diff --git a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/Extensions.java b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/Extensions.java index f9e0fba5b3c..fa9a9a51c06 100644 --- a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/Extensions.java +++ b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/Extensions.java @@ -16,6 +16,7 @@ import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.impl.factory.Lists; +import org.finos.legend.shared.stuctures.TreeNode; import java.util.ServiceLoader; diff --git a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/pom.xml b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/pom.xml new file mode 100644 index 00000000000..f62ffc80e11 --- /dev/null +++ b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/pom.xml @@ -0,0 +1,43 @@ + + + + + + org.finos.legend.engine + legend-engine-core-shared + 4.50.2-SNAPSHOT + + 4.0.0 + legend-engine-shared-structures + Legend Engine - Shared - Structures + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + junit + junit + test + + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/TreeNode.java b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/main/java/org/finos/legend/shared/stuctures/TreeNode.java similarity index 74% rename from legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/TreeNode.java rename to legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/main/java/org/finos/legend/shared/stuctures/TreeNode.java index c85a732ad08..1f9fa84aec3 100644 --- a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/main/java/org/finos/legend/engine/shared/core/extension/TreeNode.java +++ b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/main/java/org/finos/legend/shared/stuctures/TreeNode.java @@ -12,24 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.engine.shared.core.extension; +package org.finos.legend.shared.stuctures; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.impl.factory.Lists; public class TreeNode { - private final String name; + private final Object value; private final MutableList children = Lists.mutable.empty(); - public TreeNode(String name) + public TreeNode(Object value) { - this.name = name; + this.value = value; } public TreeNode createOrReturnChild(String name) { - TreeNode node = children.detect(c -> name.equals(c.name)); + TreeNode node = children.detect(c -> name.equals(c.value)); return node == null ? addChild(new TreeNode(name)) : node; } @@ -39,6 +39,16 @@ public TreeNode addChild(TreeNode child) return child; } + public Object getValue() + { + return value; + } + + public MutableList getChildren() + { + return children; + } + public String print() { return printWithDepth(0, Lists.mutable.empty(), false); @@ -60,6 +70,6 @@ private String printWithDepth(int depth, MutableList parentLast, boolea builder.append(last ? "└" : "├"); } String prefix = builder.toString(); - return prefix + name + (children.isEmpty() ? "" : "\n") + children.collectWithIndex((c, i) -> c.printWithDepth(depth + 1, Lists.mutable.withAll(parentLast).with(last), i == children.size() - 1)).makeString("\n"); + return prefix + value.toString() + (children.isEmpty() ? "" : "\n") + children.collectWithIndex((c, i) -> c.printWithDepth(depth + 1, Lists.mutable.withAll(parentLast).with(last), i == children.size() - 1)).makeString("\n"); } } diff --git a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/test/java/org/finos/legend/engine/shared/core/extension/TestTreeNode.java b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/test/java/org/finos/legend/engine/shared/structures/TestTreeNode.java similarity index 95% rename from legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/test/java/org/finos/legend/engine/shared/core/extension/TestTreeNode.java rename to legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/test/java/org/finos/legend/engine/shared/structures/TestTreeNode.java index 624e73346e8..0ccf58616d7 100644 --- a/legend-engine-core/legend-engine-core-shared/legend-engine-shared-extensions/src/test/java/org/finos/legend/engine/shared/core/extension/TestTreeNode.java +++ b/legend-engine-core/legend-engine-core-shared/legend-engine-shared-structures/src/test/java/org/finos/legend/engine/shared/structures/TestTreeNode.java @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.finos.legend.engine.shared.core.extension; +package org.finos.legend.engine.shared.structures; +import org.finos.legend.shared.stuctures.TreeNode; import org.junit.Assert; import org.junit.Test; diff --git a/legend-engine-core/legend-engine-core-shared/pom.xml b/legend-engine-core/legend-engine-core-shared/pom.xml index bcc18e5ae9c..41353464c5f 100644 --- a/legend-engine-core/legend-engine-core-shared/pom.xml +++ b/legend-engine-core/legend-engine-core-shared/pom.xml @@ -31,5 +31,6 @@ legend-engine-shared-extensions legend-engine-shared-javaCompiler legend-engine-shared-vault + legend-engine-shared-structures \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-test-runner-mapping/pom.xml b/legend-engine-core/legend-engine-core-testable/legend-engine-test-runner-mapping/pom.xml index 1b52b85b38e..898ab5884d1 100644 --- a/legend-engine-core/legend-engine-core-testable/legend-engine-test-runner-mapping/pom.xml +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-test-runner-mapping/pom.xml @@ -34,8 +34,8 @@ legend-pure-m3-core - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json runtime diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml index fda4a37aabd..954be85313c 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml @@ -154,13 +154,19 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-functions-standard-pure runtime + - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified + runtime + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-json runtime @@ -200,8 +206,8 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-relation + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-relation runtime @@ -220,8 +226,8 @@ runtime - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure runtime @@ -235,8 +241,8 @@ legend-pure-runtime-java-engine-interpreted - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.pure diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java index 3b32a056e9b..1b1d18d3a1a 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java @@ -29,6 +29,7 @@ public class PureIDELight extends PureIDEServer public static void main(String[] args) throws Exception { System.setProperty("legend.test.h2.port", "1975"); + System.setProperty("user.timezone","GMT"); new PureIDELight().run(args.length == 0 ? new String[]{"server", "legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/resources/ideLightConfig.json"} : args); } @@ -37,6 +38,9 @@ protected MutableList buildRepositories(SourceLocationCon { return Lists.mutable.empty() .with(this.buildCore("legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure", "ide_metadata")) + .with(this.buildCore("legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-standard/legend-engine-pure-functions-standard-pure", "functions_standard")) + .with(this.buildCore("legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-unclassified/legend-engine-pure-functions-unclassified-pure", "functions_unclassified")) + .with(this.buildCore("legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-functions-relation/legend-engine-pure-functions-relation-pure", "functions_relation")) .with(this.buildCore("legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core", "")) .with(this.buildCore("legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure", "protocol_generation")) .with(this.buildCore("legend-engine-xts-persistence/legend-engine-xt-persistence-pure", "persistence")) diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/pom.xml b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/pom.xml index e678247972c..8266a44d611 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/pom.xml +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/pom.xml @@ -158,8 +158,8 @@ legend-pure-m3-core - org.finos.legend.pure - legend-pure-m2-functions-base-pure + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure runtime @@ -175,10 +175,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-relationalStore-pure @@ -228,8 +224,8 @@ test - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/src/main/resources/core_ide_metadata.definition.json b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/src/main/resources/core_ide_metadata.definition.json index 93178102b72..74d31c1952b 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/src/main/resources/core_ide_metadata.definition.json +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-metadata-pure/src/main/resources/core_ide_metadata.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::alloy|meta::protocols)(::.*)?", "dependencies": [ "platform", - "platform_functions", "core", "core_relational", "core_servicestore" diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/pom.xml b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/pom.xml index eed46044fe7..0d25a93aca7 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/pom.xml +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/pom.xml @@ -54,9 +54,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -123,10 +123,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.pure legend-pure-m2-dsl-diagram-pure @@ -146,14 +142,14 @@ runtime - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure runtime - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-relation - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation + ${project.version} runtime @@ -163,11 +159,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/src/main/resources/pure_ide.definition.json b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/src/main/resources/pure_ide.definition.json index 131c0a2a3d9..99932048e76 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/src/main/resources/pure_ide.definition.json +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-pure/src/main/resources/pure_ide.definition.json @@ -3,11 +3,10 @@ "pattern": "(meta::pure::ide)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", "platform_dsl_mapping", "platform_dsl_diagram", - "core_functions", + "core_functions_unclassified", + "core_functions_json", "core" ] } \ No newline at end of file diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-javaCompiler/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-javaCompiler/pom.xml index 83df2da2dca..8931029c777 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-javaCompiler/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-javaCompiler/pom.xml @@ -85,8 +85,8 @@ legend-engine-xt-javaGeneration-pure - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json runtime @@ -152,13 +152,13 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-javaCompiler/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-javaCompiler/pom.xml index c44710b803b..663825aeebe 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-javaCompiler/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-javaCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-javaCompiler/pom.xml @@ -89,13 +89,13 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler/pom.xml index 271d10de611..614c51446eb 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler/pom.xml @@ -122,13 +122,13 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-legendCompiler/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-legendCompiler/pom.xml index 9c7669ca225..1116e79b42f 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-legendCompiler/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-legendCompiler/legend-engine-pure-runtime-java-extension-interpreted-functions-legendCompiler/pom.xml @@ -94,8 +94,8 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-compiled-functions-planExecution/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-compiled-functions-planExecution/pom.xml index 5f84325f2eb..d2a54fc9cc9 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-compiled-functions-planExecution/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-compiled-functions-planExecution/pom.xml @@ -167,13 +167,13 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-interpreted-functions-planExecution/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-interpreted-functions-planExecution/pom.xml index 5ccd451914a..3c30d0966ee 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-interpreted-functions-planExecution/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-planExecution/legend-engine-pure-runtime-java-extension-interpreted-functions-planExecution/pom.xml @@ -107,13 +107,13 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-json test diff --git a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-pureExtensions/legend-engine-pure-runtime-java-extension-interpreted-functions-pureExtensions/pom.xml b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-pureExtensions/legend-engine-pure-runtime-java-extension-interpreted-functions-pureExtensions/pom.xml index 9754b5ead0b..4b2d475bebe 100644 --- a/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-pureExtensions/legend-engine-pure-runtime-java-extension-interpreted-functions-pureExtensions/pom.xml +++ b/legend-engine-pure/legend-engine-pure-runtime/legend-engine-pure-runtime-pureExtensions/legend-engine-pure-runtime-java-extension-interpreted-functions-pureExtensions/pom.xml @@ -72,8 +72,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-binding/legend-engine-xt-analytics-binding-pure/src/main/resources/core_analytics_binding.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-binding/legend-engine-xt-analytics-binding-pure/src/main/resources/core_analytics_binding.definition.json index fd38d51e2ab..f69be5bb5cc 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-binding/legend-engine-xt-analytics-binding-pure/src/main/resources/core_analytics_binding.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-binding/legend-engine-xt-analytics-binding-pure/src/main/resources/core_analytics_binding.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::analytics::binding)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core", - "core_functions", - "platform_functions_json" + "core_functions_unclassified", + "core_functions_json", + "core" ] } diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/pom.xml index 5882871c3f2..30fe7665642 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/pom.xml @@ -58,7 +58,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -91,7 +96,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -122,12 +132,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/src/main/resources/core_analytics_class.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/src/main/resources/core_analytics_class.definition.json index 8032fc0162f..461961e7d00 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/src/main/resources/core_analytics_class.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-class/legend-engine-xt-analytics-class-pure/src/main/resources/core_analytics_class.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::analytics::class)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions" + "core_functions_unclassified" ] } diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/pom.xml index 5d33fbf1205..9330b0d8bef 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/pom.xml @@ -120,10 +120,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-code-compiled-core diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/src/main/resources/core_analytics_function.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/src/main/resources/core_analytics_function.definition.json index 35dd71f52a7..96187410ffc 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/src/main/resources/core_analytics_function.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-function/legend-engine-xt-analytics-function-pure/src/main/resources/core_analytics_function.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::analytics::function)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core", - "core_functions", - "platform_functions_json" + "core_functions_unclassified", + "core_functions_json", + "core" ] } diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/pom.xml index 014ab6e4dbf..a0aca5cb223 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/pom.xml @@ -90,6 +90,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -153,6 +158,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -185,15 +195,16 @@ org.finos.legend.pure legend-pure-runtime-java-engine-compiled - - org.finos.legend.engine - legend-engine-pure-code-compiled-core + legend-engine-pure-functions-standard-pure + ${project.version} + + org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-compiled-core org.finos.legend.engine @@ -205,11 +216,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage.definition.json index 3b94f290130..217d8a0147e 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-lineage/legend-engine-xt-analytics-lineage-pure/src/main/resources/core_analytics_lineage.definition.json @@ -3,13 +3,13 @@ "pattern": "(meta::analytics::lineage|meta::pure::lineage)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", "platform_store_relational", - "platform_functions_json", - "core_functions", - "core", - "core_relational" + "core_functions_json", + "core_functions_standard", + "core_functions_unclassified", + "core_relational", + "core" ] } \ No newline at end of file diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/pom.xml index 5951decb8c8..ad48fb4cca2 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/pom.xml @@ -197,21 +197,17 @@ legend-engine-xt-analytics-class-pure ${project.version} - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/src/main/resources/core_analytics_mapping.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/src/main/resources/core_analytics_mapping.definition.json index a115eb01834..22ceeb5898d 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/src/main/resources/core_analytics_mapping.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-mapping/legend-engine-xt-analytics-mapping-pure/src/main/resources/core_analytics_mapping.definition.json @@ -3,12 +3,11 @@ "pattern": "(meta::analytics::mapping)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_store_relational", + "core_functions_json", + "core_functions_unclassified", "core_analytics_class", - "platform_functions_json", - "core_functions", "core_relational", "core_external_compiler", "core" diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/pom.xml index d97bbfbff55..4ac30e54a6a 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/pom.xml @@ -90,6 +90,11 @@ legend-engine-pure-functions-legendCompiler-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -172,6 +177,11 @@ legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -188,6 +198,10 @@ legend-pure-m3-core + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.finos.legend.pure legend-pure-runtime-java-engine-compiled @@ -202,17 +216,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/src/main/resources/core_analytics_quality.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/src/main/resources/core_analytics_quality.definition.json index 14ca97c654c..7591878a16f 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/src/main/resources/core_analytics_quality.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-quality/legend-engine-xt-analytics-quality-pure/src/main/resources/core_analytics_quality.definition.json @@ -3,12 +3,12 @@ "pattern": "(meta::analytics::quality|meta::pure::quality)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", "platform_store_relational", - "platform_functions_json", - "core_functions", + "core_functions_json", + "core_functions_unclassified", + "core_functions_standard", "core", "core_external_compiler", "core_data_space_metamodel" diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/pom.xml b/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/pom.xml index 4c1def7cf11..1d2bc843d03 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/pom.xml +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/pom.xml @@ -36,20 +36,7 @@ src/main/resources ${legend.pure.version} - platform - platform_functions - platform_dsl_mapping - platform_functions_json - platform_store_relational - core - core_relational - core_data_space_metamodel - core_diagram - core_diagram_metamodel - core_analytics_lineage - core_analytics_mapping core_analytics_search - core_external_compiler ${project.basedir}/src/main/resources/core_analytics_search.definition.json @@ -285,11 +272,11 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-compiled-core org.finos.legend.engine - legend-engine-pure-code-compiled-core + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -336,10 +323,6 @@ org.finos.legend.engine legend-engine-xt-analytics-mapping-pure - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - diff --git a/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/src/main/resources/core_analytics_search.definition.json b/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/src/main/resources/core_analytics_search.definition.json index 2f461d76908..2d38765285f 100644 --- a/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/src/main/resources/core_analytics_search.definition.json +++ b/legend-engine-xts-analytics/legend-engine-xts-analytics-search/legend-engine-xt-analytics-search-pure/src/main/resources/core_analytics_search.definition.json @@ -3,12 +3,11 @@ "pattern": "(meta::analytics::search|meta::pure::search)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", - "platform_functions_json", "platform_store_relational", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_relational", "core_service", diff --git a/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/pom.xml b/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/pom.xml index 031bf2683b7..dbf11375850 100644 --- a/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/pom.xml +++ b/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/pom.xml @@ -34,9 +34,6 @@ src/main/resources ${legend.pure.version} - platform - platform_functions - core core_external_format_arrow diff --git a/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/src/main/resources/core_external_format_arrow.definition.json b/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/src/main/resources/core_external_format_arrow.definition.json index bf38ed96cba..12f91e49104 100644 --- a/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/src/main/resources/core_external_format_arrow.definition.json +++ b/legend-engine-xts-arrow/legend-engine-xt-arrow-pure/src/main/resources/core_external_format_arrow.definition.json @@ -3,7 +3,7 @@ "pattern": "(meta::external::format::arrow|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "core" ] } diff --git a/legend-engine-xts-authentication/legend-engine-xt-authentication-pure/src/main/resources/core_authentication.definition.json b/legend-engine-xts-authentication/legend-engine-xt-authentication-pure/src/main/resources/core_authentication.definition.json index 20331ada188..ec5327653a3 100644 --- a/legend-engine-xts-authentication/legend-engine-xt-authentication-pure/src/main/resources/core_authentication.definition.json +++ b/legend-engine-xts-authentication/legend-engine-xt-authentication-pure/src/main/resources/core_authentication.definition.json @@ -3,7 +3,7 @@ "pattern": "(meta::pure::runtime::connection::authentication|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "core" ] } diff --git a/legend-engine-xts-avro/legend-engine-xt-avro-pure/pom.xml b/legend-engine-xts-avro/legend-engine-xt-avro-pure/pom.xml index 60be585d57c..e80618e40d2 100644 --- a/legend-engine-xts-avro/legend-engine-xt-avro-pure/pom.xml +++ b/legend-engine-xts-avro/legend-engine-xt-avro-pure/pom.xml @@ -151,17 +151,13 @@ org.finos.legend.pure legend-pure-runtime-java-engine-compiled - - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json - org.finos.legend.engine - legend-engine-pure-code-compiled-core + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-compiled-core org.finos.legend.engine @@ -173,11 +169,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json diff --git a/legend-engine-xts-avro/legend-engine-xt-avro-pure/src/main/resources/core_external_format_avro.definition.json b/legend-engine-xts-avro/legend-engine-xt-avro-pure/src/main/resources/core_external_format_avro.definition.json index 41907085787..e4efb138a88 100644 --- a/legend-engine-xts-avro/legend-engine-xt-avro-pure/src/main/resources/core_external_format_avro.definition.json +++ b/legend-engine-xts-avro/legend-engine-xt-avro-pure/src/main/resources/core_external_format_avro.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::external::format::avro|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions_json", - "platform_functions", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_generation" ] diff --git a/legend-engine-xts-avro/legend-engine-xt-avro/src/main/java/org/finos/legend/engine/external/format/avro/schema/generations/AvroGenerationConfig.java b/legend-engine-xts-avro/legend-engine-xt-avro/src/main/java/org/finos/legend/engine/external/format/avro/schema/generations/AvroGenerationConfig.java index 37d73638dde..53005b6d7e8 100644 --- a/legend-engine-xts-avro/legend-engine-xt-avro/src/main/java/org/finos/legend/engine/external/format/avro/schema/generations/AvroGenerationConfig.java +++ b/legend-engine-xts-avro/legend-engine-xt-avro/src/main/java/org/finos/legend/engine/external/format/avro/schema/generations/AvroGenerationConfig.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Map; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; public class AvroGenerationConfig extends GenerationConfiguration { diff --git a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-pure/pom.xml b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-pure/pom.xml index 6b14a9a12e7..0c99bcee1e7 100644 --- a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-pure/pom.xml +++ b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-pure/pom.xml @@ -131,10 +131,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-relationalStore-pure diff --git a/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/pom.xml b/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/pom.xml index f0b50ffb247..7723042e880 100644 --- a/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/pom.xml +++ b/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/pom.xml @@ -80,9 +80,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -157,11 +157,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine @@ -169,8 +169,8 @@ runtime - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.engine diff --git a/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/src/main/resources/core_pure_changetoken.definition.json b/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/src/main/resources/core_pure_changetoken.definition.json index 4bae77dae4b..55fabf81525 100644 --- a/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/src/main/resources/core_pure_changetoken.definition.json +++ b/legend-engine-xts-changetoken/legend-engine-xt-changetoken-pure/src/main/resources/core_pure_changetoken.definition.json @@ -1,5 +1,5 @@ { "name" : "core_pure_changetoken", "pattern" : "(meta::pure::changetoken)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_functions_json", "core", "core_external_language_java"] + "dependencies" : ["platform", "core_functions_unclassified", "core_functions_json", "core", "core_external_language_java"] } diff --git a/legend-engine-xts-daml/legend-engine-xt-daml-model/src/main/java/org/finos/legend/engine/external/format/daml/generation/DAMLGenerationConfig.java b/legend-engine-xts-daml/legend-engine-xt-daml-model/src/main/java/org/finos/legend/engine/external/format/daml/generation/DAMLGenerationConfig.java index 7e8f2431710..f7137b52a45 100644 --- a/legend-engine-xts-daml/legend-engine-xt-daml-model/src/main/java/org/finos/legend/engine/external/format/daml/generation/DAMLGenerationConfig.java +++ b/legend-engine-xts-daml/legend-engine-xt-daml-model/src/main/java/org/finos/legend/engine/external/format/daml/generation/DAMLGenerationConfig.java @@ -24,7 +24,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; @Deprecated diff --git a/legend-engine-xts-daml/legend-engine-xt-daml-pure/pom.xml b/legend-engine-xts-daml/legend-engine-xt-daml-pure/pom.xml index 69a730c524e..8bfba72803c 100644 --- a/legend-engine-xts-daml/legend-engine-xt-daml-pure/pom.xml +++ b/legend-engine-xts-daml/legend-engine-xt-daml-pure/pom.xml @@ -168,10 +168,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - diff --git a/legend-engine-xts-daml/legend-engine-xt-daml-pure/src/main/resources/core_external_language_daml.definition.json b/legend-engine-xts-daml/legend-engine-xt-daml-pure/src/main/resources/core_external_language_daml.definition.json index 92ff7f4d6e2..397e972dc5a 100644 --- a/legend-engine-xts-daml/legend-engine-xt-daml-pure/src/main/resources/core_external_language_daml.definition.json +++ b/legend-engine-xts-daml/legend-engine-xt-daml-pure/src/main/resources/core_external_language_daml.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::external::language::daml)(::.*)?", "dependencies": [ "platform", - "platform_functions", "core", "core_generation", "core_external_language_haskell" diff --git a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure-metamodel/src/main/resources/core_data_space_metamodel.definition.json b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure-metamodel/src/main/resources/core_data_space_metamodel.definition.json index 5d39f9abaa0..84344b7fd4c 100644 --- a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure-metamodel/src/main/resources/core_data_space_metamodel.definition.json +++ b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure-metamodel/src/main/resources/core_data_space_metamodel.definition.json @@ -4,7 +4,7 @@ "dependencies": [ "platform", "platform_dsl_mapping", - "platform_functions", + "core_functions_unclassified", "core", "core_diagram_metamodel" ] diff --git a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/pom.xml b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/pom.xml index 30eb1785b6a..d8874af23b2 100644 --- a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/pom.xml +++ b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/pom.xml @@ -199,7 +199,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -209,10 +209,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-diagram-pure-metamodel diff --git a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/src/main/resources/core_data_space.definition.json b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/src/main/resources/core_data_space.definition.json index 4ac522ff207..8cd1ca69ba6 100644 --- a/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/src/main/resources/core_data_space.definition.json +++ b/legend-engine-xts-data-space/legend-engine-xt-data-space-pure/src/main/resources/core_data_space.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::pure::metamodel::dataSpace)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", - "core_functions", + "core_functions_unclassified", "core", "core_diagram_metamodel", "core_diagram", diff --git a/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/pom.xml b/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/pom.xml index 888e904b091..45f2a81b278 100644 --- a/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/pom.xml +++ b/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/pom.xml @@ -25,12 +25,7 @@ src/main/resources ${legend.pure.version} - - - - - - + core_dataquality ${project.basedir}/src/main/resources/core_dataquality.definition.json @@ -45,11 +40,6 @@ - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - org.finos.legend.engine legend-engine-xt-functionActivator-pure @@ -65,21 +55,6 @@ legend-engine-xt-relationalStore-pure ${project.version} - - - - - - - - - - - - - - - org.finos.legend.pure legend-pure-m2-dsl-store-pure @@ -128,11 +103,6 @@ legend-pure-m2-dsl-store-pure ${legend.pure.version} - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - org.finos.legend.engine legend-engine-xt-functionActivator-pure @@ -148,21 +118,6 @@ legend-engine-xt-relationalStore-pure ${project.version} - - - - - - - - - - - - - - - org.finos.legend.engine legend-engine-pure-runtime-java-extension-compiled-functions-planExecution @@ -261,21 +216,12 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.pure - legend-pure-m2-functions-json-pure - test - com.fasterxml.jackson.core jackson-annotations diff --git a/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/src/main/resources/core_dataquality.definition.json b/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/src/main/resources/core_dataquality.definition.json index 3e2ff32569b..0195b4c6683 100644 --- a/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/src/main/resources/core_dataquality.definition.json +++ b/legend-engine-xts-dataquality/legend-engine-xt-dataquality-pure/src/main/resources/core_dataquality.definition.json @@ -4,14 +4,11 @@ "dependencies": [ "core", "core_relational", - "core_functions", - "core_relational", "core_data_space_metamodel", "platform", "platform_dsl_store", "platform_dsl_graph", "platform_dsl_mapping", - "platform_store_relational", - "platform_functions" + "platform_store_relational" ] } \ No newline at end of file diff --git a/legend-engine-xts-dataquality/pom.xml b/legend-engine-xts-dataquality/pom.xml index c1f8368c6cd..df1625b1927 100644 --- a/legend-engine-xts-dataquality/pom.xml +++ b/legend-engine-xts-dataquality/pom.xml @@ -11,8 +11,6 @@ pom Legend Engine - XTS - DataQuality - - legend-engine-xt-dataquality-pure legend-engine-xt-dataquality-grammar diff --git a/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/pom.xml b/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/pom.xml index 2a1190721e6..c5b39c6249b 100644 --- a/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/pom.xml +++ b/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/pom.xml @@ -58,7 +58,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -66,6 +66,11 @@ legend-engine-xt-diagram-pure-metamodel ${project.version} + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} + @@ -96,7 +101,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -104,6 +109,11 @@ legend-engine-xt-diagram-pure-metamodel ${project.version} + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} + @@ -132,12 +142,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/src/main/resources/core_diagram.definition.json b/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/src/main/resources/core_diagram.definition.json index 37bbf210cf7..fb71c96d1ca 100644 --- a/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/src/main/resources/core_diagram.definition.json +++ b/legend-engine-xts-diagram/legend-engine-xt-diagram-pure/src/main/resources/core_diagram.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::pure::milestoning|meta::pure::functions::meta|meta::pure::metamodel::diagram)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions", + "core_functions_unclassified", "core_diagram_metamodel" ] } \ No newline at end of file diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-grammar/pom.xml b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-grammar/pom.xml index 2e8164f6dbe..ce4b17ea000 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-grammar/pom.xml +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-grammar/pom.xml @@ -100,7 +100,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/pom.xml b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/pom.xml index 881479c89ad..beb90adb43e 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/pom.xml +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/pom.xml @@ -63,17 +63,13 @@ org.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -165,9 +161,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -179,6 +175,11 @@ legend-engine-pure-code-compiled-core ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -222,6 +223,11 @@ legend-engine-pure-code-compiled-core ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/src/main/resources/core_elasticsearch_seven_metamodel.definition.json b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/src/main/resources/core_elasticsearch_seven_metamodel.definition.json index 790793b9768..af10d0528b6 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/src/main/resources/core_elasticsearch_seven_metamodel.definition.json +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-pure-metamodel/src/main/resources/core_elasticsearch_seven_metamodel.definition.json @@ -3,10 +3,10 @@ "pattern" : "(meta::external::store::elasticsearch::v7)(::.*)?", "dependencies" : [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_authentication" ] diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/pom.xml b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/pom.xml index 35c5b79b8f1..b0f926f574f 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/pom.xml +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/pom.xml @@ -45,16 +45,16 @@ legend-pure-runtime-java-engine-interpreted - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -62,11 +62,11 @@ org.finos.legend.engine - legend-engine-pure-code-core-extension + legend-engine-pure-functions-standard-pure org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-core-extension org.finos.legend.engine @@ -257,9 +257,9 @@ ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -276,6 +276,11 @@ legend-engine-pure-functions-planExecution-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -310,9 +315,9 @@ ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -344,6 +349,11 @@ legend-engine-pure-runtime-java-extension-compiled-functions-planExecution ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/src/main/resources/core_elasticsearch_execution_test.definition.json b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/src/main/resources/core_elasticsearch_execution_test.definition.json index 87ddbc016ef..08bbd9e3c00 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/src/main/resources/core_elasticsearch_execution_test.definition.json +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test/src/main/resources/core_elasticsearch_execution_test.definition.json @@ -3,10 +3,10 @@ "pattern": "(meta::external::store::elasticsearch::executionTest)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", "platform_dsl_mapping", - "core_functions", + "core_functions_json", + "core_functions_unclassified", + "core_functions_standard", "core", "core_authentication", "core_elasticsearch_seven_metamodel", diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/pom.xml b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/pom.xml index e418d0b95b0..a23da17da4b 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/pom.xml +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/pom.xml @@ -47,21 +47,17 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine @@ -142,9 +138,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/src/main/resources/core_elasticsearch_specification_metamodel.definition.json b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/src/main/resources/core_elasticsearch_specification_metamodel.definition.json index 5f9a07c0969..b0dd24f29e9 100644 --- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/src/main/resources/core_elasticsearch_specification_metamodel.definition.json +++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel/src/main/resources/core_elasticsearch_specification_metamodel.definition.json @@ -3,9 +3,8 @@ "pattern" : "(meta::external::store::elasticsearch::specification::metamodel)(::.*)?", "dependencies" : [ "platform", - "platform_functions", - "platform_functions_json", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_external_language_java", "core_protocol_generation" diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/pom.xml index 886f8d4af75..1c0c9539dca 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/pom.xml @@ -181,10 +181,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-flatdata-pure diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/src/main/resources/core_external_format_flatdata_java_platform_binding.definition.json b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/src/main/resources/core_external_format_flatdata_java_platform_binding.definition.json index 082dd93291f..0799a53dff3 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/src/main/resources/core_external_format_flatdata_java_platform_binding.definition.json +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-javaPlatformBinding-pure/src/main/resources/core_external_format_flatdata_java_platform_binding.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::external::format::flatdata::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", "core", "core_external_format_flatdata", diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-model/pom.xml b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-model/pom.xml index 9d2f1849105..aa32d6d7864 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-model/pom.xml +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-model/pom.xml @@ -197,8 +197,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/pom.xml b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/pom.xml index 3fa17c0229b..a2bca77e0e0 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/pom.xml +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/pom.xml @@ -75,9 +75,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-json-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-json-pure + ${project.version} @@ -173,7 +173,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/src/main/resources/core_external_format_flatdata.definition.json b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/src/main/resources/core_external_format_flatdata.definition.json index f3fc1fa8590..c328ac5f8a0 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/src/main/resources/core_external_format_flatdata.definition.json +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-pure/src/main/resources/core_external_format_flatdata.definition.json @@ -3,7 +3,7 @@ "pattern": "(meta::external::format::flatdata)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "core" ] } \ No newline at end of file diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-runtime/pom.xml b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-runtime/pom.xml index 6f4c509498d..85001c594e8 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-runtime/pom.xml +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-runtime/pom.xml @@ -168,8 +168,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-shared/pom.xml b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-shared/pom.xml index 2b0c652f6c5..c1e5f14bdf9 100644 --- a/legend-engine-xts-flatdata/legend-engine-xt-flatdata-shared/pom.xml +++ b/legend-engine-xts-flatdata/legend-engine-xt-flatdata-shared/pom.xml @@ -75,6 +75,7 @@ + org.finos.legend.engine diff --git a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-generation/src/main/java/org/finos/legend/engine/functionActivator/generation/FunctionActivatorArtifactGenerationExtension.java b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-generation/src/main/java/org/finos/legend/engine/functionActivator/generation/FunctionActivatorArtifactGenerationExtension.java index 492adf33be9..36a04ec428d 100644 --- a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-generation/src/main/java/org/finos/legend/engine/functionActivator/generation/FunctionActivatorArtifactGenerationExtension.java +++ b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-generation/src/main/java/org/finos/legend/engine/functionActivator/generation/FunctionActivatorArtifactGenerationExtension.java @@ -31,7 +31,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class FunctionActivatorArtifactGenerationExtension implements ArtifactGenerationExtension { diff --git a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/pom.xml b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/pom.xml index 48766472bcd..14aec4b2ef5 100644 --- a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/pom.xml +++ b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/pom.xml @@ -166,21 +166,13 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java - - - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/src/main/resources/core_function_activator.definition.json b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/src/main/resources/core_function_activator.definition.json index d85797a7063..615bedbad03 100644 --- a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/src/main/resources/core_function_activator.definition.json +++ b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-pure/src/main/resources/core_function_activator.definition.json @@ -2,10 +2,9 @@ "name": "core_function_activator", "pattern": "(meta::external::function::activator|meta::protocols)(::.*)?", "dependencies": [ - "core_functions", "core_analytics_lineage", + "core_functions_unclassified", "platform", - "platform_functions", "core" ] } \ No newline at end of file diff --git a/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/pom.xml b/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/pom.xml index 6a943a1c8c5..3fbcad43473 100644 --- a/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/pom.xml +++ b/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/pom.xml @@ -85,14 +85,9 @@ - - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} - org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -118,19 +113,14 @@ - - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} - org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -161,13 +151,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - ${project.version} + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/src/main/resources/core_generation.definition.json b/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/src/main/resources/core_generation.definition.json index c4e52480e43..76b43ed1e89 100644 --- a/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/src/main/resources/core_generation.definition.json +++ b/legend-engine-xts-generation/legend-engine-language-pure-dsl-generation-pure/src/main/resources/core_generation.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::pure::generation|meta::protocols)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions" + "core_functions_unclassified" ] } \ No newline at end of file diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-http-api/src/main/java/org/finos/legend/engine/query/graphQL/api/format/generation/GraphQLGenerationConfig.java b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-http-api/src/main/java/org/finos/legend/engine/query/graphQL/api/format/generation/GraphQLGenerationConfig.java index 7202523c0fe..f90f5475679 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-http-api/src/main/java/org/finos/legend/engine/query/graphQL/api/format/generation/GraphQLGenerationConfig.java +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-http-api/src/main/java/org/finos/legend/engine/query/graphQL/api/format/generation/GraphQLGenerationConfig.java @@ -24,7 +24,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; @Deprecated public class GraphQLGenerationConfig extends GenerationConfiguration diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/pom.xml b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/pom.xml index 61d2cddef57..b3424f9ec8f 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/pom.xml +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/pom.xml @@ -65,7 +65,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -98,7 +103,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -123,14 +133,13 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-pure-platform-java - org.eclipse.collections eclipse-collections diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/src/main/resources/core_external_query_graphql_metamodel.definition.json b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/src/main/resources/core_external_query_graphql_metamodel.definition.json index 889db29c052..87510ec0e30 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/src/main/resources/core_external_query_graphql_metamodel.definition.json +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure-metamodel/src/main/resources/core_external_query_graphql_metamodel.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::external::query::graphQL)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_diagram", - "core_functions" + "core_functions_unclassified" ] } \ No newline at end of file diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/pom.xml b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/pom.xml index 64f0963e17a..bead8878cb6 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/pom.xml +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/pom.xml @@ -203,10 +203,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-language-pure-dsl-generation-pure @@ -218,7 +214,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql.definition.json b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql.definition.json index 097eab3a9f2..19609b0a2ba 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql.definition.json +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql.definition.json @@ -3,11 +3,10 @@ "pattern": "(meta::external::query::graphQL)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", "platform_dsl_mapping", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", "core", "core_generation", "core_external_compiler", diff --git a/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/pom.xml b/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/pom.xml index 0756496717d..f2dd06c0cad 100644 --- a/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/pom.xml +++ b/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/pom.xml @@ -143,17 +143,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/src/main/resources/core_external_language_haskell.definition.json b/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/src/main/resources/core_external_language_haskell.definition.json index 41da0a8820a..d471e15d317 100644 --- a/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/src/main/resources/core_external_language_haskell.definition.json +++ b/legend-engine-xts-haskell/legend-engine-xt-haskell-pure/src/main/resources/core_external_language_haskell.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::external::language::haskell)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions", + "core_functions_unclassified", "core" ] } \ No newline at end of file diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-generation/src/main/java/org/finos/legend/engine/language/hostedService/generation/HostedServiceArtifactGenerator.java b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-generation/src/main/java/org/finos/legend/engine/language/hostedService/generation/HostedServiceArtifactGenerator.java index a9f79d2702d..31c7cee62fb 100644 --- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-generation/src/main/java/org/finos/legend/engine/language/hostedService/generation/HostedServiceArtifactGenerator.java +++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-generation/src/main/java/org/finos/legend/engine/language/hostedService/generation/HostedServiceArtifactGenerator.java @@ -46,7 +46,7 @@ import java.util.Map; import java.util.ServiceLoader; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class HostedServiceArtifactGenerator { diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/pom.xml b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/pom.xml index 3436e7af4dc..07bc37e1e48 100644 --- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/pom.xml +++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/pom.xml @@ -189,10 +189,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.pure @@ -216,7 +212,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/src/main/resources/core_hostedservice.definition.json b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/src/main/resources/core_hostedservice.definition.json index 7ac5c7baab3..a91f1b0ad6f 100644 --- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/src/main/resources/core_hostedservice.definition.json +++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-pure/src/main/resources/core_hostedservice.definition.json @@ -7,11 +7,10 @@ "platform_dsl_mapping", "platform_dsl_store", "platform_store_relational", - "platform_functions", - "platform_functions_json", + "core_functions_unclassified", + "core_functions_json", "core_relational", "core_function_activator", - "core_functions", "core_service", "core", "core_data_space_metamodel", diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/pom.xml b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/pom.xml index 8723bb0cf18..60a9582e05f 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/pom.xml +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/pom.xml @@ -156,10 +156,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-language-pure-dsl-generation-pure @@ -175,7 +171,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation.definition.json b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation.definition.json index 875e0685db3..3490bef4d39 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation.definition.json +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation.definition.json @@ -3,10 +3,9 @@ "pattern": "(meta::external::language::java::generation::featureBased)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_diagram", "platform_dsl_mapping", - "core_functions", + "core_functions_unclassified", "core", "core_generation", "core_external_language_java" diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/pom.xml b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/pom.xml index b782872e17c..facca382520 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/pom.xml +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/pom.xml @@ -69,9 +69,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-json-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-json-pure + ${project.version} org.finos.legend.engine @@ -80,7 +80,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-standard-pure ${project.version} @@ -126,6 +126,11 @@ legend-pure-m2-dsl-diagram-grammar ${legend.pure.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -147,6 +152,11 @@ legend-pure-m2-dsl-mapping-pure + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + + org.finos.legend.pure legend-pure-runtime-java-engine-shared @@ -163,17 +173,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java.definition.json b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java.definition.json index f9623dc89ee..9365d1e05da 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java.definition.json +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java.definition.json @@ -4,11 +4,11 @@ "dependencies" : [ "platform", - "platform_functions", "platform_dsl_mapping", - "platform_functions_json", + "core_functions_json", + "core_functions_standard", "platform_dsl_graph", - "core_functions", + "core_functions_unclassified", "core" ] } \ No newline at end of file diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/conventions.pure b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/conventions.pure index b8d8e309780..0cca6da7cd8 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/conventions.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/conventions.pure @@ -805,7 +805,7 @@ Class meta::external::language::java::transform::FuncCoderContext returnType() { - $this.conventions->pureTypeToJavaType($this.fe.genericType.rawType->toOne(), $this.fe.multiplicity); + $this.conventions->pureTypeToJavaType(if($this.fe.genericType.rawType->isEmpty(),|Any,|$this.fe.genericType.rawType->toOne()), $this.fe.multiplicity); }:meta::external::language::java::metamodel::Type[1]; } diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/expressionGeneration.pure b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/expressionGeneration.pure index aa956f8eccb..d81e2cf3a76 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/expressionGeneration.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-pure/src/main/resources/core_external_language_java/generation/expressionGeneration.pure @@ -241,7 +241,7 @@ function <> meta::external::language::java::transform::processFu }, {z:Any[1] | print(if($debug.debug,|$debug.space+'func: \''+($fe.func.name->toOne())+'\'\n',|'')); - assert(!$conventions->isProhibitedFunction($fe.func), |$fe.func.name->toOne()+' is prohibited!'); + assert(!$conventions->isProhibitedFunction($fe.func), |$fe.func.name->toOne()+' is prohibited!'); let toEval = $conventions->getFunctionCoder($fe.func); assert($toEval->isNotEmpty() || $fe.func->instanceOf(ConcreteFunctionDefinition), {| @@ -250,7 +250,7 @@ function <> meta::external::language::java::transform::processFu if($p->isEmpty(), |'', |$p->toOne()->elementToPath()+'::')+$f.name->toOne()+' is not supported yet!'; }); if($toEval->isNotEmpty(), - |$toEval->toOne()->eval($fe->cast(@FunctionExpression), $conventions, $debug), + |$toEval->toOne()->eval($fe->cast(@FunctionExpression), $conventions, $debug);, |$fe->processConcreteFunctionExpression($conventions, $debug) ); } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/pom.xml b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/pom.xml index 3393f040d23..d18199b483d 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/pom.xml +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/pom.xml @@ -36,8 +36,8 @@ Compiled ${project.build.directory}/classes/pct-reports/ - org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_BaseFunction_PCT - org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_BasicFunction_PCT + org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_StandardFunction_PCT + org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_EssentialFunction_PCT org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_GrammarFunction_PCT org.finos.legend.engine.pure.code.core.java.binding.Test_JAVA_RelationFunction_PCT @@ -64,7 +64,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-functions-standard-pure ${project.version} @@ -74,7 +74,12 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure ${project.version} @@ -85,21 +90,17 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure + org.finos.legend.engine + legend-engine-pure-functions-standard-pure - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure org.eclipse.collections eclipse-collections-api - - com.fasterxml.jackson.core - jackson-databind - junit @@ -137,7 +138,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation test @@ -165,11 +166,6 @@ legend-engine-pure-runtime-java-extension-compiled-functions-pureExtensions test - - org.finos.legend.engine - legend-engine-pure-runtime-java-extension-compiled-functions-pureExtensions - test - org.finos.legend.engine legend-engine-test-framework diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/main/java/org/finos/legend/engine/pure/code/core/java/binding/Core_JavaBinding_PCTReportProvider.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/main/java/org/finos/legend/engine/pure/code/core/java/binding/Core_JavaBinding_PCTReportProvider.java index 8c36e6ee882..e0ff1914407 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/main/java/org/finos/legend/engine/pure/code/core/java/binding/Core_JavaBinding_PCTReportProvider.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/main/java/org/finos/legend/engine/pure/code/core/java/binding/Core_JavaBinding_PCTReportProvider.java @@ -14,12 +14,12 @@ package org.finos.legend.engine.pure.code.core.java.binding; -import com.fasterxml.jackson.databind.json.JsonMapper; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.finos.legend.pure.m3.pct.functions.model.Functions; import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; public class Core_JavaBinding_PCTReportProvider implements PCTReportProvider { @@ -32,30 +32,11 @@ public MutableList getFunctions() @Override public MutableList getAdapterReports() { - try - { - return Lists.mutable.with( - JsonMapper.builder().build().readValue( - Core_JavaBinding_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_base_compiled_Java.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_JavaBinding_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_basic_compiled_Java.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_JavaBinding_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_grammar_compiled_Java.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_JavaBinding_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_relation_compiled_Java.json"), - AdapterReport.class - ) - ); - } - catch (Exception e) - { - throw new RuntimeException(e); - } + return PCTReportProviderTool.load(Core_JavaBinding_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_Java.json", + "pct-reports/ADAPTER_essential_compiled_Java.json", + "pct-reports/ADAPTER_grammar_compiled_Java.json", + "pct-reports/ADAPTER_relation_compiled_Java.json" + ); } } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/TestPCRReport.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/TestPCRReport.java index e2209f70ceb..9a890824d3d 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/TestPCRReport.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/TestPCRReport.java @@ -24,6 +24,6 @@ public class TestPCRReport public void canFindPCTReport() { Assert.assertEquals("Java, Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); - Assert.assertEquals(8, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals(9, PCTReportProviderLoader.gatherReports().size()); } } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BasicFunction_PCT.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BasicFunction_PCT.java deleted file mode 100644 index 9d9d6f7db17..00000000000 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BasicFunction_PCT.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2024 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.pure.code.core.java.binding; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.pure.code.core.CoreJavaPlatformBindingCodeRepositoryProvider; -import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -public class Test_JAVA_BasicFunction_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = PlatformCodeRepositoryProvider.basicFunctions; - private static final Adapter adapter = CoreJavaPlatformBindingCodeRepositoryProvider.javaAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Add - one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"meta::pure::functions::collection::add_T_MANY__Integer_1__T_1__T_$1_MANY$_ is not supported yet!\""), - - // Concatenate - one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - - // Fold - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"Assert failed\""), - one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), - one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), - one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), - - // Sort - one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - // Format - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), - one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"evaluate_Function_1__List_MANY__Any_MANY_ is prohibited!\""), - one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - // ToString - one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::Pair\""), - one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"\nexpected: '// Warning: Good for gin -- Sad times no tonic'\nactual: '_pure.internal.meta.pure.functions.string.tests.toString.ClassWithComplexToString_Impl") - - ); - - public static Test suite() - { - return PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BaseFunction_PCT.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_EssentialFunction_PCT.java similarity index 55% rename from legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BaseFunction_PCT.java rename to legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_EssentialFunction_PCT.java index 16f94269ab7..08ca07091db 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_BaseFunction_PCT.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_EssentialFunction_PCT.java @@ -18,85 +18,157 @@ import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.finos.legend.pure.code.core.CoreJavaPlatformBindingCodeRepositoryProvider; -import org.finos.legend.pure.code.core.FunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; import org.finos.legend.pure.m3.pct.reports.model.Adapter; import org.finos.legend.pure.m3.pct.shared.model.ReportScope; import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; -public class Test_JAVA_BaseFunction_PCT extends PCTReportConfiguration +public class Test_JAVA_EssentialFunction_PCT extends PCTReportConfiguration { - private static final ReportScope reportScope = FunctionsCodeRepositoryProvider.baseFunctions; + private static final ReportScope reportScope = PlatformCodeRepositoryProvider.essentialFunctions; private static final Adapter adapter = CoreJavaPlatformBindingCodeRepositoryProvider.javaAdapter; private static final String platform = "compiled"; private static final MutableList expectedFailures = Lists.mutable.with( + // Add + one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"meta::pure::functions::collection::add_T_MANY__Integer_1__T_1__T_$1_MANY$_ is not supported yet!\""), + + // Concatenate + one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + // Contains one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::model::CO_Firm\""), one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::contains::ClassWithoutEquality\""), + // Drop one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + // Exists one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::model::CO_Firm\""), one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::model::CO_Firm\""), + // Find (Not Supported Yet) pack("meta::pure::functions::collection::tests::find", "\"meta::pure::functions::collection::find_T_MANY__Function_1__T_$0_1$_ is not supported yet!\""), + + // Fold + one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), + one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), + one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::fold::FO_Person\""), + // ForAll one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + // Last one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + // Slice one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + // Take one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + // Zip pack("meta::pure::functions::collection::tests::zip", "\"meta::pure::functions::collection::zip_T_MANY__U_MANY__Pair_MANY_ is not supported yet!\""), + + // Format + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), + one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"evaluate_Function_1__List_MANY__Any_MANY_ is prohibited!\""), + one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // ToString + one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::Pair\""), + one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"\nexpected: '// Warning: Good for gin -- Sad times no tonic'\nactual: '_pure.internal.meta.pure.functions.string.tests.toString.ClassWithComplexToString_Impl"), + // Exp one("meta::pure::functions::math::tests::exp::testNumberExp_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // Log one("meta::pure::functions::math::tests::log::testNumberLog_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // Log10 one("meta::pure::functions::math::tests::log10::testNumberLog10_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // Mod one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), + // Pow one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), + // Rem one("meta::pure::functions::math::tests::rem::testRemInEvalWithFloat_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), one("meta::pure::functions::math::tests::rem::testRemInEvalWithMixedIntegersAndFloats_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), - // Round - one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"\nexpected: 3.14D\nactual: 3.14\""), + // Sign one("meta::pure::functions::math::tests::sign::testSign_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - // ToDecimal - one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + // ArcCos one("meta::pure::functions::math::tests::trigonometry::testArcCosineEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // ArcSine one("meta::pure::functions::math::tests::trigonometry::testArcSineEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // ArcTangent2 one("meta::pure::functions::math::tests::trigonometry::testArcTangent2Eval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__V_m_ is prohibited!\""), + // ArcTangent one("meta::pure::functions::math::tests::trigonometry::testArcTangentEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // CoTangent one("meta::pure::functions::math::tests::trigonometry::testCoTangentEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // Cosine one("meta::pure::functions::math::tests::trigonometry::testCosEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // CubeRoot one("meta::pure::functions::math::tests::testCubeRootEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + + // String + one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "\"\nexpected: 3.1415900000D\nactual: 3.14159D\""), + one("meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "\"\nexpected: 0.000D\nactual: 0.0D\""), + one("meta::pure::functions::string::tests::reverse::testReverseString_Function_1__Boolean_1_", "\"meta::pure::functions::string::reverseString_String_1__String_1_ is not supported yet!\""), + one("meta::pure::functions::string::tests::trim::testLTrim_Function_1__Boolean_1_", "\"Type not found for method ltrim from String\""), + one("meta::pure::functions::string::tests::trim::testRTrim_Function_1__Boolean_1_", "\"Type not found for method rtrim from String\""), + // Sine one("meta::pure::functions::math::tests::trigonometry::testSineEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // SquareRoot one("meta::pure::functions::math::tests::testSquareRootEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + // Tangent - one("meta::pure::functions::math::tests::trigonometry::testTangentEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\"") + one("meta::pure::functions::math::tests::trigonometry::testTangentEval_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + + // IsNonPrimitive + one("meta::pure::functions::boolean::tests::testIsNonPrimitive_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::boolean::tests::equalitymodel::SideClass\""), + + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunctionExplicit_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::metamodel::function::NativeFunction\""), + + // Date + one("meta::pure::functions::date::tests::testAdjustReflectiveEvaluation_Function_1__Boolean_1_", "\"eval_Function_1__T_n__U_p__W_q__V_m_ is prohibited!\""), + one("meta::pure::functions::date::tests::testHasMonthReflect_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + one("meta::pure::functions::date::tests::testYeaReflect_Function_1__Boolean_1_", "\"eval_Function_1__T_n__V_m_ is prohibited!\""), + + // If + one("meta::pure::functions::lang::tests::if::testMultiIf_Function_1__Boolean_1_", "\"Function meta::pure::functions::lang::if_Pair_MANY__Function_1__T_m_ is not yet supported as functions with more than one expression can not be routed\""), + + // Match + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParam_Function_1__Boolean_1_", "\"meta::pure::functions::lang::match_Any_MANY__Function_$1_MANY$__P_o__T_m_ is not supported yet!\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParamsAndFunctionsAsParam_Function_1__Boolean_1_", "\"meta::pure::functions::lang::match_Any_MANY__Function_$1_MANY$__P_o__T_m_ is not supported yet!\""), + one("meta::pure::functions::lang::tests::match::testMatchWithMixedReturnType_Function_1__Boolean_1_", "\"deactivate_Any_MANY__ValueSpecification_1_ is prohibited!\""), + one("meta::pure::functions::lang::tests::match::testMatch_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") ); public static Test suite() @@ -127,4 +199,5 @@ public String getPlatform() { return platform; } + } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_GrammarFunction_PCT.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_GrammarFunction_PCT.java index edf072f736d..97a9690d8df 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_GrammarFunction_PCT.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_GrammarFunction_PCT.java @@ -52,22 +52,24 @@ public class Test_JAVA_GrammarFunction_PCT extends PCTReportConfiguration one("meta::pure::functions::collection::tests::first::testFirstComplex_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::model::CO_Firm\""), one("meta::pure::functions::collection::tests::first::testFirstOnEmptySet_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + // Let + one("meta::pure::functions::lang::tests::letFn::testAssignLiteralToVariable_Function_1__Boolean_1_", "\"Cast exception: VariableExpression cannot be cast to FunctionExpression\""), + one("meta::pure::functions::lang::tests::letFn::testAssignNewInstance_Function_1__Boolean_1_", "\"Cast exception: VariableExpression cannot be cast to FunctionExpression\""), + one("meta::pure::functions::lang::tests::letFn::testLetChainedWithAnotherFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + // Map one("meta::pure::functions::collection::tests::map::testMapInstance_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::map::model::M_Person\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToMany_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::map::model::M_Person\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToOne_Function_1__Boolean_1_", "\"Unhandled value type: meta::pure::functions::collection::tests::map::model::M_Person\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Match failure: NoSetRoutedValueSpecificationObject instanceOf NoSetRoutedValueSpecification\""), - // Divide - one("meta::pure::functions::math::tests::divide::testDecimalDivide_Function_1__Boolean_1_", "\"\nexpected: -31.42D\nactual: -31.42\""), - // Minus - one("meta::pure::functions::math::tests::minus::testDecimalMinus_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::minus::testDecimalMinus_Function_1__Boolean_1_", "\"\nexpected: -4.0D\nactual: -4.0\""), one("meta::pure::functions::math::tests::minus::testSingleMinusType_Function_1__Boolean_1_", "\"Match failure: NoSetRoutedValueSpecificationObject instanceOf NoSetRoutedValueSpecification\""), one("meta::pure::functions::math::tests::minus::testSingleMinus_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), // Plus - one("meta::pure::functions::math::tests::plus::testDecimalPlus_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::plus::testDecimalPlus_Function_1__Boolean_1_", "\"\nexpected: 6.0D\nactual: 6.0\""), one("meta::pure::functions::math::tests::plus::testLargePlus_Function_1__Boolean_1_", "\"\nexpected: -1\nactual: -9223372036854775790\""), one("meta::pure::functions::math::tests::plus::testSinglePlusType_Function_1__Boolean_1_", "\"Match failure: NoSetRoutedValueSpecificationObject instanceOf NoSetRoutedValueSpecification\""), diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_RelationFunction_PCT.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_RelationFunction_PCT.java index 1b9db543e4e..d3b8f6bdfe1 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_RelationFunction_PCT.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_RelationFunction_PCT.java @@ -68,6 +68,7 @@ public class Test_JAVA_RelationFunction_PCT extends PCTReportConfiguration // Select one("meta::pure::functions::relation::tests::select::testMultiColsSelectShared_Function_1__Boolean_1_", "\"meta::pure::functions::relation::select_Relation_1__ColSpecArray_1__Relation_1_ is not supported yet!\""), one("meta::pure::functions::relation::tests::select::testSingleColSelectShared_Function_1__Boolean_1_", "\"meta::pure::functions::relation::select_Relation_1__ColSpec_1__Relation_1_ is not supported yet!\""), + one("meta::pure::functions::relation::tests::select::testSingleSelectWithQuotedColumn_Function_1__Boolean_1_", "\"meta::pure::functions::relation::select_Relation_1__ColSpec_1__Relation_1_ is not supported yet!\""), // Size pack("meta::pure::functions::relation::tests::size", "\"meta::pure::functions::relation::size_Relation_1__Integer_1_ is not supported yet!\""), diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_StandardFunction_PCT.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_StandardFunction_PCT.java new file mode 100644 index 00000000000..c940dc75dc7 --- /dev/null +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-PCT/src/test/java/org/finos/legend/engine/pure/code/core/java/binding/Test_JAVA_StandardFunction_PCT.java @@ -0,0 +1,70 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.pure.code.core.java.binding; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.pure.code.core.CoreJavaPlatformBindingCodeRepositoryProvider; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.code.core.CoreUnclassifiedFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class Test_JAVA_StandardFunction_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = CoreJavaPlatformBindingCodeRepositoryProvider.javaAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + one("meta::pure::functions::math::tests::stdDev::testSimpleGroupByStandardDeviationPopulation_Function_1__Boolean_1_", "\"meta::pure::functions::relation::groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_ is not supported yet!\""), + one("meta::pure::functions::math::tests::stdDev::testSimpleGroupByStandardDeviationSample_Function_1__Boolean_1_", "\"meta::pure::functions::relation::groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_ is not supported yet!\""), + + one("meta::pure::functions::math::tests::variance::testSimpleGroupByVariancePopulation_Function_1__Boolean_1_", "\"meta::pure::functions::relation::groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_ is not supported yet!\""), + one("meta::pure::functions::math::tests::variance::testSimpleGroupByVarianceSample_Function_1__Boolean_1_", "\"meta::pure::functions::relation::groupBy_Relation_1__ColSpecArray_1__AggColSpecArray_1__Relation_1_ is not supported yet!\"") + ); + + public static Test suite() + { + return PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/pom.xml b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/pom.xml index 400b7b80295..473e2f4ce47 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/pom.xml +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/pom.xml @@ -165,16 +165,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-javaGeneration-pure diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/src/main/resources/core_java_platform_binding_external_format.definition.json b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/src/main/resources/core_java_platform_binding_external_format.definition.json index 26384236747..bf420f30b64 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/src/main/resources/core_java_platform_binding_external_format.definition.json +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-externalFormat-pure/src/main/resources/core_java_platform_binding_external_format.definition.json @@ -3,10 +3,9 @@ "pattern" : "(meta::pure::executionPlan::platformBinding::legendJava|meta::external::format::shared::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_dsl_graph", - "core_functions", + "core_functions_unclassified", "core", "core_external_language_java", "core_java_platform_binding" diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/pom.xml index 49ab47796b3..61a0be893e5 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/pom.xml @@ -78,6 +78,11 @@ legend-engine-xt-javaGeneration-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -126,15 +131,9 @@ legend-engine-xt-javaGeneration-pure ${project.version} - org.finos.legend.engine - legend-engine-pure-code-compiled-core - ${project.version} - - - org.finos.legend.engine - legend-engine-xt-javaGeneration-pure + legend-engine-pure-functions-standard-pure ${project.version} @@ -171,8 +170,8 @@ legend-pure-runtime-java-extension-compiled-dsl-graph - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json @@ -184,11 +183,11 @@ org.finos.legend.engine - legend-engine-pure-code-core-extension + legend-engine-pure-functions-standard-pure org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-core-extension org.finos.legend.engine @@ -196,11 +195,11 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/java/org/finos/legend/pure/code/core/CoreJavaPlatformBindingCodeRepositoryProvider.java b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/java/org/finos/legend/pure/code/core/CoreJavaPlatformBindingCodeRepositoryProvider.java index b7a33dc537c..f01ffd89c5a 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/java/org/finos/legend/pure/code/core/CoreJavaPlatformBindingCodeRepositoryProvider.java +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/java/org/finos/legend/pure/code/core/CoreJavaPlatformBindingCodeRepositoryProvider.java @@ -23,6 +23,7 @@ public class CoreJavaPlatformBindingCodeRepositoryProvider implements CodeReposi { public static final Adapter javaAdapter = new Adapter( "Java", + "Platform", "meta::pure::executionPlan::platformBinding::legendJava::pct::testAdapterForJavaBindingExecution_Function_1__X_o_" ); diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding.definition.json b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding.definition.json index e28bb4e38a5..f4145699412 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding.definition.json +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding.definition.json @@ -3,12 +3,12 @@ "pattern" : "(meta::pure::executionPlan::platformBinding::legendJava|meta::pure::mapping::modelToModel::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", "platform_dsl_store", "platform_dsl_mapping", "platform_dsl_graph", - "core_functions", + "core_functions_json", + "core_functions_unclassified", + "core_functions_standard", "core", "core_external_language_java" ] diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/bindPlanToLegendJavaPlatform.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/bindPlanToLegendJavaPlatform.pure index 469e6d91fb6..1bf7e51fe8f 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/bindPlanToLegendJavaPlatform.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/bindPlanToLegendJavaPlatform.pure @@ -65,13 +65,14 @@ function <> meta::pure::executionPlan::platformBinding::legendJa function <> meta::pure::executionPlan::platformBinding::legendJava::prepareGenerationContext(plan: ExecutionPlan[1], legendJavaConfig: LegendJavaPlatformBindingConfig[1], extensions: Extension[*], debug: DebugContext[1]): GenerationContext[1] { let conventions = engineConventions($extensions); + let pathAdjusted = if ($legendJavaConfig.planId->isEmpty(), | $conventions, | $conventions->setBasePackageName($conventions.basePackageName+'.'+$conventions->identifier('plan_'+$legendJavaConfig.planId->toOne())) ); let initialContext = ^GenerationContext(typeInfos=newTypeInfoSet(), conventions=$pathAdjusted); - + let preparedContext = $plan.rootExecutionNode->prepareForLegendJavaPlatformBinding('root', $initialContext, $extensions, $debug)->fillNewFunctionProhibitedList(); // TODO Move Interface/Enum/Unit generation to here diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/pct_java.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/pct_java.pure index c3f5b878a1d..a046d7d58db 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/pct_java.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/pct_java.pure @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +import meta::pure::executionPlan::platformBinding::legendJava::pct::*; +import meta::json::*; import meta::pure::executionPlan::platformBinding::localBinding::*; import meta::pure::executionPlan::platformBinding::*; import meta::pure::test::pct::*; @@ -30,14 +32,52 @@ function <> meta::pure::executionPlan::platformBinding::legendJava: let x = meta::legend::executePlanAsJSON($planAsJson, []); - let res = $x->meta::json::parseJSON()->meta::json::fromJSON(Any, ^meta::json::ExtendedJSONDeserializationConfig(typeKeyName='__TYPE', failOnUnknownProperties=true, nullReplacementInArray=TDSNull)); + let funcReturnType = $f->functionReturnType().rawType->toOne(); + let returnType = if ($funcReturnType->isEmpty(), |Any, |$funcReturnType); + + let res = if ($returnType != Nil && $returnType->meta::pure::functions::meta::subTypeOf(Date), + | jsonToDate($x), + |$x->meta::json::parseJSON()->meta::json::fromJSON($returnType, ^meta::json::ExtendedJSONDeserializationConfig(typeKeyName='__TYPE', failOnUnknownProperties=true, nullReplacementInArray=TDSNull)); + ); // processResult - let resultType = $f->functionReturnType().rawType; + let resultType = $f->functionReturnType().rawType; + + $res->cast(@X)->toMultiplicity(@[o]); +} - if ($resultType->toOne()->instanceOf(PrimitiveType) || $resultType == Nil, - | $res, - | fail(); - )->cast(@X)->toMultiplicity(@[o]); +function meta::pure::executionPlan::platformBinding::legendJava::pct::jsonToDate(s:String[1]):Date[1] +{ + let jsonObject = $s->meta::json::parseJSON()->cast(@meta::json::JSONObject); + let year = extractValue($jsonObject, 'year'); + let month = extractValue($jsonObject, 'month'); + let day = extractValue($jsonObject, 'day'); + let hour = extractValue($jsonObject, 'hour'); + let minute = extractValue($jsonObject, 'minute'); + let second = extractValue($jsonObject, 'second'); + let subsecond = extractValue($jsonObject, 'subsecond'); + let res = if( + [ + pair(|$month == '-1',|'%'+$year), + pair(|$day == '-1',|'%'+$year+'-'+$month), + pair(|$hour == '-1',|'%'+$year+'-'+$month+'-'+$day), + pair(|$minute == '-1',|'%'+$year+'-'+$month+'-'+$day+'T'+$hour), + pair(|$second == '-1',|'%'+$year+'-'+$month+'-'+$day+'T'+$hour+':'+$minute), + pair(|$subsecond == '',|'%'+$year+'-'+$month+'-'+$day+'T'+$hour+':'+$minute+':'+$second) + ], + |'%'+$year+'-'+$month+'-'+$day+'T'+$hour+':'+$minute+':'+$second+'.'+$subsecond + ); + parseDate($res); +} + +function meta::pure::executionPlan::platformBinding::legendJava::pct::extractValue(obj:JSONObject[1], key:String[1]):String[1] +{ + $obj.keyValuePairs->filter(k|$k.key.value == $key).value->match( + [ + n:JSONNumber[1]|$n.value->toOne()->toString(), + s:JSONString[1]|$s.value->toOne(), + x:Any[0..1]|'' + ] + ); } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/langLibrary.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/langLibrary.pure index e80719044ae..a2522219bde 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/langLibrary.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/langLibrary.pure @@ -95,7 +95,8 @@ function meta::pure::executionPlan::platformBinding::legendJava::library::lang:: assert($ctx.params->at(1)->instanceOf(InstanceValue), 'Only inline lambdas currently supported'); let x = j_parameter(javaObject(), 'x'); let m = j_parameter(javaObject(), 'm'); - let predicates = $ctx.params->at(1)->cast(@InstanceValue).values->map(v| + let predicates = $ctx.params->at(1)->cast(@InstanceValue).values->map(pv| + let v = $pv->match([f:Function[1]|$f, r:FunctionRoutedValueSpecification[1]|$r.originalFunction]); let p = $v->cast(@Function)->functionType().parameters->evaluateAndDeactivate()->toOne(); let type = $ctx.conventions->pureTypeToJavaType($p.genericType.rawType->toOne(), $p.multiplicity); let elementType = $ctx.conventions->pureTypeToJavaType($p.genericType, PureOne); @@ -127,7 +128,8 @@ function meta::pure::executionPlan::platformBinding::legendJava::library::lang:: let o = j_parameter(javaObject(), 'o'); - let adapt = $ctx.params->at(1)->cast(@InstanceValue).values->map(v| + let adapt = $ctx.params->at(1)->cast(@InstanceValue).values->map(pv| + let v = $pv->match([f:Function[1]|$f, r:FunctionRoutedValueSpecification[1]|$r.originalFunction]); let p = $v->cast(@Function)->functionType().parameters->evaluateAndDeactivate()->toOne(); let type = $ctx.conventions->pureTypeToJavaType($p.genericType.rawType->toOne(), $p.multiplicity); let elementType = $ctx.conventions->pureTypeToJavaType($p.genericType, PureOne); diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/booleanLibraryTests.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/booleanLibraryTests.pure index 96037cdbdb7..2eff8854a15 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/booleanLibraryTests.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/booleanLibraryTests.pure @@ -76,8 +76,8 @@ function <generate(GeographicEntityType) ->addTestsWithin(meta::pure::functions::collection::tests::init) diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/langLibraryTests.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/langLibraryTests.pure index a87e46f9c6a..98acd36963f 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/langLibraryTests.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/langLibraryTests.pure @@ -274,14 +274,14 @@ function <addTestsWithin(meta::pure::functions::lang::tests::compare) diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/pureDateLibraryTests.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/pureDateLibraryTests.pure index c54a1145d28..089f3e69397 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/pureDateLibraryTests.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/planConventions/test/pureDateLibraryTests.pure @@ -138,54 +138,54 @@ function <runTests(); } diff --git a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/store/m2m/m2mLegendJavaPlatformBindingExtension.pure b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/store/m2m/m2mLegendJavaPlatformBindingExtension.pure index 48aa411b37d..2b95654723a 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/store/m2m/m2mLegendJavaPlatformBindingExtension.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure/src/main/resources/core_java_platform_binding/legendJavaPlatformBinding/store/m2m/m2mLegendJavaPlatformBindingExtension.pure @@ -77,7 +77,7 @@ function meta::pure::mapping::modelToModel::executionPlan::platformBinding::lege }, s: StoreStreamReadingExecutionNode[1] | $s->generateCodeForStoreStreamReadingExecutionNode($path, $context, $extensions, $debug), n: ExecutionNode[1] | ^GeneratedCode() - ]) + ]); }, generateLegendJavaCodeForExtraChildNodes = {node: ExecutionNode[1], project: Project[0..1], path: String[1], context: GenerationContext[1], extensions: Extension[*], debug: DebugContext[1] | @@ -172,7 +172,7 @@ function meta::pure::mapping::modelToModel::executionPlan::platformBinding::lege ] // ----------------------------------------------------------- Adhoc extensions - ) + ); } diff --git a/legend-engine-xts-json/legend-engine-external-format-jsonSchema/src/main/java/org/finos/legend/engine/external/format/jsonSchema/schema/generations/JSONSchemaConfig.java b/legend-engine-xts-json/legend-engine-external-format-jsonSchema/src/main/java/org/finos/legend/engine/external/format/jsonSchema/schema/generations/JSONSchemaConfig.java index 7183dd25926..d892e577191 100644 --- a/legend-engine-xts-json/legend-engine-external-format-jsonSchema/src/main/java/org/finos/legend/engine/external/format/jsonSchema/schema/generations/JSONSchemaConfig.java +++ b/legend-engine-xts-json/legend-engine-external-format-jsonSchema/src/main/java/org/finos/legend/engine/external/format/jsonSchema/schema/generations/JSONSchemaConfig.java @@ -25,7 +25,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; public class JSONSchemaConfig extends GenerationConfiguration { diff --git a/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/pom.xml index 636a772c0e6..958d9b4bea0 100644 --- a/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/pom.xml @@ -203,16 +203,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-json-pure diff --git a/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/src/main/resources/core_external_format_json_java_platform_binding.definition.json b/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/src/main/resources/core_external_format_json_java_platform_binding.definition.json index 04db3eed82c..faea91d7722 100644 --- a/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/src/main/resources/core_external_format_json_java_platform_binding.definition.json +++ b/legend-engine-xts-json/legend-engine-xt-json-javaPlatformBinding-pure/src/main/resources/core_external_format_json_java_platform_binding.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::external::format::json::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", - "core_functions", + "core_functions_unclassified", "core", "core_external_format_json", "core_external_language_java", diff --git a/legend-engine-xts-json/legend-engine-xt-json-model/pom.xml b/legend-engine-xts-json/legend-engine-xt-json-model/pom.xml index 85f5003aafc..648ae65e683 100644 --- a/legend-engine-xts-json/legend-engine-xt-json-model/pom.xml +++ b/legend-engine-xts-json/legend-engine-xt-json-model/pom.xml @@ -71,8 +71,8 @@ legend-pure-m3-core - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json runtime diff --git a/legend-engine-xts-json/legend-engine-xt-json-pure/pom.xml b/legend-engine-xts-json/legend-engine-xt-json-pure/pom.xml index 1dc6eb23fe4..5fd535ceca8 100644 --- a/legend-engine-xts-json/legend-engine-xt-json-pure/pom.xml +++ b/legend-engine-xts-json/legend-engine-xt-json-pure/pom.xml @@ -54,9 +54,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} @@ -75,11 +75,6 @@ ${legend.pure.version} - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - org.finos.legend.engine legend-engine-pure-code-compiled-core @@ -135,7 +130,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -182,8 +177,8 @@ legend-pure-runtime-java-engine-compiled - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json @@ -195,10 +190,6 @@ org.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-language-pure-dsl-generation-pure @@ -209,7 +200,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -217,7 +208,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json diff --git a/legend-engine-xts-json/legend-engine-xt-json-pure/src/main/resources/core_external_format_json.definition.json b/legend-engine-xts-json/legend-engine-xt-json-pure/src/main/resources/core_external_format_json.definition.json index 39686a119fc..6fa479c0c00 100644 --- a/legend-engine-xts-json/legend-engine-xt-json-pure/src/main/resources/core_external_format_json.definition.json +++ b/legend-engine-xts-json/legend-engine-xt-json-pure/src/main/resources/core_external_format_json.definition.json @@ -3,12 +3,11 @@ "pattern": "(meta::external::format::json|meta::json)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", "platform_dsl_mapping", "platform_dsl_path", "platform_dsl_graph", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_generation" ] diff --git a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-api/src/main/java/org/finos/legend/engine/language/memsql/deployment/MemSqlFunctionGenerator.java b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-api/src/main/java/org/finos/legend/engine/language/memsql/deployment/MemSqlFunctionGenerator.java index 10451cb2c28..95ae621d0ec 100644 --- a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-api/src/main/java/org/finos/legend/engine/language/memsql/deployment/MemSqlFunctionGenerator.java +++ b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-api/src/main/java/org/finos/legend/engine/language/memsql/deployment/MemSqlFunctionGenerator.java @@ -48,7 +48,7 @@ public static MemSqlFunctionArtifact generateArtifact(PureModel pureModel, Root_ { //identify connection MemSqlFunction protocolActivator = org.eclipse.collections.impl.factory.Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(MemSqlFunction.class)) - .select(c -> c.getPath().equals(platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) + .select(c -> c.getPath().equals(platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) .getFirst(); connection = (RelationalDatabaseConnection) org.eclipse.collections.impl.factory.Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(PackageableConnection.class)) .select(c -> c.getPath().equals(((org.finos.legend.engine.protocol.memsqlFunction.metamodel.MemSqlFunctionDeploymentConfiguration) protocolActivator.activationConfiguration).activationConnection.connection)).getFirst().connectionValue; diff --git a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-generator/src/main/java/org/finos/legend/engine/language/memSqlFunction/generator/MemSqlFunctionGenerator.java b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-generator/src/main/java/org/finos/legend/engine/language/memSqlFunction/generator/MemSqlFunctionGenerator.java index b7add2ae45a..6bc72f848bf 100644 --- a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-generator/src/main/java/org/finos/legend/engine/language/memSqlFunction/generator/MemSqlFunctionGenerator.java +++ b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-generator/src/main/java/org/finos/legend/engine/language/memSqlFunction/generator/MemSqlFunctionGenerator.java @@ -58,7 +58,7 @@ public static MemSqlFunctionArtifact generateArtifact(PureModel pureModel, Root_ { //identify connection MemSqlFunction protocolActivator = Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(MemSqlFunction.class)) - .select(c -> c.getPath().equals(platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) + .select(c -> c.getPath().equals(platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) .getFirst(); connection = (RelationalDatabaseConnection) Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(PackageableConnection.class)) .select(c -> c.getPath().equals(((org.finos.legend.engine.protocol.memsqlFunction.metamodel.MemSqlFunctionDeploymentConfiguration)protocolActivator.activationConfiguration).activationConnection.connection)).getFirst().connectionValue; diff --git a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/pom.xml b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/pom.xml index 84f97dbac37..61a2894d342 100644 --- a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/pom.xml +++ b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/pom.xml @@ -59,7 +59,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -102,7 +102,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -151,10 +151,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-relationalStore-pure diff --git a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/src/main/resources/core_memsqlfunction.definition.json b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/src/main/resources/core_memsqlfunction.definition.json index 5647cc67b80..55453851b1f 100644 --- a/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/src/main/resources/core_memsqlfunction.definition.json +++ b/legend-engine-xts-memsqlFunction/legend-engine-xt-memsqlFunction-pure/src/main/resources/core_memsqlfunction.definition.json @@ -7,11 +7,10 @@ "platform_dsl_graph", "platform_dsl_mapping", "platform_store_relational", - "platform_functions", - "platform_functions_json", + "core_functions_json", + "core_functions_unclassified", "core_relational", "core_function_activator", - "core_functions", "core_relational", "core_analytics_lineage" ] diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/pom.xml b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/pom.xml index f0565423360..a27e550fb0d 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/pom.xml +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/pom.xml @@ -45,12 +45,12 @@ legend-pure-runtime-java-engine-interpreted - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine @@ -74,7 +74,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -280,9 +280,9 @@ ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -354,9 +354,9 @@ ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/src/main/resources/core_mongodb_execution_test.definition.json b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/src/main/resources/core_mongodb_execution_test.definition.json index a8287c64bc0..7f8e1ff9f36 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/src/main/resources/core_mongodb_execution_test.definition.json +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan-test/src/main/resources/core_mongodb_execution_test.definition.json @@ -3,8 +3,8 @@ "pattern" : "(meta::external::store::mongodb::executionTest)(::.*)?", "dependencies" : [ "platform", - "platform_functions", - "platform_functions_json", + "core_functions_unclassified", + "core_functions_json", "platform_dsl_mapping", "platform_dsl_store", "platform_dsl_graph", diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/pom.xml index 2a82ed34e78..8a467ff6785 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/pom.xml @@ -36,7 +36,7 @@ - org.finos.legend.engine:legend-engine-pure-platform-functions-java + org.finos.legend.engine:legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine:legend-engine-xt-authentication-pure @@ -231,10 +231,6 @@ org.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.pure legend-pure-runtime-java-extension-compiled-dsl-mapping @@ -247,7 +243,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/src/main/resources/core_nonrelational_mongodb_java_platform_binding.definition.json b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/src/main/resources/core_nonrelational_mongodb_java_platform_binding.definition.json index 2a573062250..eac466b3b2c 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/src/main/resources/core_nonrelational_mongodb_java_platform_binding.definition.json +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-javaPlatformBinding-pure/src/main/resources/core_nonrelational_mongodb_java_platform_binding.definition.json @@ -3,10 +3,9 @@ "pattern": "(meta::external::store::mongodb::executionPlan::platformBinding)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", "platform_dsl_mapping", - "core_functions", + "core_functions_unclassified", "core", "core_external_format_json", "core_nonrelational_mongodb", diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/pom.xml b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/pom.xml index 1c5185ecd84..109b5e70f93 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/pom.xml +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/pom.xml @@ -187,7 +187,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -207,11 +207,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.pure diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/src/main/resources/core_nonrelational_mongodb.definition.json b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/src/main/resources/core_nonrelational_mongodb.definition.json index 2f99cb04313..111aebe4da4 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/src/main/resources/core_nonrelational_mongodb.definition.json +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-pure/src/main/resources/core_nonrelational_mongodb.definition.json @@ -7,9 +7,8 @@ "platform_dsl_store", "platform_dsl_graph", "platform_dsl_path", - "platform_functions", - "platform_functions_json", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_authentication" ] diff --git a/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/pom.xml b/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/pom.xml index 28a175113ba..d43bbadab39 100644 --- a/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/pom.xml +++ b/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/pom.xml @@ -161,11 +161,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json diff --git a/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/src/main/resources/core_external_language_morphir.definition.json b/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/src/main/resources/core_external_language_morphir.definition.json index cbc1b6ae625..29db1d92fa3 100644 --- a/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/src/main/resources/core_external_language_morphir.definition.json +++ b/legend-engine-xts-morphir/legend-engine-xt-morphir-pure/src/main/resources/core_external_language_morphir.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::external::language::morphir)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", + "core_functions_json", "core", "core_generation" ] diff --git a/legend-engine-xts-morphir/legend-engine-xt-morphir/src/main/java/org/finos/legend/engine/external/language/morphir/model/MorphirGenerationConfig.java b/legend-engine-xts-morphir/legend-engine-xt-morphir/src/main/java/org/finos/legend/engine/external/language/morphir/model/MorphirGenerationConfig.java index 38f73c0c5b3..3084ebd8d9e 100644 --- a/legend-engine-xts-morphir/legend-engine-xt-morphir/src/main/java/org/finos/legend/engine/external/language/morphir/model/MorphirGenerationConfig.java +++ b/legend-engine-xts-morphir/legend-engine-xt-morphir/src/main/java/org/finos/legend/engine/external/language/morphir/model/MorphirGenerationConfig.java @@ -25,7 +25,7 @@ import java.util.Collections; import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; public class MorphirGenerationConfig extends GenerationConfiguration { diff --git a/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/pom.xml b/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/pom.xml index 48bfa18be3d..6e5c49a3dfe 100644 --- a/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/pom.xml +++ b/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/pom.xml @@ -56,9 +56,9 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -135,9 +135,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -201,9 +201,9 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json + ${project.version} @@ -251,21 +251,17 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-xt-relationalStore-pure org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine diff --git a/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/src/main/resources/core_external_format_openapi.definition.json b/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/src/main/resources/core_external_format_openapi.definition.json index 8e008402f00..ef8ae97dd2e 100644 --- a/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/src/main/resources/core_external_format_openapi.definition.json +++ b/legend-engine-xts-openapi/legend-engine-xt-openapi-pure/src/main/resources/core_external_format_openapi.definition.json @@ -3,8 +3,8 @@ "pattern": "(meta::external::function::description::openapi)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", + "core_functions_unclassified", + "core_functions_json", "platform_dsl_mapping", "platform_dsl_path", "platform_dsl_graph", diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-cloud-pure/src/main/resources/core_persistence_cloud.definition.json b/legend-engine-xts-persistence/legend-engine-xt-persistence-cloud-pure/src/main/resources/core_persistence_cloud.definition.json index b993e0f6761..689cba61d9e 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-cloud-pure/src/main/resources/core_persistence_cloud.definition.json +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-cloud-pure/src/main/resources/core_persistence_cloud.definition.json @@ -3,7 +3,7 @@ "pattern": "(meta::pure::persistence)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "platform_dsl_store", "platform_dsl_graph", "platform_store_relational", diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/pom.xml b/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/pom.xml index 3ca88c42c89..01095274253 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/pom.xml +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/pom.xml @@ -223,10 +223,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/src/main/resources/core_persistence.definition.json b/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/src/main/resources/core_persistence.definition.json index 1cd5a0626b2..9043435a1b1 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/src/main/resources/core_persistence.definition.json +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-pure/src/main/resources/core_persistence.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::pure::persistence)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_dsl_store", "platform_dsl_graph", diff --git a/legend-engine-xts-persistence/legend-engine-xt-persistence-target-relational-pure/src/main/resources/core_persistence_relational.definition.json b/legend-engine-xts-persistence/legend-engine-xt-persistence-target-relational-pure/src/main/resources/core_persistence_relational.definition.json index f9931bce8d6..9fa8357c6b8 100644 --- a/legend-engine-xts-persistence/legend-engine-xt-persistence-target-relational-pure/src/main/resources/core_persistence_relational.definition.json +++ b/legend-engine-xts-persistence/legend-engine-xt-persistence-target-relational-pure/src/main/resources/core_persistence_relational.definition.json @@ -3,7 +3,7 @@ "pattern" : "(meta::pure::persistence::relational)(::.*)?", "dependencies": [ "platform", - "platform_functions", + "core_functions_unclassified", "platform_dsl_mapping", "platform_dsl_graph", "platform_dsl_path", diff --git a/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/pom.xml b/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/pom.xml index 1ed8cf26bca..af5169574b6 100644 --- a/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/pom.xml +++ b/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/pom.xml @@ -153,10 +153,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-language-pure-dsl-generation-pure @@ -167,15 +163,15 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json diff --git a/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/src/main/resources/core_external_format_protobuf.definition.json b/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/src/main/resources/core_external_format_protobuf.definition.json index 268c44d92ea..621b05bcf05 100644 --- a/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/src/main/resources/core_external_format_protobuf.definition.json +++ b/legend-engine-xts-protobuf/legend-engine-xt-protobuf-pure/src/main/resources/core_external_format_protobuf.definition.json @@ -3,10 +3,9 @@ "pattern": "(meta::external::format::protobuf|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "platform_functions_json", "platform_dsl_diagram", - "core_functions", + "core_functions_json", + "core_functions_unclassified", "core", "core_generation" ] diff --git a/legend-engine-xts-protobuf/legend-engine-xt-protobuf/src/main/java/org/finos/legend/engine/external/format/protobuf/deprecated/generation/configuration/ProtobufGenerationConfig.java b/legend-engine-xts-protobuf/legend-engine-xt-protobuf/src/main/java/org/finos/legend/engine/external/format/protobuf/deprecated/generation/configuration/ProtobufGenerationConfig.java index 4f491d51151..4ec19e78bf8 100644 --- a/legend-engine-xts-protobuf/legend-engine-xt-protobuf/src/main/java/org/finos/legend/engine/external/format/protobuf/deprecated/generation/configuration/ProtobufGenerationConfig.java +++ b/legend-engine-xts-protobuf/legend-engine-xt-protobuf/src/main/java/org/finos/legend/engine/external/format/protobuf/deprecated/generation/configuration/ProtobufGenerationConfig.java @@ -25,7 +25,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; @Deprecated public class ProtobufGenerationConfig extends GenerationConfiguration diff --git a/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/pom.xml b/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/pom.xml index 682818aa430..933b3f43ca8 100644 --- a/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/pom.xml +++ b/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/pom.xml @@ -135,16 +135,12 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-java diff --git a/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/src/main/resources/core_protocol_generation.definition.json b/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/src/main/resources/core_protocol_generation.definition.json index 7a18d8cd6bf..8ad08206451 100644 --- a/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/src/main/resources/core_protocol_generation.definition.json +++ b/legend-engine-xts-protocol-java-generation/legend-engine-protocol-generation-pure/src/main/resources/core_protocol_generation.definition.json @@ -3,10 +3,9 @@ "pattern": "(meta::protocols::generation::java)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", - "core_functions", + "core_functions_unclassified", "core", "core_external_language_java" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/java/org/finos/legend/engine/pure/runtime/testConnection/CoreExternalTestConnectionCodeRepositoryProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/java/org/finos/legend/engine/pure/runtime/testConnection/CoreExternalTestConnectionCodeRepositoryProvider.java index 9df8c9c6d6c..ce2e093646c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/java/org/finos/legend/engine/pure/runtime/testConnection/CoreExternalTestConnectionCodeRepositoryProvider.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/java/org/finos/legend/engine/pure/runtime/testConnection/CoreExternalTestConnectionCodeRepositoryProvider.java @@ -23,18 +23,22 @@ public class CoreExternalTestConnectionCodeRepositoryProvider implements CodeRep { public static final Adapter H2Adapter = new Adapter( "H2", + "Store_Relational", "meta::relational::tests::pct::testAdapterForRelationalWithH2Execution_Function_1__X_o_" ); public static final Adapter duckDBAdapter = new Adapter( "DuckDB", + "Store_Relational", "meta::relational::tests::pct::testAdapterForRelationalWithDuckDBExecution_Function_1__X_o_" ); public static final Adapter snowflakeAdapter = new Adapter( "Snowflake", + "Store_Relational", "meta::relational::tests::pct::testAdapterForRelationalWithSnowflakeExecution_Function_1__X_o_" ); public static final Adapter postgresAdapter = new Adapter( "Postgres", + "Store_Relational", "meta::relational::tests::pct::testAdapterForRelationalWithPostgresExecution_Function_1__X_o_" ); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection.definition.json index a4d992003ea..0847421c04e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection.definition.json @@ -3,15 +3,14 @@ "pattern": "(meta::pure::testConnection|meta::relational::relation|meta::relational::tests::pct)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_dsl_store", "platform_dsl_tds", "platform_store_relational", - "platform_functions_relation", - "platform_functions_json", + "core_functions_relation", + "core_functions_json", "core", - "core_functions", + "core_functions_unclassified", "core_relational" ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection/pct_relational.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection/pct_relational.pure index 8c80a2000b5..53f15597782 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection/pct_relational.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-functions-relationalStore-PCT-pure/src/main/resources/core_external_test_connection/pct_relational.pure @@ -86,7 +86,11 @@ function meta::relational::tests::pct::testAdapterForRelationalExecution(f: let resultType = $f->functionReturnType().rawType; if ($resultType->toOne()->instanceOf(PrimitiveType), - | let resultFinal = $res.result.rows->at(0).values->at(0); + | let preResultFinal = $res.result.rows->at(0).values->at(0); + let resultFinal = if ($resultType->toOne()->subTypeOf(Date), + | buildDate($preResultFinal->toString()), + | $preResultFinal->toOne() + ); print(if($debug.debug,|'\nResult Final:\n'+$resultFinal->makeString(','),|'')); $resultFinal;, | let tdsString = $res.result.columns->joinStrings(',') + '\n' + @@ -109,6 +113,40 @@ function meta::relational::tests::pct::testAdapterForRelationalExecution(f: )->cast(@X)->toMultiplicity(@[o]); } +function meta::relational::tests::pct::process::buildDate(dateStr:String[1]):Date[1] +{ + // Need to find a better way... + + // Manage SubSecond + let _dot = if ($dateStr->contains('.'), + | let subPart = $dateStr->substring($dateStr->indexOf('.') + 1, $dateStr->lastIndexOf('+')); + let x = '.'+$subPart; + if ($subPart == '000000000', + | $dateStr->substring(0, $dateStr->indexOf('.')) + '' + $dateStr->substring($dateStr->lastIndexOf('+')), + | $dateStr->substring(0, $dateStr->indexOf('.')) + $x->parseFloat()->toString()->substring(1) + $dateStr->substring($dateStr->lastIndexOf('+')) + );, + | $dateStr + ); + + // Remove + + let _plus = if ($_dot->startsWith('+'), + |$_dot->substring(1), + |$_dot + ); + + // StrictDate + let _strict = if ($_plus->contains('T'), + |let time = $_plus->substring($_plus->indexOf('T') + 1, $_plus->lastIndexOf('+')); + if ($time == '00:00:00', + | $_plus->substring(0, $_plus->indexOf('T')), + | $_plus + );, + |$_plus + ); + + meta::pure::functions::string::parseDate($_strict); +} + function meta::relational::tests::pct::process::reprocess(f:Function<{->Any[*]}>[1], dbc:meta::external::store::relational::runtime::DatabaseConnection[1], debug: DebugContext[1]):PairAny[*]}>,ProcessingState>[1] { $f->match( diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-PCT/pom.xml index e0218653b4d..453d007b921 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-PCT/pom.xml @@ -114,21 +114,21 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-relation + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation @@ -194,8 +194,8 @@ legend-pure-m2-dsl-tds-pure - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json org.finos.legend.pure @@ -215,10 +215,6 @@ org.finos.legend.engine legend-engine-protocol-pure - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-code-compiled-core diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-PCT/pom.xml index 6ff18b0a830..f83cccd1c94 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-PCT/pom.xml @@ -83,8 +83,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/pom.xml index 25676e1209a..d2638233cef 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/pom.xml @@ -251,8 +251,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/src/main/resources/core_relational_mutation_execution_test.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/src/main/resources/core_relational_mutation_execution_test.definition.json index e52388715ee..bba531ecd32 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/src/main/resources/core_relational_mutation_execution_test.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-PCT/legend-engine-xt-relationalStore-test-deprecated/legend-engine-xt-relationalStore-test-mutation/src/main/resources/core_relational_mutation_execution_test.definition.json @@ -6,11 +6,11 @@ "core", "core_relational", "core_external_compiler", - "platform_functions", + "core_functions_unclassified", "platform_dsl_mapping", "platform_dsl_graph", "platform_dsl_path", - "platform_functions_json", + "core_functions_json", "platform_store_relational", "core_java_platform_binding", "core_java_platform_binding_external_format", diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/pom.xml index 41328b0d57b..501740aed67 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/pom.xml @@ -57,9 +57,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -200,7 +200,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -214,10 +214,6 @@ org.finos.legend.engine legend-engine-pure-platform-store-relational-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-dsl-store-java diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/src/main/resources/core_relational_store_entitlement.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/src/main/resources/core_relational_store_entitlement.definition.json index 1c419ddec4a..8aff8ed24e5 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/src/main/resources/core_relational_store_entitlement.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-analytics/legend-engine-xt-relationalStore-store-entitlement-pure/src/main/resources/core_relational_store_entitlement.definition.json @@ -6,8 +6,7 @@ "platform_dsl_mapping", "platform_dsl_store", "platform_store_relational", - "platform_functions", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-grammar/pom.xml index 1be6d57024c..fe375adab4e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-grammar/pom.xml @@ -158,8 +158,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/pom.xml index 04fbdea68ff..f60bc9e868d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/pom.xml @@ -154,10 +154,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java @@ -168,7 +164,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.pure @@ -196,8 +192,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/src/main/resources/core_relational_athena.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/src/main/resources/core_relational_athena.definition.json index e78ea742726..17bce673452 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/src/main/resources/core_relational_athena.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-athena/legend-engine-xt-relationalStore-athena-pure/src/main/resources/core_relational_athena.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::relational::functions::sqlQueryToString::athena|meta::relational::tests::sqlQueryToString::athena|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure|meta::relational::tests::connEquality)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-grammar/pom.xml index 2588916ea53..b74df904443 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-grammar/pom.xml @@ -158,8 +158,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/pom.xml index 7d9b3904cb9..ba0e79800e4 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/pom.xml @@ -55,9 +55,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -94,6 +94,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -152,6 +157,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -182,11 +192,11 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-core + legend-engine-pure-functions-standard-pure org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-code-compiled-core org.finos.legend.engine @@ -198,7 +208,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -226,8 +236,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery.definition.json index df9dfacb9ba..45a7384aacb 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery.definition.json @@ -3,10 +3,10 @@ "pattern": "(meta::relational::functions::sqlQueryToString::bigQuery|meta::relational::tests::sqlQueryToString::bigQuery|meta::relational::bigQuery::tests|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure|meta::relational::tests::connEquality)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_store_relational", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-grammar/pom.xml index 3bd7e429ab6..862746c58a9 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-grammar/pom.xml @@ -156,8 +156,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/pom.xml index fde3aa656d5..25579762832 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -92,6 +92,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -150,6 +155,12 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + @@ -181,10 +192,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-store-java @@ -195,12 +202,16 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-xt-relationalStore-pure + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.eclipse.collections @@ -213,8 +224,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks.definition.json index 10540393865..f09fb305330 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks.definition.json @@ -3,10 +3,10 @@ "pattern": "(meta::relational::functions::sqlQueryToString::databricks|meta::relational::tests::sqlQueryToString::databricks|meta::relational::tests::connEquality|meta::relational::databricks::tests|meta::relational::tests::functions::sqlstring::databricks|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/pom.xml index f7f5f548fba..2d14652ff5c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/pom.xml @@ -47,8 +47,8 @@ Compiled ${project.build.directory}/classes/pct-reports/ - org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_BaseFunctions_PCT - org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_BasicFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_StandardFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_EssentialFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_GrammarFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct.Test_Relational_DuckDB_RelationFunctions_PCT @@ -68,11 +68,6 @@ legend-engine-pure-platform-java ${project.version} - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - ${project.version} - org.finos.legend.engine legend-engine-pure-platform-dsl-tds-java @@ -80,7 +75,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation ${project.version} @@ -107,6 +102,10 @@ org.finos.legend.engine legend-engine-xt-relationalStore-duckdb-protocol + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.finos.legend.engine @@ -123,12 +122,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - - - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure @@ -188,7 +183,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation test @@ -231,10 +226,6 @@ legend-engine-xt-relationalStore-executionPlan test - - com.fasterxml.jackson.core - jackson-databind - diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/integration/Core_Relational_DuckDB_PCTReportProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/integration/Core_Relational_DuckDB_PCTReportProvider.java index 4e0247b2432..209a9c5108e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/integration/Core_Relational_DuckDB_PCTReportProvider.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/integration/Core_Relational_DuckDB_PCTReportProvider.java @@ -20,6 +20,7 @@ import org.finos.legend.pure.m3.pct.functions.model.Functions; import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; public class Core_Relational_DuckDB_PCTReportProvider implements PCTReportProvider { @@ -32,30 +33,11 @@ public MutableList getFunctions() @Override public MutableList getAdapterReports() { - try - { - return Lists.mutable.with( - JsonMapper.builder().build().readValue( - Core_Relational_DuckDB_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_base_compiled_DuckDB.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_DuckDB_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_basic_compiled_DuckDB.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_DuckDB_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_grammar_compiled_DuckDB.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_DuckDB_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_relation_compiled_DuckDB.json"), - AdapterReport.class - ) - ); - } - catch (Exception e) - { - throw new RuntimeException(e); - } + return PCTReportProviderTool.load(Core_Relational_DuckDB_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_DuckDB.json", + "pct-reports/ADAPTER_essential_compiled_DuckDB.json", + "pct-reports/ADAPTER_grammar_compiled_DuckDB.json", + "pct-reports/ADAPTER_relation_compiled_DuckDB.json" + ); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/TestPCRReport.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/TestPCRReport.java index 34fa6bb78b9..20b75634c7c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/TestPCRReport.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/TestPCRReport.java @@ -24,6 +24,6 @@ public class TestPCRReport public void canFindPCTReport() { Assert.assertEquals("DuckDB, Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); - Assert.assertEquals(8, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals(9, PCTReportProviderLoader.gatherReports().size()); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BaseFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BaseFunctions_PCT.java deleted file mode 100644 index ebcb7821e5c..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BaseFunctions_PCT.java +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.code.core.CoreRelationalduckdbCodeRepositoryProvider; -import org.finos.legend.pure.code.core.FunctionsCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_DuckDB_BaseFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = FunctionsCodeRepositoryProvider.baseFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.duckDBAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Contains - one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - // Drop - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Exists - one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - - // Find - one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - // ForAll - one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Indexof - one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"[unsupported-api] The function 'indexOf' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Last - one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Reverse - one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Slice - one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), - - // Take - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Zip - one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - // Ceiling - one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::ceiling::testNegativeIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::ceiling::testPositiveIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - // Floor - one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::floor::testNegativeIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::floor::testPositiveIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - // Mod - one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), - - // Pow - one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), - - // Rem - one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14000000000000012\""), - - // Round - one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatWithZeroDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testNegativeIntegerRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveFloatWithZeroDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::round::testPositiveIntegerRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), - - // StD Dev - one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // toDecimal - one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), - - // toFloat - one("meta::pure::functions::math::tests::toFloat::testDecimalToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::toFloat::testDoubleToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::math::tests::toFloat::testIntToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\"") - - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.DuckDB).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BasicFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BasicFunctions_PCT.java deleted file mode 100644 index 225d654ae9a..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_BasicFunctions_PCT.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.code.core.CoreRelationalduckdbCodeRepositoryProvider; -import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_DuckDB_BasicFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = PlatformCodeRepositoryProvider.basicFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.duckDBAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Add - one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Concatenate - one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Fold - one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Init - one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Sort - one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Tail - one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Format - one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // JoinStrings - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"The database type 'DuckDB' is not supported yet!\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - - // Split - one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // SubString - one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"[unsupported-api] The function 'substring' (state: [Select, false]) is not supported yet\""), - one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"[unsupported-api] The function 'substring' (state: [Select, false]) is not supported yet\""), - - // ToString - one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), - one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), - one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPersonToString_Function_1__Boolean_1_", "\"Assert failed\""), - one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\"") - - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.DuckDB).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_EssentialFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_EssentialFunctions_PCT.java new file mode 100644 index 00000000000..02480692b5b --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_EssentialFunctions_PCT.java @@ -0,0 +1,384 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_DuckDB_EssentialFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = PlatformCodeRepositoryProvider.essentialFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.duckDBAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // Add + one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Concatenate + one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Contains + one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Drop + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Exists + one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + + // Find + one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Fold + one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // ForAll + one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Indexof + one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"[unsupported-api] The function 'indexOf' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Init + one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Last + one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Reverse + one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Slice + one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), + + // Sort + one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Tail + one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Take + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Zip + one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + + // Format + one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // JoinStrings + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"The database type 'DuckDB' is not supported yet!\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + + // Split + one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // SubString + one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"[unsupported-api] The function 'substring' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"[unsupported-api] The function 'substring' (state: [Select, false]) is not supported yet\""), + + // ToString + one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), + one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPersonToString_Function_1__Boolean_1_", "\"Assert failed\""), + one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\""), + + // Ceiling + one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::ceiling::testNegativeIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::ceiling::testPositiveIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + // Floor + one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::floor::testNegativeIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::floor::testPositiveIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + // Mod + one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), + + // Pow + one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), + + // Rem + one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14000000000000012\""), + + // Round + one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatWithZeroDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testNegativeIntegerRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundUp_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatWithZeroDecimalRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::round::testPositiveIntegerRound_Function_1__Boolean_1_", "\"[unsupported-api] The function 'round' (state: [Select, false]) is not supported yet\""), + + // toDecimal + one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toDecimal' (state: [Select, false]) is not supported yet\""), + + // toFloat + one("meta::pure::functions::math::tests::toFloat::testDecimalToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::toFloat::testDoubleToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::math::tests::toFloat::testIntToFloat_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toFloat' (state: [Select, false]) is not supported yet\""), + + // Is + one("meta::pure::functions::boolean::tests::testIsEnum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::boolean::tests::testIsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::boolean::tests::testIsPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // At + one("meta::pure::functions::collection::tests::at::testAtOtherScenario_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> map(x:String[1] | [$x, 'z'] -> plus();) -> at(0)\""), + one("meta::pure::functions::collection::tests::at::testAtWithVariable_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(1)\""), + one("meta::pure::functions::collection::tests::at::testAt_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(0)\""), + + // RemoveDuplicates + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyListExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveNonStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunctionExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicatesBy::testRemoveDuplicatesByPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + //Date + one("meta::pure::functions::date::tests::testAdjustByDaysBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByHoursBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByMicrosecondsBigNumber_Function_1__Boolean_1_", "\"\nexpected: %2021-06-21T09:37:37.4990000+0000\nactual: %2021-06-21T09:37:37.499+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMinutesBigNumber_Function_1__Boolean_1_", "\"\nexpected: %-21457-01-08T20:48:00+0000\nactual: %21458-01-08T20:48:00+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMonthsBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustReflectiveEvaluation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'eval_Function_1__T_n__U_p__W_q__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__StrictDate_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSubSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromYear_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasDay_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasHour_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMinute_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonthReflect_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecondWithAtLeastPrecision_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecondWithAtLeastPrecision_Date_1__Integer_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testAdjustByMonths_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testAdjustByWeeksBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDateDiffWeeks_Function_1__Boolean_1_", "\"\nexpected: 1\nactual: 0\""), + one("meta::pure::functions::date::tests::testDateDiffYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearMonthOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testHour_Function_1__Boolean_1_", "\"\nexpected: 17\nactual: 0\""), + one("meta::pure::functions::date::tests::testMinute_Function_1__Boolean_1_", "\"\nexpected: 9\nactual: 0\""), + one("meta::pure::functions::date::tests::testMonthNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testYear_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + + // MultiIf + one("meta::pure::functions::lang::tests::if::testMultiIf_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Match + one("meta::pure::functions::lang::tests::match::testMatchManyWithMany_Function_1__Boolean_1_", "\"Match only supports operands with multiplicity [1]..! Current operand : ['w', 'w', 'w']\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithZeroOne_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWith_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParamsAndFunctionsAsParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParamManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParam_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctions_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithMixedReturnType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithZero_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatch_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // Abs + one("meta::pure::functions::math::tests::abs::testDecimalAbs_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'abs_Decimal_1__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::string::tests::indexOf::testFromIndex_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_String_1__String_1__Integer_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::indexOf::testSimple_Function_1__Boolean_1_", "\"[unsupported-api] The function 'indexOf' (state: [Select, false]) is not supported yet\""), + + // ParseBoolean + one("meta::pure::functions::string::tests::parseBoolean::testParseFalse_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseBoolean::testParseTrue_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + + // ParseDate + one("meta::pure::functions::string::tests::parseDate::testParseDateTypes_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toTimestamp' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithTimezone_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toTimestamp' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithZ_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toTimestamp' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseDate::testParseDate_Function_1__Boolean_1_", "\"[unsupported-api] The function 'toTimestamp' (state: [Select, false]) is not supported yet\""), + + // ParseDecimal + one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // ParseInteger + one("meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // ReverseString + one("meta::pure::functions::string::tests::reverse::testReverseString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.DuckDB).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_GrammarFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_GrammarFunctions_PCT.java index c79c9a5d200..2a7da4cc30f 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_GrammarFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_GrammarFunctions_PCT.java @@ -73,7 +73,7 @@ public class Test_Relational_DuckDB_GrammarFunctions_PCT extends PCTReportConfig one("meta::pure::functions::collection::tests::map::testMapInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToOne_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/base/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), + one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/iteration/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), // Range one("meta::pure::functions::collection::tests::range::testRangeWithStep_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'range_Integer_1__Integer_1__Integer_1__Integer_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), @@ -111,8 +111,15 @@ public class Test_Relational_DuckDB_GrammarFunctions_PCT extends PCTReportConfig // Plus (String) one("meta::pure::functions::string::tests::plus::testMultiPlusWithPropertyExpressions_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::string::tests::plus::testPlusInCollect_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), - one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\"") - + one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), + + // Let + one("meta::pure::functions::lang::tests::letFn::testAssignLiteralToVariable_Function_1__Boolean_1_", "\"Cannot cast a collection of size 2 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testAssignNewInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetAsLastStatement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetChainedWithAnotherFunction_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetInsideIf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetWithParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"") ); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_StandardFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_StandardFunctions_PCT.java new file mode 100644 index 00000000000..bd26ffd35bb --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/duckdb/pct/Test_Relational_DuckDB_StandardFunctions_PCT.java @@ -0,0 +1,74 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.duckdb.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_DuckDB_StandardFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.duckDBAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.DuckDB).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-grammar/pom.xml index 76ae175ac32..e50cdc8078e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-grammar/pom.xml @@ -158,8 +158,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/pom.xml index 45d84027519..857aa98a0a6 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/pom.xml @@ -159,11 +159,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions - - - org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -196,8 +192,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb.definition.json index d0785828946..8d3a0a4536d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb.definition.json @@ -3,10 +3,9 @@ "pattern": "(meta::relational::functions::sqlQueryToString::duckDB|meta::relational::tests::sqlQueryToString::duckDB|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure|meta::relational::tests::connEquality)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", "core", - "core_functions", + "core_functions_unclassified", "core_relational" ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure index 3af137b73a4..b95fc36ed2d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure @@ -21,6 +21,7 @@ function <> meta::relational::functions::sqlQueryToString::duckD let literalProcessor = {type:Type[1]| $literalProcessors->get(if($type->instanceOf(Enumeration), | Enum, | $type))->toOne()}; let dynaFuncDispatch = getDynaFunctionToSqlDefault($literalProcessor)->groupBy(d| $d.funcName)->putAll( getDynaFunctionToSqlForDuckDB()->groupBy(d| $d.funcName))->getDynaFunctionDispatcher(); + ^DbExtension( isBooleanLiteralSupported = true, isDbReservedIdentifier = {str:String[1]| $str->toLower()->in($reservedWords); }, // check case insensitive @@ -148,7 +149,10 @@ function <> meta::relational::functions::sqlQueryToString::duckD dynaFnToSql('weekOfYear', $allStates, ^ToSql(format='week(%s)')), dynaFnToSql('year', $allStates, ^ToSql(format='year(%s)')), dynaFnToSql('jaroWinklerSimilarity', $allStates, ^ToSql(format='jaro_winkler_similarity(%s, %s)')), - dynaFnToSql('levenshteinDistance', $allStates, ^ToSql(format='levenshtein(%s, %s)')) + dynaFnToSql('levenshteinDistance', $allStates, ^ToSql(format='levenshtein(%s, %s)')), + dynaFnToSql('varianceSample', $allStates, ^ToSql(format='%s', transform={p:String[*] | if($p->size() == 1,|'var_samp('+$p->toOne()+')',|'list_var_samp('+$p->joinStrings('[',',',']')+')'); })), + dynaFnToSql('variancePopulation', $allStates, ^ToSql(format='%s', transform={p:String[*] | if($p->size() == 1,|'var_pop('+$p->toOne()+')',|'list_var_pop('+$p->joinStrings('[',',',']')+')'); })), + dynaFnToSql('variance', $allStates, ^ToSql(format='%s', transform={p:String[*]| if ($p->last() == 'true', | 'list_var_samp', |'list_var_pop') + '('+$p->init()->joinStrings('[', ',', ']')+')'})) ]; } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/pom.xml index 3ea9361aa2d..fcfe6c17f74 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/pom.xml @@ -47,8 +47,8 @@ Compiled ${project.build.directory}/classes/pct-reports/ - org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_BaseFunctions_PCT - org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_BasicFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_StandardFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_EssentialFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_GrammarFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct.Test_Relational_H2_RelationFunctions_PCT @@ -70,7 +70,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-functions-standard-pure ${project.version} @@ -80,7 +80,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation ${project.version} @@ -103,12 +103,12 @@ eclipse-collections-api - org.finos.legend.pure - legend-pure-m2-functions-base-pure + org.finos.legend.engine + legend-engine-pure-functions-standard-pure - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure @@ -134,11 +134,6 @@ h2 - - com.fasterxml.jackson.core - jackson-databind - - org.finos.legend.engine @@ -185,7 +180,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/integration/Core_Relational_H2_PCTReportProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/integration/Core_Relational_H2_PCTReportProvider.java index 530b9c99353..85030a0e7c9 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/integration/Core_Relational_H2_PCTReportProvider.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/integration/Core_Relational_H2_PCTReportProvider.java @@ -20,6 +20,7 @@ import org.finos.legend.pure.m3.pct.functions.model.Functions; import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; public class Core_Relational_H2_PCTReportProvider implements PCTReportProvider { @@ -32,30 +33,11 @@ public MutableList getFunctions() @Override public MutableList getAdapterReports() { - try - { - return Lists.mutable.with( - JsonMapper.builder().build().readValue( - Core_Relational_H2_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_base_compiled_H2.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_H2_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_basic_compiled_H2.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_H2_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_grammar_compiled_H2.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_H2_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_relation_compiled_H2.json"), - AdapterReport.class - ) - ); - } - catch (Exception e) - { - throw new RuntimeException(e); - } + return PCTReportProviderTool.load(Core_Relational_H2_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_H2.json", + "pct-reports/ADAPTER_essential_compiled_H2.json", + "pct-reports/ADAPTER_grammar_compiled_H2.json", + "pct-reports/ADAPTER_relation_compiled_H2.json" + ); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/TestPCRReport.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/TestPCRReport.java index 33d7e221274..69aaa697700 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/TestPCRReport.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/TestPCRReport.java @@ -24,6 +24,6 @@ public class TestPCRReport public void canFindPCTReport() { Assert.assertEquals("H2, Native", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); - Assert.assertEquals(8, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals(9, PCTReportProviderLoader.gatherReports().size()); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BaseFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BaseFunctions_PCT.java deleted file mode 100644 index 9a8c40ba136..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BaseFunctions_PCT.java +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.code.core.FunctionsCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.*; - -public class Test_Relational_H2_BaseFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = FunctionsCodeRepositoryProvider.baseFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.H2Adapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Contains - one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - - one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), - one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - // Ceiling - one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::ceiling::testNegativeFloatCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::ceiling::testNegativeFloatWithZeroDecimalCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::ceiling::testPositiveFloatCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::ceiling::testPositiveFloatWithZeroDecimalCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - // Floor - one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::floor::testNegativeFloatFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::floor::testNegativeFloatWithZeroDecimalFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::floor::testPositiveFloatFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::floor::testPositiveFloatWithZeroDecimalFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - // Mod - one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), - - // Pow - one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), - - // Rem - one("meta::pure::functions::math::tests::rem::testRemInEvalWithFloat_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), - one("meta::pure::functions::math::tests::rem::testRemInEvalWithMixedIntegersAndFloats_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), - one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), - one("meta::pure::functions::math::tests::rem::testRemWithMixedIntegersAndFloats_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), - - // Round - one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testNegativeFloatWithZeroDecimalRound_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatWithZeroDecimalRound_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - // StdDev - one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // ToDecimal - one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::testCubeRootEval_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::math::tests::testCubeRoot_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") - - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.H2).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BasicFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BasicFunctions_PCT.java deleted file mode 100644 index a316c5554d1..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_BasicFunctions_PCT.java +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_H2_BasicFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = PlatformCodeRepositoryProvider.basicFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.H2Adapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Add - one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Concatenate - one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Fold - one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Init - one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Sort - one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Tail - one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Split - one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Substring - one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\""), - one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), - - // JoinStrings - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"\nexpected: '[a]'\nactual: '['\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - - //Format - one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - - // toString - one("meta::pure::functions::string::tests::toString::testBooleanToString_Function_1__Boolean_1_", "\"\nexpected: 'true'\nactual: 'TRUE'\""), - one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), - one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), - one("meta::pure::functions::string::tests::toString::testFloatToStringWithNegativeExponent_Function_1__Boolean_1_", "\"\nexpected: '0.000000013421'\nactual: '1.3421E-8'\""), - one("meta::pure::functions::string::tests::toString::testFloatToStringWithPositiveExponent_Function_1__Boolean_1_", "\"\nexpected: '134210000.0'\nactual: '1.3421E8'\""), - one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\"") - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.H2).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_EssentialFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_EssentialFunctions_PCT.java new file mode 100644 index 00000000000..2bf99c7ccd8 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_EssentialFunctions_PCT.java @@ -0,0 +1,389 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_H2_EssentialFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = PlatformCodeRepositoryProvider.essentialFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.H2Adapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // Add + one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Concatenate + one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Contains + one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Drop + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Exists + one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + + // Find + one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Fold + one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // ForAll + one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), + one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Init + one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Last + one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Reverse + one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Slice + one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), + + // Sort + one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Tail + one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Take + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Zip + one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + + + // Split + one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Substring + one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\""), + one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), + + // JoinStrings + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"\nexpected: '[a]'\nactual: '['\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + + //Format + one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + + // toString + one("meta::pure::functions::string::tests::toString::testBooleanToString_Function_1__Boolean_1_", "\"\nexpected: 'true'\nactual: 'TRUE'\""), + one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), + one("meta::pure::functions::string::tests::toString::testFloatToStringWithNegativeExponent_Function_1__Boolean_1_", "\"\nexpected: '0.000000013421'\nactual: '1.3421E-8'\""), + one("meta::pure::functions::string::tests::toString::testFloatToStringWithPositiveExponent_Function_1__Boolean_1_", "\"\nexpected: '134210000.0'\nactual: '1.3421E8'\""), + one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\""), + + + // Ceiling + one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::ceiling::testNegativeFloatCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::ceiling::testNegativeFloatWithZeroDecimalCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::ceiling::testPositiveFloatCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::ceiling::testPositiveFloatWithZeroDecimalCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + // Floor + one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::floor::testNegativeFloatFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::floor::testNegativeFloatWithZeroDecimalFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::floor::testPositiveFloatFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::floor::testPositiveFloatWithZeroDecimalFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + // Mod + one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), + + // Pow + one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), + + // Rem + one("meta::pure::functions::math::tests::rem::testRemInEvalWithFloat_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), + one("meta::pure::functions::math::tests::rem::testRemInEvalWithMixedIntegersAndFloats_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), + one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), + one("meta::pure::functions::math::tests::rem::testRemWithMixedIntegersAndFloats_Function_1__Boolean_1_", "\"\nexpected: 2.5\nactual: 3\""), + + // Round + one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testNegativeFloatWithZeroDecimalRound_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundUp_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatWithZeroDecimalRound_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + // ToDecimal + one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // CubeRoot + one("meta::pure::functions::math::tests::testCubeRootEval_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::testCubeRoot_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Is + one("meta::pure::functions::boolean::tests::testIsEnum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::boolean::tests::testIsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::boolean::tests::testIsPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // At + one("meta::pure::functions::collection::tests::at::testAtOtherScenario_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> map(x:String[1] | [$x, 'z'] -> plus();) -> at(0)\""), + one("meta::pure::functions::collection::tests::at::testAtWithVariable_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(1)\""), + one("meta::pure::functions::collection::tests::at::testAt_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(0)\""), + + // RemoveDuplicates + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyListExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveNonStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunctionExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicatesBy::testRemoveDuplicatesByPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + //Date + one("meta::pure::functions::date::tests::testAdjustByDaysBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByHoursBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByMicrosecondsBigNumber_Function_1__Boolean_1_", "\"\nexpected: %2021-06-21T09:37:37.4990000+0000\nactual: %2021-06-21T09:37:37.499+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMinutesBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::date::tests::testAdjustByMonthsBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustBySecondsBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustReflectiveEvaluation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'eval_Function_1__T_n__U_p__W_q__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__StrictDate_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSubSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromYear_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasDay_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasHour_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMinute_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonthReflect_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecondWithAtLeastPrecision_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecondWithAtLeastPrecision_Date_1__Integer_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testAdjustByMonths_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testAdjustByWeeksBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDateDiffWeeks_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: -1\""), + one("meta::pure::functions::date::tests::testDateDiffYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearMonthOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testHour_Function_1__Boolean_1_", "\"\nexpected: 17\nactual: 0\""), + one("meta::pure::functions::date::tests::testMinute_Function_1__Boolean_1_", "\"\nexpected: 9\nactual: 0\""), + one("meta::pure::functions::date::tests::testMonthNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testYear_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + + // MultiIf + one("meta::pure::functions::lang::tests::if::testMultiIf_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Match + one("meta::pure::functions::lang::tests::match::testMatchManyWithMany_Function_1__Boolean_1_", "\"Match only supports operands with multiplicity [1]..! Current operand : ['w', 'w', 'w']\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithZeroOne_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWith_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParamsAndFunctionsAsParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParamManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParam_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctions_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithMixedReturnType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithZero_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatch_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // Abs + one("meta::pure::functions::math::tests::abs::testDecimalAbs_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'abs_Decimal_1__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::string::tests::indexOf::testFromIndex_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_String_1__String_1__Integer_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::indexOf::testSimple_Function_1__Boolean_1_", "\"\nexpected: 4\nactual: 5\""), + + // ParseBoolean + one("meta::pure::functions::string::tests::parseBoolean::testParseFalse_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseBoolean::testParseTrue_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + + // ParseDate + one("meta::pure::functions::string::tests::parseDate::testParseDateTypes_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithTimezone_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithZ_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDate_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // ParseDecimal + one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // ParseInteger + one("meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.H2).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_GrammarFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_GrammarFunctions_PCT.java index 0b0ed0e8076..bb66ca36d3e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_GrammarFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_GrammarFunctions_PCT.java @@ -78,7 +78,7 @@ public class Test_Relational_H2_GrammarFunctions_PCT extends PCTReportConfigurat one("meta::pure::functions::collection::tests::map::testMapInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToOne_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/base/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), + one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/iteration/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), // Range one("meta::pure::functions::collection::tests::range::testRangeWithStep_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'range_Integer_1__Integer_1__Integer_1__Integer_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), @@ -116,7 +116,15 @@ public class Test_Relational_H2_GrammarFunctions_PCT extends PCTReportConfigurat // Plus (String) one("meta::pure::functions::string::tests::plus::testMultiPlusWithPropertyExpressions_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::string::tests::plus::testPlusInCollect_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), - one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\"") + one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), + + // Let + one("meta::pure::functions::lang::tests::letFn::testAssignLiteralToVariable_Function_1__Boolean_1_", "\"Cannot cast a collection of size 2 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testAssignNewInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetAsLastStatement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetChainedWithAnotherFunction_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetInsideIf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetWithParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"") ); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_RelationFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_RelationFunctions_PCT.java index 230dc8738f5..417f703b3eb 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_RelationFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_RelationFunctions_PCT.java @@ -36,9 +36,8 @@ public class Test_Relational_H2_RelationFunctions_PCT extends PCTReportConfigura private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.H2Adapter; private static final String platform = "compiled"; private static final MutableList expectedFailures = Lists.mutable.with( - // BUG: Column name with special characters is not properly escaped one("meta::pure::functions::relation::tests::select::testSingleSelectWithQuotedColumn_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") - ); + ); public static Test suite() { diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_StandardFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_StandardFunctions_PCT.java new file mode 100644 index 00000000000..37345f330b4 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/h2/pct/Test_Relational_H2_StandardFunctions_PCT.java @@ -0,0 +1,86 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.h2.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.*; + +public class Test_Relational_H2_StandardFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.H2Adapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // StD Dev + one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Variance + one("meta::pure::functions::math::tests::variance::testVariancePopulation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVarianceSample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Population_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Sample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.H2).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/pom.xml index ee622cdbfb3..3a9c83c5e67 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -179,7 +179,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -201,8 +201,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/src/main/resources/core_relational_hive.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/src/main/resources/core_relational_hive.definition.json index e06e2ae9c4f..84f7fe6775f 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/src/main/resources/core_relational_hive.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-hive/legend-engine-xt-relationalStore-hive-pure/src/main/resources/core_relational_hive.definition.json @@ -1,5 +1,11 @@ { - "name" : "core_relational_hive", - "pattern" : "(meta::relational::functions::sqlQueryToString::hive|meta::relational::tests::sqlQueryToString::hive|meta::pure::executionPlan::tests::hive|meta::relational::tests::mapping::sqlFunction::hive|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "core_functions", "core", "core_relational"] + "name": "core_relational_hive", + "pattern": "(meta::relational::functions::sqlQueryToString::hive|meta::relational::tests::sqlQueryToString::hive|meta::pure::executionPlan::tests::hive|meta::relational::tests::mapping::sqlFunction::hive|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "core_functions_unclassified", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/pom.xml index d74551ce9c4..eb2089771ba 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -185,10 +185,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-store-java @@ -199,7 +195,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -221,8 +217,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/src/main/resources/core_relational_memsql.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/src/main/resources/core_relational_memsql.definition.json index e9b3ff54361..b539781249d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/src/main/resources/core_relational_memsql.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-pure/src/main/resources/core_relational_memsql.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::relational::functions::sqlQueryToString::memsql|meta::pure::alloy::connections|meta::protocols::pure|meta::relational::tests::sqlQueryToString::memsql|meta::relational::memsql::tests)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/pom.xml index 0789f9e1394..65cd17ff6e9 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/pom.xml @@ -47,8 +47,8 @@ Compiled ${project.build.directory}/classes/pct-reports/ - org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_BaseFunctions_PCT - org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_BasicFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_StandardFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_EssentialFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_GrammarFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct.Test_Relational_Postgres_RelationFunctions_PCT @@ -70,7 +70,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-functions-standard-pure ${project.version} @@ -80,7 +80,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation ${project.version} @@ -141,14 +141,13 @@ legend-engine-shared-vault-core - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure runtime - org.finos.legend.pure - legend-pure-m2-functions-base-pure - runtime + org.finos.legend.engine + legend-engine-pure-functions-standard-pure org.finos.legend.engine @@ -161,11 +160,6 @@ runtime - - com.fasterxml.jackson.core - jackson-databind - - org.testcontainers postgresql @@ -202,7 +196,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/integration/Core_Relational_Postgres_PCTReportProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/integration/Core_Relational_Postgres_PCTReportProvider.java index d98b1bbd53c..b0252890a41 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/integration/Core_Relational_Postgres_PCTReportProvider.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/integration/Core_Relational_Postgres_PCTReportProvider.java @@ -20,6 +20,7 @@ import org.finos.legend.pure.m3.pct.functions.model.Functions; import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; public class Core_Relational_Postgres_PCTReportProvider implements PCTReportProvider { @@ -32,32 +33,11 @@ public MutableList getFunctions() @Override public MutableList getAdapterReports() { - { - try - { - return Lists.mutable.with( - JsonMapper.builder().build().readValue( - Core_Relational_Postgres_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_base_compiled_Postgres.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Postgres_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_basic_compiled_Postgres.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Postgres_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_grammar_compiled_Postgres.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Postgres_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_relation_compiled_Postgres.json"), - AdapterReport.class - ) - ); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } + return PCTReportProviderTool.load(Core_Relational_Postgres_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_Postgres.json", + "pct-reports/ADAPTER_essential_compiled_Postgres.json", + "pct-reports/ADAPTER_grammar_compiled_Postgres.json", + "pct-reports/ADAPTER_relation_compiled_Postgres.json" + ); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/TestPCRReport.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/TestPCRReport.java index 96a87b780eb..64823e61cdb 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/TestPCRReport.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/TestPCRReport.java @@ -24,6 +24,6 @@ public class TestPCRReport public void canFindPCTReport() { Assert.assertEquals("Native, Postgres", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); - Assert.assertEquals(8, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals(9, PCTReportProviderLoader.gatherReports().size()); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BaseFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BaseFunctions_PCT.java deleted file mode 100644 index c648af772af..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BaseFunctions_PCT.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.code.core.FunctionsCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_Postgres_BaseFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = FunctionsCodeRepositoryProvider.baseFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.postgresAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Contains - one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - - one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), - one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::ceiling::testNegativeIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::ceiling::testPositiveIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::floor::testNegativeIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::floor::testPositiveIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), - - one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), - - one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), - - one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"\nexpected: 16\nactual: 17\""), - - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"\nexpected: -16\nactual: -17\""), - one("meta::pure::functions::math::tests::sign::testSign_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')") - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Postgres).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BasicFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BasicFunctions_PCT.java deleted file mode 100644 index c1ee00668ea..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_BasicFunctions_PCT.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_Postgres_BasicFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = PlatformCodeRepositoryProvider.basicFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.postgresAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Add - one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Concatenate - one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Fold - one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Init - one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Sort - one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Tail - one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Format - one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 1 where the collection is of size 1\""), - one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // JoinStrings - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"The database type 'Postgres' is not supported yet!\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: 'a,b,c'\nactual: ',a,b,c,'\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: 'a,b,c'\nactual: ',a,b,c,'\""), - - // Split - one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Substring - one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy do'\""), - one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), - - // ToString - one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), - one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), - one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), - one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\""), - - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"") - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Postgres).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_EssentialFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_EssentialFunctions_PCT.java new file mode 100644 index 00000000000..fcc0b001948 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_EssentialFunctions_PCT.java @@ -0,0 +1,372 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_Postgres_EssentialFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = PlatformCodeRepositoryProvider.essentialFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.postgresAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // Add + one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Concatenate + one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Contains + one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Drop + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Exists + one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + + // Find + one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Fold + one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // ForAll + one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), + one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Init + one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Last + one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Reverse + one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Slice + one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), + + // Sort + one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Tail + one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Take + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Zip + one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + + // Format + one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 1 where the collection is of size 1\""), + one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // JoinStrings + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"The database type 'Postgres' is not supported yet!\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: 'a,b,c'\nactual: ',a,b,c,'\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: 'a,b,c'\nactual: ',a,b,c,'\""), + + // Split + one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Substring + one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy do'\""), + one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), + + // ToString + one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00'\""), + one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), + one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\""), + + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::ceiling::testNegativeIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::ceiling::testPositiveIntegerCeiling_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::floor::testNegativeIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::floor::testPositiveIntegerFloor_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), + + one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), + + one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), + + one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"\nexpected: 16\nactual: 17\""), + + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"\nexpected: -16\nactual: -17\""), + one("meta::pure::functions::math::tests::sign::testSign_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // Is + one("meta::pure::functions::boolean::tests::testIsEnum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::boolean::tests::testIsNonPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::boolean::tests::testIsPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // At + one("meta::pure::functions::collection::tests::at::testAtOtherScenario_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> map(x:String[1] | [$x, 'z'] -> plus();) -> at(0)\""), + one("meta::pure::functions::collection::tests::at::testAtWithVariable_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(1)\""), + one("meta::pure::functions::collection::tests::at::testAt_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(0)\""), + + // RemoveDuplicates + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyListExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveNonStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunctionExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicatesBy::testRemoveDuplicatesByPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + //Date + one("meta::pure::functions::date::tests::testAdjustByDaysBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByHoursBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByMicrosecondsBigNumber_Function_1__Boolean_1_", "\"\nexpected: %2021-06-21T09:37:37.4990000+0000\nactual: %2021-06-21T09:37:37.499+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMinutesBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByMonthsBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustReflectiveEvaluation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'eval_Function_1__T_n__U_p__W_q__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__StrictDate_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSubSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromYear_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasDay_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasHour_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMinute_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonthReflect_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecondWithAtLeastPrecision_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecondWithAtLeastPrecision_Date_1__Integer_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testAdjustByMonths_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testAdjustByWeeksBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDateDiffWeeks_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testDateDiffYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearMonthOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testHour_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testMinute_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testMonthNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testYear_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDateDiffDays_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testDateDiffHours_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDateDiffMilliseconds_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDateDiffMinutes_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDateDiffMonths_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDateDiffSeconds_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDateDiffWithDifferentTimeZones_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testDayOfMonth_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testSecond_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::date::tests::testYeaReflect_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')"), + + + // MultiIf + one("meta::pure::functions::lang::tests::if::testMultiIf_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Match + one("meta::pure::functions::lang::tests::match::testMatchManyWithMany_Function_1__Boolean_1_", "\"Match only supports operands with multiplicity [1]..! Current operand : ['w', 'w', 'w']\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithZeroOne_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWith_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParamsAndFunctionsAsParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParamManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParam_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctions_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithMixedReturnType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithZero_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatch_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // Abs + one("meta::pure::functions::math::tests::abs::testDecimalAbs_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'abs_Decimal_1__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::string::tests::indexOf::testFromIndex_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_String_1__String_1__Integer_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::indexOf::testSimple_Function_1__Boolean_1_", "\"\nexpected: 4\nactual: 5\""), + + // ParseBoolean + one("meta::pure::functions::string::tests::parseBoolean::testParseFalse_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseBoolean::testParseTrue_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseBoolean' (state: [Select, false]) is not supported yet\""), + + // ParseDate + one("meta::pure::functions::string::tests::parseDate::testParseDateTypes_Function_1__Boolean_1_", "\"expected %2014-02-27 to be an instance of DateTime, actual: StrictDate\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithTimezone_Function_1__Boolean_1_", "\"\nexpected: %2014-02-27T15:01:35.231+0000\nactual: %2014-02-27T10:01:35+0000\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithZ_Function_1__Boolean_1_", "\"\nexpected: %2014-02-27T10:01:35.231+0000\nactual: %2014-02-27T10:01:35+0000\""), + one("meta::pure::functions::string::tests::parseDate::testParseDate_Function_1__Boolean_1_", "\"\nexpected: %2014-02-27T10:01:35.231+0000\nactual: %2014-02-27T10:01:35+0000\""), + + // ParseDecimal + one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "class java.lang.Double cannot be cast to class java.math.BigDecimal (java.lang.Double and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // ParseInteger + one("meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Postgres).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_GrammarFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_GrammarFunctions_PCT.java index 091c0b739a6..17633b531ff 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_GrammarFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_GrammarFunctions_PCT.java @@ -72,7 +72,7 @@ public class Test_Relational_Postgres_GrammarFunctions_PCT extends PCTReportConf one("meta::pure::functions::collection::tests::map::testMapInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToOne_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/base/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), + one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/iteration/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), // Range one("meta::pure::functions::collection::tests::range::testRangeWithStep_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'range_Integer_1__Integer_1__Integer_1__Integer_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), @@ -110,7 +110,15 @@ public class Test_Relational_Postgres_GrammarFunctions_PCT extends PCTReportConf // Plus (String) one("meta::pure::functions::string::tests::plus::testMultiPlusWithPropertyExpressions_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::string::tests::plus::testPlusInCollect_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), - one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\"") + one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), + + // Let + one("meta::pure::functions::lang::tests::letFn::testAssignLiteralToVariable_Function_1__Boolean_1_", "\"Cannot cast a collection of size 2 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testAssignNewInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetAsLastStatement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetChainedWithAnotherFunction_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetInsideIf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetWithParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"") ); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_RelationFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_RelationFunctions_PCT.java index b735d941c71..5e3a4da6ac9 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_RelationFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_RelationFunctions_PCT.java @@ -36,9 +36,8 @@ public class Test_Relational_Postgres_RelationFunctions_PCT extends PCTReportCon private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.postgresAdapter; private static final String platform = "compiled"; private static final MutableList expectedFailures = Lists.mutable.with( - // BUG: Column name with special characters is not properly escaped one("meta::pure::functions::relation::tests::select::testSingleSelectWithQuotedColumn_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") - ); + ); public static Test suite() { diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_StandardFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_StandardFunctions_PCT.java new file mode 100644 index 00000000000..08dcef68181 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/postgres/pct/Test_Relational_Postgres_StandardFunctions_PCT.java @@ -0,0 +1,86 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.postgres.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_Postgres_StandardFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.postgresAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // StD Dev + one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Variance + one("meta::pure::functions::math::tests::variance::testVariancePopulation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVarianceSample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Population_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Sample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Postgres).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/pom.xml index 5704bf16106..8301a6ac16f 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -185,17 +185,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -213,8 +209,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres.definition.json index 02a4dd965cd..3a1552d3b15 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres.definition.json @@ -1,5 +1,11 @@ { - "name" : "core_relational_postgres", - "pattern" : "(meta::relational::functions::sqlQueryToString::postgres|meta::relational::tests::sqlQueryToString::postgres|meta::relational::tests::query::function::postgres|meta::relational::functions::sqlToString::postgres|meta::relational::tests::mapping::function::postgres|meta::relational::tests::tds::postgres|meta::pure::executionPlan::tests::postgres|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "core_functions", "core", "core_relational"] + "name": "core_relational_postgres", + "pattern": "(meta::relational::functions::sqlQueryToString::postgres|meta::relational::tests::sqlQueryToString::postgres|meta::relational::tests::query::function::postgres|meta::relational::functions::sqlToString::postgres|meta::relational::tests::mapping::function::postgres|meta::relational::tests::tds::postgres|meta::pure::executionPlan::tests::postgres|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "core_functions_unclassified", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/pom.xml index 347b29bdccc..c4cc1ac74bf 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -185,10 +185,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java @@ -203,7 +199,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -225,8 +221,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/src/main/resources/core_relational_presto.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/src/main/resources/core_relational_presto.definition.json index 16ccc076fc1..959102180cb 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/src/main/resources/core_relational_presto.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-presto/legend-engine-xt-relationalStore-presto-pure/src/main/resources/core_relational_presto.definition.json @@ -1,5 +1,11 @@ { - "name" : "core_relational_presto", - "pattern" : "(meta::relational::functions::sqlQueryToString::presto|meta::relational::tests::sqlQueryToString::presto|meta::pure::executionPlan::tests::presto|meta::relational::tests::query::function::presto|meta::relational::tests::projection::presto|meta::relational::tests::tds::presto|meta::relational::tests::mapping::sqlFunction::presto|meta::relational::tests::functions::sqlstring::presto|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "core_functions", "core", "core_relational"] + "name": "core_relational_presto", + "pattern": "(meta::relational::functions::sqlQueryToString::presto|meta::relational::tests::sqlQueryToString::presto|meta::pure::executionPlan::tests::presto|meta::relational::tests::query::function::presto|meta::relational::tests::projection::presto|meta::relational::tests::tds::presto|meta::relational::tests::mapping::sqlFunction::presto|meta::relational::tests::functions::sqlstring::presto|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "core_functions_unclassified", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-grammar/pom.xml index 41a9b45b49d..a482c05c473 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-grammar/pom.xml @@ -156,8 +156,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/pom.xml index e2133f7ec75..7f5e5232776 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -92,6 +92,12 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + @@ -150,6 +156,12 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + @@ -181,10 +193,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-store-java @@ -195,12 +203,16 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine legend-engine-xt-relationalStore-pure + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.eclipse.collections @@ -213,8 +225,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/src/main/resources/core_relational_redshift.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/src/main/resources/core_relational_redshift.definition.json index 5ae3e0350e6..f80ac07eb33 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/src/main/resources/core_relational_redshift.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-redshift/legend-engine-xt-relationalStore-redshift-pure/src/main/resources/core_relational_redshift.definition.json @@ -3,10 +3,10 @@ "pattern": "(meta::relational::functions::sqlQueryToString::redshift|meta::relational::tests::sqlQueryToString::redshift|meta::relational::functions::sqlQueryToString::tests::redshift|meta::pure::executionPlan::tests::redshift|meta::pure::legend::connections::legend::specification|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/pom.xml index 3165d8b1ec7..77934536ffd 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/pom.xml @@ -59,10 +59,10 @@ ${project.build.directory}/classes/pct-reports/ - org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct.Test_Relational_Snowflake_BaseFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct.Test_Relational_Snowflake_StandardFunctions_PCT - org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct.Test_Relational_Snowflake_BasicFunctions_PCT + org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct.Test_Relational_Snowflake_EssentialFunctions_PCT org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct.Test_Relational_Snowflake_GrammarFunctions_PCT @@ -89,7 +89,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-functions-standard-pure ${project.version} @@ -99,7 +99,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation ${project.version} @@ -157,12 +157,12 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure + org.finos.legend.engine + legend-engine-pure-functions-standard-pure - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure @@ -190,11 +190,6 @@ - - com.fasterxml.jackson.core - jackson-databind - - junit @@ -228,7 +223,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/integration/Core_Relational_Snowflake_PCTReportProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/integration/Core_Relational_Snowflake_PCTReportProvider.java index f656d05ee01..c546a504c1c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/integration/Core_Relational_Snowflake_PCTReportProvider.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/integration/Core_Relational_Snowflake_PCTReportProvider.java @@ -14,12 +14,12 @@ package org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.integration; -import com.fasterxml.jackson.databind.json.JsonMapper; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.finos.legend.pure.m3.pct.functions.model.Functions; import org.finos.legend.pure.m3.pct.reports.model.AdapterReport; import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProvider; +import org.finos.legend.pure.m3.pct.shared.provider.PCTReportProviderTool; public class Core_Relational_Snowflake_PCTReportProvider implements PCTReportProvider { @@ -32,30 +32,11 @@ public MutableList getFunctions() @Override public MutableList getAdapterReports() { - try - { - return Lists.mutable.with( - JsonMapper.builder().build().readValue( - Core_Relational_Snowflake_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_base_compiled_Snowflake.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Snowflake_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_basic_compiled_Snowflake.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Snowflake_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_grammar_compiled_Snowflake.json"), - AdapterReport.class - ), - JsonMapper.builder().build().readValue( - Core_Relational_Snowflake_PCTReportProvider.class.getResourceAsStream("/pct-reports/ADAPTER_relation_compiled_Snowflake.json"), - AdapterReport.class - ) - ); - } - catch (Exception e) - { - throw new RuntimeException(e); - } + return PCTReportProviderTool.load(Core_Relational_Snowflake_PCTReportProvider.class.getClassLoader(), AdapterReport.class, + "pct-reports/ADAPTER_standard_compiled_Snowflake.json", + "pct-reports/ADAPTER_unclassified_compiled_Snowflake.json", + "pct-reports/ADAPTER_grammar_compiled_Snowflake.json", + "pct-reports/ADAPTER_relation_compiled_Snowflake.json" + ); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/TestPCRReport.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/TestPCRReport.java index 127ea31932e..f066973c8a6 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/TestPCRReport.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/TestPCRReport.java @@ -24,6 +24,6 @@ public class TestPCRReport public void canFindPCTReport() { Assert.assertEquals("Native, Snowflake", PCTReportProviderLoader.gatherReports().collect(c -> c.adapterKey.adapter.name).distinct().sortThis().makeString(", ")); - Assert.assertEquals(8, PCTReportProviderLoader.gatherReports().size()); + Assert.assertEquals(9, PCTReportProviderLoader.gatherReports().size()); } } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BaseFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BaseFunctions_PCT.java deleted file mode 100644 index 0da9fc6dec6..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BaseFunctions_PCT.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.code.core.FunctionsCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_Snowflake_BaseFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = FunctionsCodeRepositoryProvider.baseFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.snowflakeAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Contains - one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Parameter to IN operation isn't a literal!\""), - one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Error mapping not found for class ClassWithoutEquality cache:''\""), - - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), - - one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - - one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), - one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), - one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), - one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - - one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), - - one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), - - one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - - one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), - - one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), - - one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"\nexpected: -16\nactual: -17\""), - - one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"\nexpected: 16\nactual: 17\""), - - one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'stdDev_Number_$1_MANY$__Boolean_1__Number_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), - - one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')") - - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource)TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Snowflake).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BasicFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BasicFunctions_PCT.java deleted file mode 100644 index eba839d7ce5..00000000000 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_BasicFunctions_PCT.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2023 Goldman Sachs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct; - -import junit.framework.Test; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.list.MutableList; -import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; -import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; -import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; -import org.finos.legend.engine.test.shared.framework.TestServerResource; -import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; -import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; -import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; -import org.finos.legend.pure.m3.pct.reports.model.Adapter; -import org.finos.legend.pure.m3.pct.shared.model.ReportScope; -import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; - -import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; - -public class Test_Relational_Snowflake_BasicFunctions_PCT extends PCTReportConfiguration -{ - private static final ReportScope reportScope = PlatformCodeRepositoryProvider.basicFunctions; - private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.snowflakeAdapter; - private static final String platform = "compiled"; - private static final MutableList expectedFailures = Lists.mutable.with( - // Add - one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Concatenate - one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), - - // Fold - one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), - one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), - one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Init - one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Sort - one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Tail - one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Format - one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // JoinStrings - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"\nexpected: '[a]'\nactual: '['\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), - - // Split - one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), - - // Substring - one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\""), - one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), - - // ToString - one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00.000'\""), - one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00.000'\""), - one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), - one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), - one("meta::pure::functions::string::tests::toString::testFloatToStringWithExcessTrailingZeros_Function_1__Boolean_1_", "\"\nexpected: '17.0'\nactual: '17'\""), - one("meta::pure::functions::string::tests::toString::testFloatToStringWithPositiveExponent_Function_1__Boolean_1_", "\"\nexpected: '134210000.0'\nactual: '134210000'\""), - one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), - one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\"") - - - ); - - public static Test suite() - { - return wrapSuite( - () -> true, - () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), - () -> false, - Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Snowflake).getFirst()) - ); - } - - @Override - public MutableList expectedFailures() - { - return expectedFailures; - } - - @Override - public ReportScope getReportScope() - { - return reportScope; - } - - @Override - public Adapter getAdapter() - { - return adapter; - } - - @Override - public String getPlatform() - { - return platform; - } -} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_EssentialFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_EssentialFunctions_PCT.java new file mode 100644 index 00000000000..0196a32f9f8 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_EssentialFunctions_PCT.java @@ -0,0 +1,355 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.m3.PlatformCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_Snowflake_EssentialFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = PlatformCodeRepositoryProvider.essentialFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.snowflakeAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // Add + one("meta::pure::functions::collection::tests::add::testAddWithOffset_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__Integer_1__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::add::testAdd_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'add_T_MANY__T_1__T_$1_MANY$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Concatenate + one("meta::pure::functions::collection::tests::concatenate::testConcatenateMixedType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateSimple_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::concatenate::testConcatenateTypeInference_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Contains + one("meta::pure::functions::collection::tests::contains::testContainsNonPrimitive_Function_1__Boolean_1_", "\"Parameter to IN operation isn't a literal!\""), + one("meta::pure::functions::collection::tests::contains::testContainsPrimitive_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::contains::testContainsWithFunction_Function_1__Boolean_1_", "\"Error mapping not found for class ClassWithoutEquality cache:''\""), + + // Drop + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the drop function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::drop::testDropNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::drop::testDropZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Exists + one("meta::pure::functions::collection::tests::exists::testExistsInSelect_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + one("meta::pure::functions::collection::tests::exists::testExists_Function_1__Boolean_1_", "\"Error mapping not found for class CO_Firm cache:''\""), + + // Find + one("meta::pure::functions::collection::tests::find::testFindInstance_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::collection::tests::find::testFindLiteralFromVar_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindLiteral_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'find_T_MANY__Function_1__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::find::testFindUsingVarForFunction_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Fold + one("meta::pure::functions::collection::tests::fold::testFoldCollectionAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldEmptyListAndNonEmptyIdentity_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldFiltering_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), + one("meta::pure::functions::collection::tests::fold::testFoldMixedAccumulatorTypes_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldToMany_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithEmptyAccumulator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFoldWithSingleValue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testFold_Function_1__Boolean_1_", "\"Error mapping not found for class FO_Person cache:''\""), + one("meta::pure::functions::collection::tests::fold::testIntegerSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::fold::testStringSum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'fold_T_MANY__Function_1__V_m__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // ForAll + one("meta::pure::functions::collection::tests::forall::testforAllOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsFalse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::forall::testforAllOnNonEmptySetIsTrue_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'forAll_T_MANY__Function_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // IndexOf + one("meta::pure::functions::collection::tests::indexof::testIndexOfOneElement_Function_1__Boolean_1_", "\"\nexpected: 0\nactual: 1\""), + one("meta::pure::functions::collection::tests::indexof::testIndexOf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_T_MANY__T_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Init + one("meta::pure::functions::collection::tests::init::testInitOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInitOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::init::testInit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'init_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Last + one("meta::pure::functions::collection::tests::last::testLastFromEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLastOfOneElementList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::last::testLast_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'last_T_MANY__T_$0_1$_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Sort + one("meta::pure::functions::collection::tests::sort::testMixedSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortNoComparator_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortReversed_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithFunctionVariables_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSortWithKey_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSimpleSort_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::sort::testSortEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'sort_T_m__Function_$0_1$__Function_$0_1$__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Tail + one("meta::pure::functions::collection::tests::tail::testTailOnEmptySet_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTailOneElement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::tail::testTail_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Reverse + one("meta::pure::functions::collection::tests::reverse::testReverseEmpty_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::reverse::testReverse_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'reverse_T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Slice + one("meta::pure::functions::collection::tests::slice::testSliceEqualBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSliceOnEmpty_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::slice::testSliceOutOfBounds_Function_1__Boolean_1_", "\"Cannot cast a collection of size 4 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::slice::testSlice_Function_1__Boolean_1_", "\"Cannot cast a collection of size 6 to multiplicity [1]\""), + + // Take + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeExceedsSizeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeInList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'new_Class_1__String_1__KeyExpression_MANY__T_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeManyOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnEmptyList_Function_1__Boolean_1_", "\"Invalid type for parameter inside the take/limit function. Expected a value, found operation/function\""), + one("meta::pure::functions::collection::tests::take::testTakeNegativeOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeOneOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnEmptyList_Function_1__Boolean_1_", "\"Cast exception: SelectSQLQuery cannot be cast to TdsSelectSqlQuery\""), + one("meta::pure::functions::collection::tests::take::testTakeZeroOnNonEmptyList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 3 to multiplicity [1]\""), + + // Zip + one("meta::pure::functions::collection::tests::zip::testZipBothListsAreOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipBothListsSameLength_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipFirstListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListEmpty_Function_1__Boolean_1_", "\"The system is trying to get an element at offset 0 where the collection is of size 0\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListLonger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'zip_T_MANY__U_MANY__Pair_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::zip::testZipSecondListsIsOfPairs_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // Format + one("meta::pure::functions::string::tests::format::testFormatBoolean_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithRounding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithTruncation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloatWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatFloat_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEval_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInEvaluate_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatIntegerWithZeroPadding_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatInteger_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatList_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatPair_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::format::testFormatRepr_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testFormatString_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::format::testSimpleFormatDate_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'format_String_1__Any_MANY__String_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // JoinStrings + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsNoStrings_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'tail_T_MANY__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsSingleString_Function_1__Boolean_1_", "\"\nexpected: '[a]'\nactual: '['\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStringsUsingGenericArrow_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + one("meta::pure::functions::string::tests::joinStrings::testJoinStrings_Function_1__Boolean_1_", "\"\nexpected: '[a,b,c]'\nactual: '[,a,b,c,]'\""), + + // Split + one("meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Substring + one("meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\""), + one("meta::pure::functions::string::tests::substring::testStart_Function_1__Boolean_1_", "\"\nexpected: 'he quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy dog'\""), + + // ToString + one("meta::pure::functions::string::tests::toString::testClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testComplexClassToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testDateTimeToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.000+0000'\nactual: '2014-01-01 00:00:00.000'\""), + one("meta::pure::functions::string::tests::toString::testDateTimeWithTimezoneToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-01T00:00:00.0000+0000'\nactual: '2014-01-01 00:00:00.000'\""), + one("meta::pure::functions::string::tests::toString::testDateToString_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::string::tests::toString::testEnumerationToString_Function_1__Boolean_1_", "\"Match failure: ClassInstanceHolderObject instanceOf ClassInstanceHolder\""), + one("meta::pure::functions::string::tests::toString::testFloatToStringWithExcessTrailingZeros_Function_1__Boolean_1_", "\"\nexpected: '17.0'\nactual: '17'\""), + one("meta::pure::functions::string::tests::toString::testFloatToStringWithPositiveExponent_Function_1__Boolean_1_", "\"\nexpected: '134210000.0'\nactual: '134210000'\""), + one("meta::pure::functions::string::tests::toString::testListToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairCollectionToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testPairToString_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::string::tests::toString::testSimpleDateToString_Function_1__Boolean_1_", "\"\nexpected: '2014-01-02T01:54:27.352+0000'\nactual: '2014-01-02 01:54:27.352'\""), + + // Ceiling + one("meta::pure::functions::math::tests::ceiling::testDecimalCeiling_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Floor + one("meta::pure::functions::math::tests::floor::testDecimalFloor_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // Mod + one("meta::pure::functions::math::tests::mod::testModInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::mod::testModWithNegativeNumbers_Function_1__Boolean_1_", "\"\nexpected: 3\nactual: -2\""), + + // Pow + one("meta::pure::functions::math::tests::pow::testNumberPow_Function_1__Boolean_1_", "\"\nexpected: 9.0\nactual: 27.0\""), + + // Rem + one("meta::pure::functions::math::tests::rem::testRemInEvalWithNegativeNumbers_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemInEval_Function_1__Boolean_1_", "\"Unused format args. [3] arguments provided to expression \"mod(%s,%s)\"\""), + one("meta::pure::functions::math::tests::rem::testRemWithDecimals_Function_1__Boolean_1_", "\"\nexpected: 0.14D\nactual: 0.14\""), + + // Round + one("meta::pure::functions::math::tests::round::testDecimalRound_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'minus_Decimal_MANY__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::round::testFloatRoundWithScale_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::round::testNegativeFloatRoundHalfEvenUp_Function_1__Boolean_1_", "\"\nexpected: -16\nactual: -17\""), + one("meta::pure::functions::math::tests::round::testPositiveFloatRoundHalfEvenDown_Function_1__Boolean_1_", "\"\nexpected: 16\nactual: 17\""), + + // ToDecimal + one("meta::pure::functions::math::tests::toDecimal::testDecimalToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testDoubleToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + one("meta::pure::functions::math::tests::toDecimal::testIntToDecimal_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')"), + + // Is + one("meta::pure::functions::boolean::tests::testIsEnum_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::boolean::tests::testIsNonPrimitive_Function_1__Boolean_1_", "\"Match failure: StoreMappingClusteredValueSpecificationObject instanceOf StoreMappingClusteredValueSpecification\""), + one("meta::pure::functions::boolean::tests::testIsPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'is_Any_1__Any_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + // At + one("meta::pure::functions::collection::tests::at::testAtOtherScenario_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> map(x:String[1] | [$x, 'z'] -> plus();) -> at(0)\""), + one("meta::pure::functions::collection::tests::at::testAtWithVariable_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(1)\""), + one("meta::pure::functions::collection::tests::at::testAt_Function_1__Boolean_1_", "\"->at(...) function is supported only after direct access of 1->MANY properties. Current expression: ['a', 'b', 'c'] -> at(0)\""), + + // RemoveDuplicates + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyListExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesEmptyList_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveNonStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunctionExplicit_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicates::testRemoveDuplicatesPrimitiveStandardFunction_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::collection::tests::removeDuplicatesBy::testRemoveDuplicatesByPrimitive_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'removeDuplicates_T_MANY__Function_$0_1$__Function_$0_1$__T_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + + //Date + one("meta::pure::functions::date::tests::testAdjustByDaysBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByHoursBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByMicrosecondsBigNumber_Function_1__Boolean_1_", "\"\nexpected: %2021-06-21T09:37:37.4990000+0000\nactual: %2021-06-21T09:37:37.499+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMinutesBigNumber_Function_1__Boolean_1_", "\"\nexpected: %-21457-01-08T20:48:00+0000\nactual: %21458-01-18T17:39:38+0000\""), + one("meta::pure::functions::date::tests::testAdjustByMonthsBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustReflectiveEvaluation_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'eval_Function_1__T_n__U_p__W_q__V_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__StrictDate_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromSubSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Integer_1__Integer_1__Integer_1__Integer_1__Number_1__DateTime_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testDateFromYear_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'date_Integer_1__Date_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasDay_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasDay_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasHour_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasHour_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMinute_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMinute_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonthReflect_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasMonth_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasMonth_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecondWithAtLeastPrecision_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecondWithAtLeastPrecision_Date_1__Integer_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testHasSubsecond_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'hasSubsecond_Date_1__Boolean_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::date::tests::testAdjustByMonths_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testAdjustByWeeksBigNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::date::tests::testAdjustByYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDateDiffWeeks_Function_1__Boolean_1_", "\"\nexpected: 1\nactual: 0\""), + one("meta::pure::functions::date::tests::testDateDiffYears_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearMonthOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testDatePartYearOnly_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testHour_Function_1__Boolean_1_", "\"\nexpected: 17\nactual: 0\""), + one("meta::pure::functions::date::tests::testMinute_Function_1__Boolean_1_", "\"\nexpected: 9\nactual: 0\""), + one("meta::pure::functions::date::tests::testMonthNumber_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + one("meta::pure::functions::date::tests::testYear_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_NoCounter, Anonymous_NoCounter, false]\""), + + // MultiIf + one("meta::pure::functions::lang::tests::if::testMultiIf_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Match + one("meta::pure::functions::lang::tests::match::testMatchManyWithMany_Function_1__Boolean_1_", "\"Match only supports operands with multiplicity [1]..! Current operand : ['w', 'w', 'w']\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWithZeroOne_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchOneWith_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithExtraParamsAndFunctionsAsParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'match_Any_MANY__Function_$1_MANY$__P_o__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParamManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsAsParam_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctionsManyMatch_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchWithFunctions_Function_1__Boolean_1_", "\"Cast exception: Literal cannot be cast to SemiStructuredPropertyAccess\""), + one("meta::pure::functions::lang::tests::match::testMatchWithMixedReturnType_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithMany_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatchZeroWithZero_Function_1__Boolean_1_", "\"Match does not support Non-Primitive return type..! Current return type : Any\""), + one("meta::pure::functions::lang::tests::match::testMatch_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + + // Abs + one("meta::pure::functions::math::tests::abs::testDecimalAbs_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'abs_Decimal_1__Decimal_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::math::tests::abs::testBigFloatAbs_Function_1__Boolean_1_", "class java.lang.Long cannot be cast to class java.lang.Double (java.lang.Long and java.lang.Double are in module java.base of loader 'bootstrap')"), + + // IndexOf + one("meta::pure::functions::string::tests::indexOf::testFromIndex_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'indexOf_String_1__String_1__Integer_1__Integer_1_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::string::tests::indexOf::testSimple_Function_1__Boolean_1_", "\"\nexpected: 4\nactual: 5\""), + + // ParseDate + one("meta::pure::functions::string::tests::parseDate::testParseDateTypes_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithTimezone_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDateWithZ_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::string::tests::parseDate::testParseDate_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // ParseDecimal + one("meta::pure::functions::string::tests::parseDecimal::testParseDecimal_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseDecimal' (state: [Select, false]) is not supported yet\""), + one("meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "\"[unsupported-api] The function 'parseDecimal' (state: [Select, false]) is not supported yet\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Snowflake).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_GrammarFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_GrammarFunctions_PCT.java index b895e48dcb5..f99fc3e30e1 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_GrammarFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_GrammarFunctions_PCT.java @@ -72,7 +72,7 @@ public class Test_Relational_Snowflake_GrammarFunctions_PCT extends PCTReportCon one("meta::pure::functions::collection::tests::map::testMapInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToMany_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), one("meta::pure::functions::collection::tests::map::testMapRelationshipFromManyToOne_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), - one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/base/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), + one("meta::pure::functions::collection::tests::map::testMapRelationshipFromOneToOne_Function_1__Boolean_1_", "\"Error during dynamic reactivation: Error dynamically evaluating value specification (from /platform/pure/grammar/functions/collection/iteration/map.pure:43cc92-98); error compiling generated Java code:\nimport org.eclipse.collections.api.LazyIterable;\nimport org.eclipse.collections.api.block.function.Function0;\nimport org.eclipse.collections.api.block.function.Function;\nimport org.eclipse.collections.api.block.function.Function2;\nimport org.eclipse.collections.api.block.predicate.Predicate;\nimport org.eclipse.collections.api.block.procedure.Procedure;\nimport org.eclipse.collections.api.map.ImmutableMap;\nimport org.eclipse.collections.api.map.MutableMap;\nimport org.eclipse.collections.api.map.MutableMapIterable;\nimport org.eclipse.collections.api.map.MapIterable;\nimport org.eclipse.collections.api.map.primitive.IntObjectMap;\nimport org.eclipse.collections.api.set.MutableSet;\nimport org.eclipse.collections.api.set.SetIterable;\nimport org.eclipse.collections.api.list.MutableList;\nimport org.eclipse.collections.api.list.ListIterable;\nimport org.eclipse.collections.api.RichIterable;\nimport org.eclipse.collections.api.tuple.Pair;\nimport org.eclipse.collections.impl.factory.Lists;\nimport org.eclipse.collections.impl.factory.Maps;\nimport org.eclipse.collections.impl.map.mutable.UnifiedMap;\nimport org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;\nimport org.eclipse.collections.impl.set.mutable.UnifiedSet;\nimport org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy;\nimport org.eclipse.collections.impl.list.mutable.FastList;\nimport org.eclipse.collections.impl.factory.Sets;\nimport org.eclipse.collections.impl.block.function.checked.CheckedFunction0;\nimport org.eclipse.collections.impl.utility.Iterate;\nimport org.eclipse.collections.impl.utility.LazyIterate;\nimport org.eclipse.collections.impl.utility.StringIterate;\nimport org.finos.legend.pure.m3.navigation.generictype.GenericType;\nimport org.finos.legend.pure.m3.navigation.ProcessorSupport;\nimport org.finos.legend.pure.m3.execution.ExecutionSupport;\nimport org.finos.legend.pure.m3.exception.PureExecutionException;\nimport org.finos.legend.pure.m4.coreinstance.CoreInstance;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.PureDate;\nimport org.finos.legend.pure.m4.coreinstance.primitive.date.DateFunctions;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.coreinstance.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.map.*;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangeType;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.ChangedPath;\nimport org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.vcs.Revision;\nimport org.finos.legend.pure.m3.navigation.PackageableElement.PackageableElement;\nimport org.finos.legend.pure.m3.tools.ListHelper;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.defended.*;\nimport org.finos.legend.pure.runtime.java.compiled.generation.processors.support.function.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.*;\nimport org.finos.legend.pure.runtime.java.compiled.execution.sourceInformation.*;\nimport org.finos.legend.pure.runtime.java.compiled.serialization.model.*;\nimport org.finos.legend.pure.runtime.java.compiled.metadata.*;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.sql.DatabaseMetaData;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSetMetaData;\nimport java.util.Iterator;\nimport java.util.Calendar;\nimport java.util.Map;\nimport java.util.ArrayDeque;\nimport java.util.Deque;\nimport org.json.simple.JSONObject;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Generalization;\nimport org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Type;\n\n\npublic class DynaClass{\n public static org.finos.legend.pure.generated.Root_meta_pure_functions_collection_tests_map_model_M_Address doProcess(final MapIterable vars, final MutableMap valMap, final IntObjectMap localLambdas, final ExecutionSupport es){\n return _address;\n }\n}\n\""), // Range one("meta::pure::functions::collection::tests::range::testRangeWithStep_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'range_Integer_1__Integer_1__Integer_1__Integer_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), @@ -112,8 +112,15 @@ public class Test_Relational_Snowflake_GrammarFunctions_PCT extends PCTReportCon // Plus (String) one("meta::pure::functions::string::tests::plus::testMultiPlusWithPropertyExpressions_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), one("meta::pure::functions::string::tests::plus::testPlusInCollect_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), - one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\"") - + one("meta::pure::functions::string::tests::plus::testPlusInIterate_Function_1__Boolean_1_", "\"Error mapping not found for class P_Person cache:''\""), + + // Let + one("meta::pure::functions::lang::tests::letFn::testAssignLiteralToVariable_Function_1__Boolean_1_", "\"Cannot cast a collection of size 2 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testAssignNewInstance_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetAsLastStatement_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetChainedWithAnotherFunction_Function_1__Boolean_1_", "\"Cannot cast a collection of size 0 to multiplicity [1]\""), + one("meta::pure::functions::lang::tests::letFn::testLetInsideIf_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\""), + one("meta::pure::functions::lang::tests::letFn::testLetWithParam_Function_1__Boolean_1_", "\"No SQL translation exists for the PURE function 'letFunction_String_1__T_m__T_m_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"") ); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_RelationFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_RelationFunctions_PCT.java index 9dfb92d65f1..624dc6a4efa 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_RelationFunctions_PCT.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_RelationFunctions_PCT.java @@ -36,9 +36,8 @@ public class Test_Relational_Snowflake_RelationFunctions_PCT extends PCTReportCo private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.snowflakeAdapter; private static final String platform = "compiled"; private static final MutableList expectedFailures = Lists.mutable.with( - // BUG: Column name with special characters is not properly escaped one("meta::pure::functions::relation::tests::select::testSingleSelectWithQuotedColumn_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") - ); + ); public static Test suite() { diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_StandardFunctions_PCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_StandardFunctions_PCT.java new file mode 100644 index 00000000000..4a5ea9b4f1f --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/snowflake/pct/Test_Relational_Snowflake_StandardFunctions_PCT.java @@ -0,0 +1,86 @@ +// Copyright 2023 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.finos.legend.engine.plan.execution.stores.relational.test.snowflake.pct; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.finos.legend.engine.plan.execution.stores.relational.connection.tests.api.TestConnectionIntegrationLoader; +import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType; +import org.finos.legend.engine.pure.runtime.testConnection.CoreExternalTestConnectionCodeRepositoryProvider; +import org.finos.legend.engine.test.shared.framework.TestServerResource; +import org.finos.legend.pure.code.core.CoreStandardFunctionsCodeRepositoryProvider; +import org.finos.legend.pure.m3.pct.reports.config.PCTReportConfiguration; +import org.finos.legend.pure.m3.pct.reports.config.exclusion.ExclusionSpecification; +import org.finos.legend.pure.m3.pct.reports.model.Adapter; +import org.finos.legend.pure.m3.pct.shared.model.ReportScope; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.wrapSuite; + +public class Test_Relational_Snowflake_StandardFunctions_PCT extends PCTReportConfiguration +{ + private static final ReportScope reportScope = CoreStandardFunctionsCodeRepositoryProvider.standardFunctions; + private static final Adapter adapter = CoreExternalTestConnectionCodeRepositoryProvider.snowflakeAdapter; + private static final String platform = "compiled"; + private static final MutableList expectedFailures = Lists.mutable.with( + // StD Dev + one("meta::pure::functions::math::tests::stdDev::testFloatStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testIntStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testMixedStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testNegativeNumberStdDev_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::stdDev::testPopulationStandardDeviation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + + // Variance + one("meta::pure::functions::math::tests::variance::testVariancePopulation_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVarianceSample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Population_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\""), + one("meta::pure::functions::math::tests::variance::testVariance_Sample_Function_1__Boolean_1_", "\"Unexpected error executing function with params [Anonymous_Lambda]\"") + ); + + public static Test suite() + { + return wrapSuite( + () -> true, + () -> PureTestBuilderCompiled.buildPCTTestSuite(reportScope, expectedFailures, adapter), + () -> false, + Lists.mutable.with((TestServerResource) TestConnectionIntegrationLoader.extensions().select(c -> c.getDatabaseType() == DatabaseType.Snowflake).getFirst()) + ); + } + + @Override + public MutableList expectedFailures() + { + return expectedFailures; + } + + @Override + public ReportScope getReportScope() + { + return reportScope; + } + + @Override + public Adapter getAdapter() + { + return adapter; + } + + @Override + public String getPlatform() + { + return platform; + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-grammar/pom.xml index ac7c1f8138d..4f8640ecba2 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-grammar/pom.xml @@ -195,8 +195,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/pom.xml index 3498228e5a9..06dbf34cce3 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -97,6 +97,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -155,6 +160,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -198,10 +208,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java @@ -216,7 +222,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -226,6 +232,10 @@ org.finos.legend.engine legend-engine-pure-platform-store-relational-java + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.eclipse.collections @@ -238,8 +248,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake.definition.json index c0aa332c785..cb96a55ff1f 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake.definition.json @@ -1,5 +1,13 @@ { - "name" : "core_relational_snowflake", - "pattern" : "(meta::relational::functions::sqlQueryToString::snowflake|meta::relational::tests::connEquality|meta::relational::tests::sqlQueryToString::snowflake|meta::relational::tests::sqlToString::snowflake|meta::pure::executionPlan::tests::snowflake|meta::relational::tests::projection::snowflake|meta::relational::tests::query::snowflake|meta::relational::tests::tds::snowflake|meta::relational::tests::mapping::function::snowflake|meta::relational::tests::postProcessor::snowflake|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "platform_dsl_mapping", "core_functions", "core", "core_relational"] + "name": "core_relational_snowflake", + "pattern": "(meta::relational::functions::sqlQueryToString::snowflake|meta::relational::tests::connEquality|meta::relational::tests::sqlQueryToString::snowflake|meta::relational::tests::sqlToString::snowflake|meta::pure::executionPlan::tests::snowflake|meta::relational::tests::projection::snowflake|meta::relational::tests::query::snowflake|meta::relational::tests::tds::snowflake|meta::relational::tests::mapping::function::snowflake|meta::relational::tests::postProcessor::snowflake|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "platform_dsl_mapping", + "core_functions_unclassified", + "core_functions_standard", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-grammar/pom.xml index dac5239dce7..11b48f12167 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-grammar/pom.xml @@ -142,8 +142,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/pom.xml index 1abf7b0a61b..ff40fffc6f5 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/pom.xml @@ -36,9 +36,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -163,7 +163,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -173,10 +173,6 @@ org.finos.legend.engine legend-engine-pure-platform-store-relational-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine @@ -199,8 +195,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/src/main/resources/core_relational_spanner.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/src/main/resources/core_relational_spanner.definition.json index 843a701e09e..487bf532001 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/src/main/resources/core_relational_spanner.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-pure/src/main/resources/core_relational_spanner.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::relational::functions::sqlQueryToString::spanner|meta::relational::tests::sqlQueryToString::spanner|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/pom.xml index 99ef564780d..83d3f974a80 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -203,10 +203,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java @@ -217,7 +213,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -239,8 +235,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/src/main/resources/core_relational_sparksql.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/src/main/resources/core_relational_sparksql.definition.json index ed5893f3ad1..1d7bd41b16a 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/src/main/resources/core_relational_sparksql.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sparksql/legend-engine-xt-relationalStore-sparksql-pure/src/main/resources/core_relational_sparksql.definition.json @@ -1,5 +1,12 @@ { - "name" : "core_relational_sparksql", - "pattern" : "(meta::relational::functions::sqlQueryToString::sparkSQL|meta::relational::tests::sqlQueryToString::sparkSQL|meta::relational::tests::sqlToString::sparkSQL|meta::pure::executionPlan::tests::sparkSQL|meta::relational::tests::mapping::sqlFunction::sparkSQL|meta::relational::tests::postProcessor::sparkSQL|meta::relational::tests::query::function::sparkSQL|meta::relational::tests::functions::sqlstring::sparkSQL|meta::relational::tests::tds::sparkSQL|meta::relational::tests::projection::sparkSQL|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "platform_dsl_mapping", "core_functions", "core", "core_relational"] + "name": "core_relational_sparksql", + "pattern": "(meta::relational::functions::sqlQueryToString::sparkSQL|meta::relational::tests::sqlQueryToString::sparkSQL|meta::relational::tests::sqlToString::sparkSQL|meta::pure::executionPlan::tests::sparkSQL|meta::relational::tests::mapping::sqlFunction::sparkSQL|meta::relational::tests::postProcessor::sparkSQL|meta::relational::tests::query::function::sparkSQL|meta::relational::tests::functions::sqlstring::sparkSQL|meta::relational::tests::tds::sparkSQL|meta::relational::tests::projection::sparkSQL|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "platform_dsl_mapping", + "core_functions_unclassified", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/pom.xml index a4675f35f09..5171287edab 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/pom.xml @@ -52,9 +52,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -186,17 +186,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified @@ -220,8 +216,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/src/main/resources/core_relational_sqlserver.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/src/main/resources/core_relational_sqlserver.definition.json index e378a7b32e4..e617a0cf0e5 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/src/main/resources/core_relational_sqlserver.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-pure/src/main/resources/core_relational_sqlserver.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::relational::functions::sqlQueryToString::sqlServer|meta::relational::tests::sqlQueryToString::sqlServer|meta::relational::sqlServer::tests)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/pom.xml index 2d3b4712bb0..e579289d825 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -189,10 +189,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java @@ -207,7 +203,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -229,8 +225,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/src/main/resources/core_relational_sybase.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/src/main/resources/core_relational_sybase.definition.json index ef5997d0d22..ade5c820315 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/src/main/resources/core_relational_sybase.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybase/legend-engine-xt-relationalStore-sybase-pure/src/main/resources/core_relational_sybase.definition.json @@ -1,5 +1,11 @@ { - "name" : "core_relational_sybase", - "pattern" : "(meta::relational::functions::sqlQueryToString::sybaseASE|meta::relational::functions::sqlQueryToString::sybase|meta::pure::alloy::connections::tests::sybase|meta::relational::tests::sqlQueryToString::sybase|meta::pure::executionPlan::tests::sybase|meta::relational::tests::tds::sybase|meta::relational::tests::ddl::sybase|meta::relational::tests::functions::sqlstring::sybase|meta::relational::tests::mapping::sqlFunction::sybase|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", - "dependencies" : ["platform", "platform_functions", "platform_store_relational", "core_functions", "core", "core_relational"] + "name": "core_relational_sybase", + "pattern": "(meta::relational::functions::sqlQueryToString::sybaseASE|meta::relational::functions::sqlQueryToString::sybase|meta::pure::alloy::connections::tests::sybase|meta::relational::tests::sqlQueryToString::sybase|meta::pure::executionPlan::tests::sybase|meta::relational::tests::tds::sybase|meta::relational::tests::ddl::sybase|meta::relational::tests::functions::sqlstring::sybase|meta::relational::tests::mapping::sqlFunction::sybase|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", + "dependencies": [ + "platform", + "platform_store_relational", + "core_functions_unclassified", + "core", + "core_relational" + ] } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/pom.xml index ffaca448bfe..979c19a8e40 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/pom.xml @@ -53,9 +53,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -92,6 +92,12 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + @@ -150,6 +156,12 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + @@ -185,10 +197,6 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-dsl-mapping-java @@ -203,7 +211,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -213,6 +221,10 @@ org.finos.legend.engine legend-engine-pure-platform-store-relational-java + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + org.eclipse.collections @@ -225,8 +237,8 @@ - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/src/main/resources/core_relational_sybaseiq.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/src/main/resources/core_relational_sybaseiq.definition.json index 84b154d68b9..6b3cd5a9d45 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/src/main/resources/core_relational_sybaseiq.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sybaseiq/legend-engine-xt-relationalStore-sybaseiq-pure/src/main/resources/core_relational_sybaseiq.definition.json @@ -3,10 +3,10 @@ "pattern": "(meta::relational::functions::sqlQueryToString::sybaseIQ|meta::relational::tests::sqlQueryToString::sybaseIQ|meta::relational::tests::sqlToString::sybaseIQ|meta::pure::executionPlan::tests::sybaseIQ|meta::relational::tests::mapping::sqlFunction::sybaseIQ|meta::relational::tests::postProcessor::sybaseIQ|meta::relational::tests::query::function::sybaseIQ|meta::relational::tests::functions::sqlstring::sybaseIQ|meta::relational::tests::tds::sybaseIQ|meta::relational::tests::projection::sybaseIQ|meta::pure::alloy::connections|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-grammar/pom.xml index 7bcb422f5fb..b46ce8b748c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-grammar/pom.xml @@ -156,8 +156,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/pom.xml index f51e960c087..8bcdde18b86 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/pom.xml @@ -52,9 +52,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -177,17 +177,13 @@ org.finos.legend.engine legend-engine-pure-code-compiled-core - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified @@ -216,8 +212,8 @@ junit - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/src/main/resources/core_relational_trino.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/src/main/resources/core_relational_trino.definition.json index a5d73f8c88d..4c610055e89 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/src/main/resources/core_relational_trino.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-pure/src/main/resources/core_relational_trino.definition.json @@ -3,9 +3,8 @@ "pattern": "(meta::relational::functions::sqlQueryToString::trino|meta::relational::tests::sqlQueryToString::trino|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-authorizer/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-authorizer/pom.xml index 7312f420b3b..2a892faea0d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-authorizer/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-authorizer/pom.xml @@ -80,9 +80,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/pom.xml index ee3090a4a05..0ae4283f24d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/pom.xml @@ -240,8 +240,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml index 3e872629b35..7f38f3817a8 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml @@ -276,8 +276,8 @@ test - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperRelationalBuilder.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperRelationalBuilder.java index 20dc452ac27..abd4e55b673 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperRelationalBuilder.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperRelationalBuilder.java @@ -167,7 +167,7 @@ import java.util.function.Predicate; import static org.finos.legend.pure.generated.platform_dsl_mapping_functions_PropertyMappingsImplementation.Root_meta_pure_mapping_superMapping_PropertyMappingsImplementation_1__PropertyMappingsImplementation_$0_1$_; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class HelperRelationalBuilder { diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java index 7e3b4b5ac1f..8ae5f91fc90 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/RelationalCompilerExtension.java @@ -792,7 +792,7 @@ public Listorg.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-javaPlatformBinding-pure/src/main/resources/core_relational_java_platform_binding.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-javaPlatformBinding-pure/src/main/resources/core_relational_java_platform_binding.definition.json index 6091b3cb037..19249e72573 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-javaPlatformBinding-pure/src/main/resources/core_relational_java_platform_binding.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-javaPlatformBinding-pure/src/main/resources/core_relational_java_platform_binding.definition.json @@ -3,11 +3,10 @@ "pattern": "(meta::relational::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", "platform_dsl_mapping", "platform_store_relational", - "core_functions", + "core_functions_unclassified", "core", "core_relational", "core_external_language_java", diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml index 1358226a505..b003ba1bd12 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml @@ -68,14 +68,19 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} - org.finos.legend.pure - legend-pure-m2-functions-relation-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} @@ -144,11 +149,15 @@ - org.finos.legend.pure - legend-pure-m2-functions-relation-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} - org.finos.legend.pure legend-pure-m2-dsl-mapping-grammar @@ -201,7 +210,7 @@ - + @@ -240,6 +249,11 @@ org.finos.legend.pure legend-pure-m2-store-relational-pure + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + org.finos.legend.pure @@ -262,8 +276,8 @@ runtime - org.finos.legend.pure - legend-pure-m2-functions-relation-pure + org.finos.legend.engine + legend-engine-pure-functions-relation-pure runtime @@ -283,10 +297,6 @@ org.finos.legend.engine legend-engine-language-pure-dsl-service-pure - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java @@ -297,15 +307,15 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java + legend-engine-pure-runtime-java-extension-compiled-functions-relation org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.engine @@ -326,12 +336,12 @@ legend-pure-runtime-java-extension-compiled-store-relational - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json - + org.finos.legend.engine @@ -387,8 +397,8 @@ test - org.finos.legend.pure - legend-pure-m2-functions-json-pure + org.finos.legend.engine + legend-engine-pure-functions-json-pure test diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational.definition.json index 31bcab51c4d..73d3c99e80a 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational.definition.json @@ -3,16 +3,16 @@ "pattern": "(meta::relational|meta::external::store::relational|meta::pure::mapping|meta::protocols::pure|meta::relational::tests::csv|meta::alloy::service::execution|meta::pure::tds|meta::pure::executionPlan|meta::pure::legend::connections|meta::pure::alloy::connections|meta::external::store::relational::runtime|meta::pure::milestoning|meta::pure::router|meta::alloy::objectReference|meta::pure::lineage|meta::pure::graphFetch)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", "platform_dsl_graph", "platform_dsl_path", "platform_dsl_tds", - "platform_functions_json", - "platform_functions_relation", "platform_store_relational", - "core_functions", + "core_functions_json", + "core_functions_standard", + "core_functions_relation", + "core_functions_unclassified", "core_service", "core" ] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure index 18fa079d44b..f730306e59b 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure @@ -8177,6 +8177,7 @@ function meta::relational::functions::pureToSqlQuery::getSupportedFunctions():Ma ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::cbrt_Number_1__Float_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::mod_Integer_1__Integer_1__Integer_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::rem_Number_1__Number_1__Number_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), + ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::variance_Number_MANY__Boolean_1__Number_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::variancePopulation_Number_MANY__Number_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::varianceSample_Number_MANY__Number_1_, second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::toFloat_Number_1__Float_1_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure index 916d6d09d98..92620cda2aa 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure @@ -1075,6 +1075,7 @@ Enum meta::relational::functions::sqlQueryToString::DynaFunctionRegistry toUpper, today, trim, + variance, variancePopulation, varianceSample, weekOfYear, diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure index 2ad6dd490f5..7113c870089 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure @@ -261,8 +261,9 @@ function meta::relational::functions::sqlQueryToString::default::getDynaFunction dynaFnToSql('toOne', $allStates, ^ToSql(format='%s')), dynaFnToSql('toUpper', $allStates, ^ToSql(format='upper(%s)')), dynaFnToSql('trim', $allStates, ^ToSql(format='trim(%s)')), - dynaFnToSql('varianceSample', $allStates, ^ToSql(format='var_samp(%s)')), - dynaFnToSql('variancePopulation', $allStates, ^ToSql(format='var_pop(%s)')) + dynaFnToSql('variance', $allStates, ^ToSql(format='%s', transform={p:String[*]|if ($p->last() == 'true', | 'var_samp', |'var_pop') + '('+$p->init()->joinStrings('[', ',', ']')+')'})), + dynaFnToSql('varianceSample', $allStates, ^ToSql(format='var_samp(%s)', transform={p:String[*]|if($p->size() == 1, | $p->toOne() , | $p->joinStrings('[', ',', ']'))})), + dynaFnToSql('variancePopulation', $allStates, ^ToSql(format='var_pop(%s)', transform={p:String[*]|if($p->size() == 1, | $p->toOne() , | $p->joinStrings('[', ',', ']'))})) ]; } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/testSuiteCompletenessTests.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/testSuiteCompletenessTests.pure index 50d019225f4..02d98c32b2d 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/testSuiteCompletenessTests.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/testSuiteCompletenessTests.pure @@ -7,7 +7,7 @@ function <> meta::relational::tests::testSuite::ensureEveryDynaFnIsTe meta::relational::tests::dbSpecificTests::sqlQueryTests::selectSubClauses::aggregationDynaFns ]; let testedDynaFnNames = $packagesContainingDynaFnTests.children->filter(c| $c->instanceOf(Package)).name; - let testingIgnoredDynaFnNames = ['add', 'averageRank', 'cbrt', 'case', 'convertDate', 'convertDateTime', 'convertVarchar128', 'decodeBase64', 'denseRank', 'distinct', 'divide', 'encodeBase64', 'exists', 'group', 'if', 'isAlphaNumeric', 'isDistinct', 'isNumeric', 'minus', 'not', 'objectReferenceIn', 'parseDate', 'parseDecimal', 'parseFloat', 'parseInteger', 'parseBoolean','parseJson', 'percentile', 'plus', 'rank', 'rowNumber', 'sub', 'times', 'toOne', 'toString', 'extractFromSemiStructured', 'explodeSemiStructured']; + let testingIgnoredDynaFnNames = ['add', 'averageRank', 'cbrt', 'case', 'convertDate', 'convertDateTime', 'convertVarchar128', 'decodeBase64', 'denseRank', 'distinct', 'divide', 'encodeBase64', 'exists', 'group', 'if', 'isAlphaNumeric', 'isDistinct', 'isNumeric', 'minus', 'not', 'objectReferenceIn', 'parseDate', 'parseDecimal', 'parseFloat', 'parseInteger', 'parseBoolean','parseJson', 'percentile', 'plus', 'rank', 'rowNumber', 'sub', 'times', 'toOne', 'toString', 'extractFromSemiStructured', 'variance', 'explodeSemiStructured']; let incorrectlyMarkedDynaFnNames = $testingIgnoredDynaFnNames->filter(n| $n->in($testedDynaFnNames)); assert($incorrectlyMarkedDynaFnNames->isEmpty(), |'dyna fns ' + $incorrectlyMarkedDynaFnNames->makeString('[', ', ', ']') + ' are incorrectly marked as ignored even though they are tested in sqlQueryToString/testSuite'); let untestedDynaFnNames = $dynaFnNames->filter(d| !$d->in($testedDynaFnNames) && !$d->in($testingIgnoredDynaFnNames)); diff --git a/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/pom.xml b/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/pom.xml index 2846400eb3b..9c8e71b0755 100644 --- a/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/pom.xml +++ b/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/pom.xml @@ -81,6 +81,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -92,7 +97,6 @@ legend-pure-m3-core - com.fasterxml.jackson.core diff --git a/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/src/main/resources/core_external_query_relationalai.definition.json b/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/src/main/resources/core_external_query_relationalai.definition.json index c0d078a76d6..cd8249a05ed 100644 --- a/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/src/main/resources/core_external_query_relationalai.definition.json +++ b/legend-engine-xts-relationalai/legend-engine-xt-relationalai-pure/src/main/resources/core_external_query_relationalai.definition.json @@ -3,15 +3,15 @@ "pattern" : "(meta::external::store::rel)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_store", "platform_dsl_mapping", "platform_dsl_graph", "platform_dsl_path", - "platform_functions_json", + "core_functions_unclassified", + "core_functions_json", + "core_functions_standard", "platform_store_relational", "core", - "core_relational", - "core_functions" + "core_relational" ] } \ No newline at end of file diff --git a/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/pom.xml b/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/pom.xml index 81f86ff6c4a..de88a6262a8 100644 --- a/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/pom.xml +++ b/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/pom.xml @@ -49,9 +49,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.engine @@ -81,6 +81,11 @@ + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + org.finos.legend.engine legend-engine-language-pure-dsl-generation-pure @@ -127,12 +132,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java - - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/src/main/resources/core_external_format_rosetta.definition.json b/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/src/main/resources/core_external_format_rosetta.definition.json index 63b9c3d29b4..b63b46fbf99 100644 --- a/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/src/main/resources/core_external_format_rosetta.definition.json +++ b/legend-engine-xts-rosetta/legend-engine-xt-rosetta-pure/src/main/resources/core_external_format_rosetta.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::external::format::rosetta|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions", + "core_functions_unclassified", "core_generation" ] } \ No newline at end of file diff --git a/legend-engine-xts-rosetta/legend-engine-xt-rosetta/src/main/java/org/finos/legend/engine/external/format/rosetta/model/RosettaGenerationConfig.java b/legend-engine-xts-rosetta/legend-engine-xt-rosetta/src/main/java/org/finos/legend/engine/external/format/rosetta/model/RosettaGenerationConfig.java index 46b0f0d1fcc..12aae73db93 100644 --- a/legend-engine-xts-rosetta/legend-engine-xt-rosetta/src/main/java/org/finos/legend/engine/external/format/rosetta/model/RosettaGenerationConfig.java +++ b/legend-engine-xts-rosetta/legend-engine-xt-rosetta/src/main/java/org/finos/legend/engine/external/format/rosetta/model/RosettaGenerationConfig.java @@ -24,7 +24,7 @@ import java.util.List; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_pathToElement.Root_meta_pure_functions_meta_pathToElement_String_1__PackageableElement_1_; public class RosettaGenerationConfig extends GenerationConfiguration { diff --git a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-execution/src/test/java/org/finos/legend/engine/language/pure/dsl/service/execution/TestServiceRunner.java b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-execution/src/test/java/org/finos/legend/engine/language/pure/dsl/service/execution/TestServiceRunner.java index 6f255e01727..05cac3598f7 100644 --- a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-execution/src/test/java/org/finos/legend/engine/language/pure/dsl/service/execution/TestServiceRunner.java +++ b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-execution/src/test/java/org/finos/legend/engine/language/pure/dsl/service/execution/TestServiceRunner.java @@ -407,7 +407,7 @@ public void SimpleM2MServiceRunnerForDateTimeSerialization() this.testServiceExecutionWithDateTimeSerialization("test::serializeDateTimeCustomPattern__String_1_", "{\"birthDate\":\"12/27/2014 at 03:01PM GMT\"}"); RuntimeException e1 = Assert.assertThrows(RuntimeException.class, () -> new SimpleM2MServiceRunnerForDateTimeSerialization("test::serializeInvalidDateTimeFormat__String_1_")); - Assert.assertEquals("Assert failure at (resource:/platform/pure/basics/tests/assert.pure line:26 column:5), \"yyyy-MM-dd\"T\"HH:mmm:ss.SSSZ is not a valid dateTime format in SerializationConfig\"", e1.getMessage()); + Assert.assertEquals("Assert failure at (resource:/platform/pure/essential/tests/assert.pure line:26 column:5), \"yyyy-MM-dd\"T\"HH:mmm:ss.SSSZ is not a valid dateTime format in SerializationConfig\"", e1.getMessage()); } private static class SimpleM2MServiceRunnerForVarConflict extends AbstractServicePlanExecutor diff --git a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/pom.xml b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/pom.xml index 59fae2d5f4f..0a5fde02d7f 100644 --- a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/pom.xml +++ b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/pom.xml @@ -52,20 +52,15 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure legend-pure-m2-dsl-diagram-grammar ${legend.pure.version} - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - org.finos.legend.engine legend-engine-pure-code-compiled-core @@ -100,9 +95,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -116,12 +111,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions - ${project.version} - - - org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} @@ -172,7 +162,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -182,10 +172,6 @@ org.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-pure-platform-dsl-store-java diff --git a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/src/main/resources/core_service.definition.json b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/src/main/resources/core_service.definition.json index 1087fa32c67..0bbee9979f4 100644 --- a/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/src/main/resources/core_service.definition.json +++ b/legend-engine-xts-service/legend-engine-language-pure-dsl-service-pure/src/main/resources/core_service.definition.json @@ -3,11 +3,10 @@ "pattern": "(meta::legend::service|meta::pure::mapping)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_diagram", "platform_dsl_mapping", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", "core_data_space_metamodel", "core" ] diff --git a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperServiceStoreClassMappingBuilder.java b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperServiceStoreClassMappingBuilder.java index 0c337e7d376..16635dc5cbd 100644 --- a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperServiceStoreClassMappingBuilder.java +++ b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-grammar/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperServiceStoreClassMappingBuilder.java @@ -91,7 +91,7 @@ import java.util.Set; import static org.finos.legend.engine.language.pure.compiler.toPureGraph.HelperModelBuilder.getElementFullPath; -import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; +import static org.finos.legend.pure.generated.platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_; public class HelperServiceStoreClassMappingBuilder { diff --git a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/pom.xml index d0a14a39522..072e080515a 100644 --- a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/pom.xml @@ -222,10 +222,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-serviceStore-pure diff --git a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/src/main/resources/core_servicestore_java_platform_binding.definition.json b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/src/main/resources/core_servicestore_java_platform_binding.definition.json index 14e0941d263..b505d639737 100644 --- a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/src/main/resources/core_servicestore_java_platform_binding.definition.json +++ b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-javaPlatformBinding-pure/src/main/resources/core_servicestore_java_platform_binding.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::external::store::service::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "core", "core_external_format_json", diff --git a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/pom.xml b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/pom.xml index 93da9dbd07b..22291e2dc5b 100644 --- a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/pom.xml +++ b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/pom.xml @@ -39,7 +39,7 @@ org.finos.legend.pure:legend-pure-runtime-java-extension-compiled-store-relational - org.finos.legend.pure:legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.pure:legend-engine-pure-runtime-java-extension-compiled-functions-json org.finos.legend.pure:legend-pure-runtime-java-extension-compiled-dsl-store org.finos.legend.engine:legend-engine-pure-platform-dsl-store-java @@ -70,9 +70,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} org.finos.legend.pure @@ -218,17 +218,13 @@ org.finos.legend.engine legend-engine-pure-code-core-extension - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine @@ -254,10 +250,6 @@ - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - org.finos.legend.pure legend-pure-runtime-java-extension-compiled-store-relational diff --git a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/src/main/resources/core_servicestore.definition.json b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/src/main/resources/core_servicestore.definition.json index b678fd3285d..7e194e4b0f9 100644 --- a/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/src/main/resources/core_servicestore.definition.json +++ b/legend-engine-xts-serviceStore/legend-engine-xt-serviceStore-pure/src/main/resources/core_servicestore.definition.json @@ -3,12 +3,11 @@ "pattern": "(meta::external::store::service|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_graph", "platform_dsl_path", "platform_dsl_mapping", "platform_dsl_store", - "core_functions", + "core_functions_unclassified", "core", "core_external_format_json", "core_authentication" diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-generator/src/main/java/org/finos/legend/engine/language/snowflakeApp/generator/SnowflakeAppGenerator.java b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-generator/src/main/java/org/finos/legend/engine/language/snowflakeApp/generator/SnowflakeAppGenerator.java index 244d3eaa3de..b119d475a7d 100644 --- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-generator/src/main/java/org/finos/legend/engine/language/snowflakeApp/generator/SnowflakeAppGenerator.java +++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-generator/src/main/java/org/finos/legend/engine/language/snowflakeApp/generator/SnowflakeAppGenerator.java @@ -65,7 +65,7 @@ public static SnowflakeAppArtifact generateArtifact(PureModel pureModel, Root_me { //identify connection SnowflakeApp protocolActivator = Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(SnowflakeApp.class)) - .select(c -> c.getPath().equals(platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) + .select(c -> c.getPath().equals(platform_pure_essential_meta_graph_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_(activator, pureModel.getExecutionSupport()))) .getFirst(); connection = (RelationalDatabaseConnection) Lists.mutable.withAll(((PureModelContextData) inputModel).getElementsOfType(PackageableConnection.class)) .select(c -> c.getPath().equals(((org.finos.legend.engine.protocol.snowflakeApp.metamodel.SnowflakeAppDeploymentConfiguration)protocolActivator.activationConfiguration).activationConnection.connection)).getFirst().connectionValue; diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/pom.xml b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/pom.xml index 27645306524..44c8297e7cc 100644 --- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/pom.xml +++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/pom.xml @@ -59,7 +59,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -102,7 +102,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -174,11 +174,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions - - - org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/src/main/resources/core_snowflakeapp.definition.json b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/src/main/resources/core_snowflakeapp.definition.json index fd2d1dc5c03..2cadb3ff042 100644 --- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/src/main/resources/core_snowflakeapp.definition.json +++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-pure/src/main/resources/core_snowflakeapp.definition.json @@ -7,12 +7,11 @@ "platform_dsl_graph", "platform_dsl_store", "platform_store_relational", - "platform_functions", - "platform_functions_json", + "core_functions_json", + "core_functions_unclassified", "core_relational", "core_analytics_lineage", "core_function_activator", - "core_functions", "core_relational" ] } \ No newline at end of file diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/pom.xml index cd1c6a8d7b3..6bd4fd3d483 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/pom.xml @@ -66,6 +66,11 @@ legend-pure-m2-dsl-graph-grammar ${legend.pure.version} + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + @@ -104,6 +109,11 @@ legend-pure-m2-dsl-graph-grammar ${legend.pure.version} + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/src/main/resources/core_external_query_sql_metamodel.definition.json b/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/src/main/resources/core_external_query_sql_metamodel.definition.json index 74f8f40bd6a..05f094e8337 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/src/main/resources/core_external_query_sql_metamodel.definition.json +++ b/legend-engine-xts-sql/legend-engine-xt-sql-pure-metamodel/src/main/resources/core_external_query_sql_metamodel.definition.json @@ -3,6 +3,6 @@ "pattern": "(meta::external::query::sql)(::.*)?", "dependencies": [ "platform", - "platform_functions" + "core_functions_unclassified" ] } \ No newline at end of file diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml index a48665bc834..c9030e7b3aa 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml @@ -35,10 +35,6 @@ src/main/resources ${legend.pure.version} - platform - core - core_external_compiler - core_external_query_sql_metamodel core_external_query_sql @@ -101,6 +97,11 @@ legend-engine-xt-relationalStore-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -184,6 +185,11 @@ legend-engine-pure-runtime-java-extension-compiled-functions-legendCompiler ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + @@ -217,6 +223,11 @@ legend-pure-runtime-java-engine-compiled + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + org.finos.legend.engine @@ -231,10 +242,6 @@ org.finos.legend.engine legend-engine-language-pure-dsl-service-pure - - org.finos.legend.engine - legend-engine-pure-code-compiled-functions - org.finos.legend.engine legend-engine-pure-platform-java @@ -270,7 +277,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-pure/src/main/resources/core_external_query_sql.definition.json b/legend-engine-xts-sql/legend-engine-xt-sql-pure/src/main/resources/core_external_query_sql.definition.json index 37ca03f240d..55a1615498a 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-pure/src/main/resources/core_external_query_sql.definition.json +++ b/legend-engine-xts-sql/legend-engine-xt-sql-pure/src/main/resources/core_external_query_sql.definition.json @@ -3,11 +3,11 @@ "pattern": "(meta::external::query::sql)(::.*)?", "dependencies": [ "platform", - "platform_functions", "platform_dsl_mapping", "platform_dsl_store", "platform_store_relational", - "core_functions", + "core_functions_unclassified", + "core_functions_standard", "core", "core_service", "core_relational", diff --git a/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/pom.xml b/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/pom.xml index 53729b57ea4..3792cf39018 100644 --- a/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/pom.xml +++ b/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/pom.xml @@ -201,10 +201,6 @@ org.finos.legend.engine legend-engine-pure-platform-java - - org.finos.legend.engine - legend-engine-pure-platform-functions-java - org.finos.legend.engine legend-engine-xt-xml-pure diff --git a/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/src/main/resources/core_external_format_xml_java_platform_binding.definition.json b/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/src/main/resources/core_external_format_xml_java_platform_binding.definition.json index 30e2354bd9a..f8a9699ebac 100644 --- a/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/src/main/resources/core_external_format_xml_java_platform_binding.definition.json +++ b/legend-engine-xts-xml/legend-engine-xt-xml-javaPlatformBinding-pure/src/main/resources/core_external_format_xml_java_platform_binding.definition.json @@ -3,7 +3,6 @@ "pattern": "(meta::external::format::xml::executionPlan::platformBinding::legendJava)(::.*)?", "dependencies": [ "platform", - "platform_functions", "core", "core_external_format_xml", "core_external_language_java", diff --git a/legend-engine-xts-xml/legend-engine-xt-xml-model/pom.xml b/legend-engine-xts-xml/legend-engine-xt-xml-model/pom.xml index ea35ba2c2e4..d286e1861db 100644 --- a/legend-engine-xts-xml/legend-engine-xt-xml-model/pom.xml +++ b/legend-engine-xts-xml/legend-engine-xt-xml-model/pom.xml @@ -63,8 +63,8 @@ - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json runtime diff --git a/legend-engine-xts-xml/legend-engine-xt-xml-pure/pom.xml b/legend-engine-xts-xml/legend-engine-xt-xml-pure/pom.xml index 97296345992..850874963e1 100644 --- a/legend-engine-xts-xml/legend-engine-xt-xml-pure/pom.xml +++ b/legend-engine-xts-xml/legend-engine-xt-xml-pure/pom.xml @@ -70,9 +70,9 @@ - org.finos.legend.pure - legend-pure-m2-functions-base-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} @@ -179,7 +179,7 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified org.finos.legend.engine diff --git a/legend-engine-xts-xml/legend-engine-xt-xml-pure/src/main/resources/core_external_format_xml.definition.json b/legend-engine-xts-xml/legend-engine-xt-xml-pure/src/main/resources/core_external_format_xml.definition.json index 4b4f802560a..517f66abce1 100644 --- a/legend-engine-xts-xml/legend-engine-xt-xml-pure/src/main/resources/core_external_format_xml.definition.json +++ b/legend-engine-xts-xml/legend-engine-xt-xml-pure/src/main/resources/core_external_format_xml.definition.json @@ -3,8 +3,7 @@ "pattern": "(meta::external::format::xml|meta::protocols::pure)(::.*)?", "dependencies": [ "platform", - "platform_functions", - "core_functions", + "core_functions_unclassified", "core" ] } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 261273bffe4..8c2d37714ad 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ - 5.9.0 + 5.10.0 0.25.4 @@ -134,7 +134,7 @@ [11.0.10,12) 3.6.2 1680115922 - -XX:-MaxFDLimit -XX:SoftRefLRUPolicyMSPerMB=1 + -XX:-MaxFDLimit -XX:SoftRefLRUPolicyMSPerMB=1 -Duser.timezone=GMT @@ -973,6 +973,55 @@ ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-relation-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-relation + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-relation + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relation + ${project.version} + + + + org.finos.legend.engine + legend-engine-pure-functions-standard-pure + ${project.version} + + + + org.finos.legend.engine + legend-engine-pure-functions-unclassified-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-unclassified + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} + + + org.finos.legend.engine legend-engine-pure-runtime-java-extension-compiled-functions-javaCompiler @@ -1104,14 +1153,9 @@ ${project.version} - - org.finos.legend.engine - legend-engine-pure-platform-functions-relation-java - ${project.version} - - + @@ -2075,6 +2119,11 @@ legend-engine-shared-core ${project.version} + + org.finos.legend.engine + legend-engine-shared-structures + ${project.version} + org.finos.legend.engine legend-engine-shared-vault-core @@ -2333,22 +2382,22 @@ org.finos.legend.engine - legend-engine-pure-platform-functions-java + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-base - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-base + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-unclassified ${legend.pure.version} org.finos.legend.engine - legend-engine-pure-platform-functions-json-java + legend-engine-pure-runtime-java-extension-compiled-functions-json ${project.version} @@ -2362,14 +2411,14 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-conversion - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-conversion + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-shared-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-shared-functions-json + ${project.version} org.finos.legend.engine @@ -2383,7 +2432,7 @@ org.finos.legend.engine - legend-engine-pure-code-compiled-functions + legend-engine-pure-functions-unclassified-pure ${project.version} @@ -2677,6 +2726,19 @@ legend-pure-runtime-java-engine-shared ${legend.pure.version} + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + test-jar + ${legend.pure.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + test-jar + ${project.version} + + org.finos.legend.pure legend-pure-runtime-java-engine-compiled @@ -2730,14 +2792,14 @@ ${legend.pure.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json + ${project.version} - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-json - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-json + ${project.version} org.finos.legend.pure @@ -2784,26 +2846,11 @@ legend-pure-m2-dsl-tds-grammar ${legend.pure.version} - - org.finos.legend.pure - legend-pure-m2-functions-relation-pure - ${legend.pure.version} - - - org.finos.legend.pure - legend-pure-runtime-java-extension-interpreted-functions-relation - ${legend.pure.version} - org.finos.legend.pure legend-pure-runtime-java-extension-interpreted-dsl-tds ${legend.pure.version} - - org.finos.legend.pure - legend-pure-runtime-java-extension-compiled-functions-relation - ${legend.pure.version} - @@ -2816,12 +2863,12 @@ - + - + @@ -2906,13 +2953,13 @@ org.finos.legend.pure - legend-pure-m2-functions-base-pure + legend-engine-pure-functions-unclassified-pure ${legend.pure.version} - org.finos.legend.pure - legend-pure-m2-functions-json-pure - ${legend.pure.version} + org.finos.legend.engine + legend-engine-pure-functions-json-pure + ${project.version} org.finos.legend.pure