@comunica/actor-optimize-query-operation-leftjoin-expression-pushdown 5.1.3 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,17 +26,13 @@ class ActorOptimizeQueryOperationLeftjoinExpressionPushdown extends bus_optimize
26
26
  operation = utils_algebra_1.algebraUtils.mapOperation(operation, {
27
27
  [utils_algebra_1.Algebra.Types.LEFT_JOIN]: {
28
28
  transform: (op) => {
29
- // Try to push the expression to either the left or right if it exclusively overlaps with just one of them.
29
+ // Try to push the expression to the right if it exclusively overlaps with that one.
30
30
  if (op.expression) {
31
31
  const variablesExpression = (0, utils_query_operation_1.getExpressionVariables)(op.expression);
32
32
  const variablesLeft = utils_algebra_1.algebraUtils.inScopeVariables(op.input[0]);
33
33
  const variablesRight = utils_algebra_1.algebraUtils.inScopeVariables(op.input[1]);
34
34
  const intersectLeft = self.variablesIntersect(variablesExpression, variablesLeft);
35
35
  const intersectRight = self.variablesIntersect(variablesExpression, variablesRight);
36
- if (intersectLeft && !intersectRight) {
37
- self.logDebug(action.context, `Pushed down optional expression to left-hand operator`);
38
- return algebraFactory.createLeftJoin(algebraFactory.createFilter(op.input[0], op.expression), op.input[1]);
39
- }
40
36
  if (!intersectLeft && intersectRight) {
41
37
  self.logDebug(action.context, `Pushed down optional expression to right-hand operator`);
42
38
  return algebraFactory.createLeftJoin(op.input[0], algebraFactory.createFilter(op.input[1], op.expression));
@@ -1 +1 @@
1
- {"version":3,"file":"ActorOptimizeQueryOperationLeftjoinExpressionPushdown.js","sourceRoot":"","sources":["ActorOptimizeQueryOperationLeftjoinExpressionPushdown.ts"],"names":[],"mappings":";;;AAKA,yFAAqF;AACrF,+DAA0D;AAE1D,yCAA8C;AAE9C,2DAAgF;AAChF,2EAAyE;AAGzE;;GAEG;AACH,MAAa,qDAAsD,SAAQ,0DAA2B;IACpG,YAAmB,IAAsC;QACvD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd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cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,EACvD,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CACZ,CAAC;wBACJ,CAAC;wBACD,IAAI,CAAC,aAAa,IAAI,cAAc,EAAE,CAAC;4BACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,wDAAwD,CAAC,CAAC;4BACxF,OAAO,cAAc,CAAC,cAAc,CAClC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACX,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CACxD,CAAC;wBACJ,CAAC;oBACH,CAAC;oBAED,OAAO,EAAE,CAAC;gBACZ,CAAC;aACF;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,KAAqB,EAAE,KAAqB;QACpE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AA3DD,sHA2DC","sourcesContent":["import type {\n IActionOptimizeQueryOperation,\n IActorOptimizeQueryOperationOutput,\n IActorOptimizeQueryOperationArgs,\n} from '@comunica/bus-optimize-query-operation';\nimport { ActorOptimizeQueryOperation } from '@comunica/bus-optimize-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { TestResult, IActorTest } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { ComunicaDataFactory } from '@comunica/types';\nimport { Algebra, AlgebraFactory, algebraUtils } from '@comunica/utils-algebra';\nimport { getExpressionVariables } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\n\n/**\n * A comunica LeftJoin Expression Pushdown Optimize Query Operation Actor.\n */\nexport class ActorOptimizeQueryOperationLeftjoinExpressionPushdown extends ActorOptimizeQueryOperation {\n public constructor(args: IActorOptimizeQueryOperationArgs) {\n super(args);\n }\n\n public async test(_action: IActionOptimizeQueryOperation): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async run(action: IActionOptimizeQueryOperation): Promise<IActorOptimizeQueryOperationOutput> {\n const dataFactory: ComunicaDataFactory = action.context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new AlgebraFactory(dataFactory);\n let operation: Algebra.Operation = action.operation;\n\n // eslint-disable-next-line ts/no-this-alias\n const self = this;\n // TODO: pass algebraFactory when traqula supports this.\n operation = algebraUtils.mapOperation(operation, {\n [Algebra.Types.LEFT_JOIN]: {\n transform: (op: Algebra.LeftJoin) => {\n // Try to push the expression to either the left or right if it exclusively overlaps with just one of them.\n if (op.expression) {\n const variablesExpression = getExpressionVariables(op.expression);\n const variablesLeft = algebraUtils.inScopeVariables(op.input[0]);\n const variablesRight = algebraUtils.inScopeVariables(op.input[1]);\n const intersectLeft = self.variablesIntersect(variablesExpression, variablesLeft);\n const intersectRight = self.variablesIntersect(variablesExpression, variablesRight);\n if (intersectLeft && !intersectRight) {\n self.logDebug(action.context, `Pushed down optional expression to left-hand operator`);\n return algebraFactory.createLeftJoin(\n algebraFactory.createFilter(op.input[0], op.expression),\n op.input[1],\n );\n }\n if (!intersectLeft && intersectRight) {\n self.logDebug(action.context, `Pushed down optional expression to right-hand operator`);\n return algebraFactory.createLeftJoin(\n op.input[0],\n algebraFactory.createFilter(op.input[1], op.expression),\n );\n }\n }\n\n return op;\n },\n },\n });\n\n return { operation, context: action.context };\n }\n\n /**\n * Check if there is an overlap between the two given lists of variables.\n * @param varsA A list of variables.\n * @param varsB A list of variables.\n */\n public variablesIntersect(varsA: RDF.Variable[], varsB: RDF.Variable[]): boolean {\n return varsA.some(varA => varsB.some(varB => varA.equals(varB)));\n }\n}\n"]}
1
+ {"version":3,"file":"ActorOptimizeQueryOperationLeftjoinExpressionPushdown.js","sourceRoot":"","sources":["ActorOptimizeQueryOperationLeftjoinExpressionPushdown.ts"],"names":[],"mappings":";;;AAKA,yFAAqF;AACrF,+DAA0D;AAE1D,yCAA8C;AAE9C,2DAAgF;AAChF,2EAAyE;AAGzE;;GAEG;AACH,MAAa,qDAAsD,SAAQ,0DAA2B;IACpG,YAAmB,IAAsC;QACvD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAsC;QACtD,OAAO,IAAA,mBAAY,GAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAAqC;QACpD,MAAM,WAAW,GAAwB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC;QAC3F,MAAM,cAAc,GAAG,IAAI,8BAAc,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,SAAS,GAAsB,MAAM,CAAC,SAAS,CAAC;QAEpD,4CAA4C;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,wDAAwD;QACxD,SAAS,GAAG,4BAAY,CAAC,YAAY,CAAC,SAAS,EAAE;YAC/C,CAAC,uBAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;gBACzB,SAAS,EAAE,CAAC,EAAoB,EAAE,EAAE;oBAClC,oFAAoF;oBACpF,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;wBAClB,MAAM,mBAAmB,GAAG,IAAA,8CAAsB,EAAC,EAAE,CAAC,UAAU,CAAC,CAAC;wBAClE,MAAM,aAAa,GAAG,4BAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjE,MAAM,cAAc,GAAG,4BAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClE,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;wBAClF,MAAM,cAAc,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;wBACpF,IAAI,CAAC,aAAa,IAAI,cAAc,EAAE,CAAC;4BACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,wDAAwD,CAAC,CAAC;4BACxF,OAAO,cAAc,CAAC,cAAc,CAClC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACX,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CACxD,CAAC;wBACJ,CAAC;oBACH,CAAC;oBAED,OAAO,EAAE,CAAC;gBACZ,CAAC;aACF;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,KAAqB,EAAE,KAAqB;QACpE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AApDD,sHAoDC","sourcesContent":["import type {\n IActionOptimizeQueryOperation,\n IActorOptimizeQueryOperationOutput,\n IActorOptimizeQueryOperationArgs,\n} from '@comunica/bus-optimize-query-operation';\nimport { ActorOptimizeQueryOperation } from '@comunica/bus-optimize-query-operation';\nimport { KeysInitQuery } from '@comunica/context-entries';\nimport type { TestResult, IActorTest } from '@comunica/core';\nimport { passTestVoid } from '@comunica/core';\nimport type { ComunicaDataFactory } from '@comunica/types';\nimport { Algebra, AlgebraFactory, algebraUtils } from '@comunica/utils-algebra';\nimport { getExpressionVariables } from '@comunica/utils-query-operation';\nimport type * as RDF from '@rdfjs/types';\n\n/**\n * A comunica LeftJoin Expression Pushdown Optimize Query Operation Actor.\n */\nexport class ActorOptimizeQueryOperationLeftjoinExpressionPushdown extends ActorOptimizeQueryOperation {\n public constructor(args: IActorOptimizeQueryOperationArgs) {\n super(args);\n }\n\n public async test(_action: IActionOptimizeQueryOperation): Promise<TestResult<IActorTest>> {\n return passTestVoid();\n }\n\n public async run(action: IActionOptimizeQueryOperation): Promise<IActorOptimizeQueryOperationOutput> {\n const dataFactory: ComunicaDataFactory = action.context.getSafe(KeysInitQuery.dataFactory);\n const algebraFactory = new AlgebraFactory(dataFactory);\n let operation: Algebra.Operation = action.operation;\n\n // eslint-disable-next-line ts/no-this-alias\n const self = this;\n // TODO: pass algebraFactory when traqula supports this.\n operation = algebraUtils.mapOperation(operation, {\n [Algebra.Types.LEFT_JOIN]: {\n transform: (op: Algebra.LeftJoin) => {\n // Try to push the expression to the right if it exclusively overlaps with that one.\n if (op.expression) {\n const variablesExpression = getExpressionVariables(op.expression);\n const variablesLeft = algebraUtils.inScopeVariables(op.input[0]);\n const variablesRight = algebraUtils.inScopeVariables(op.input[1]);\n const intersectLeft = self.variablesIntersect(variablesExpression, variablesLeft);\n const intersectRight = self.variablesIntersect(variablesExpression, variablesRight);\n if (!intersectLeft && intersectRight) {\n self.logDebug(action.context, `Pushed down optional expression to right-hand operator`);\n return algebraFactory.createLeftJoin(\n op.input[0],\n algebraFactory.createFilter(op.input[1], op.expression),\n );\n }\n }\n\n return op;\n },\n },\n });\n\n return { operation, context: action.context };\n }\n\n /**\n * Check if there is an overlap between the two given lists of variables.\n * @param varsA A list of variables.\n * @param varsB A list of variables.\n */\n public variablesIntersect(varsA: RDF.Variable[], varsB: RDF.Variable[]): boolean {\n return varsA.some(varA => varsB.some(varB => varA.equals(varB)));\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-optimize-query-operation-leftjoin-expression-pushdown",
3
- "version": "5.1.3",
3
+ "version": "5.2.0",
4
4
  "description": "A leftjoin-expression-pushdown optimize-query-operation actor",
5
5
  "lsd:module": true,
6
6
  "license": "MIT",
@@ -41,13 +41,13 @@
41
41
  "build:components": "componentsjs-generator"
42
42
  },
43
43
  "dependencies": {
44
- "@comunica/bus-optimize-query-operation": "^5.1.3",
45
- "@comunica/context-entries": "^5.1.3",
46
- "@comunica/core": "^5.1.3",
47
- "@comunica/types": "^5.1.3",
48
- "@comunica/utils-algebra": "^5.1.3",
49
- "@comunica/utils-query-operation": "^5.1.3",
44
+ "@comunica/bus-optimize-query-operation": "^5.2.0",
45
+ "@comunica/context-entries": "^5.2.0",
46
+ "@comunica/core": "^5.2.0",
47
+ "@comunica/types": "^5.2.0",
48
+ "@comunica/utils-algebra": "^5.2.0",
49
+ "@comunica/utils-query-operation": "^5.2.0",
50
50
  "@rdfjs/types": "*"
51
51
  },
52
- "gitHead": "8740a36019a375fd2ba27e799c52d63eb5cacc24"
52
+ "gitHead": "ebb0e79bddcd850fcb8d0fb5b422af88e67fa283"
53
53
  }