@milaboratories/pl-model-common 1.19.18 → 1.20.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.
@@ -1 +1 @@
1
- {"version":3,"file":"base64.cjs","sources":["../src/base64.ts"],"sourcesContent":["export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":";;AAMM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;;"}
1
+ {"version":3,"file":"base64.cjs","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from 'node:buffer';\n\nexport type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":";;AAQM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;;"}
package/dist/base64.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { WithImplicitCoercion } from 'node:buffer';
1
2
  export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
2
3
  export type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {
3
4
  __base64_encoded: T;
@@ -1 +1 @@
1
- {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,UAAU,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEtH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG;IAC5F,gBAAgB,EAAE,CAAC,CAAC;CACrB,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAEzE"}
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,UAAU,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEtH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG;IAC5F,gBAAgB,EAAE,CAAC,CAAC;CACrB,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"base64.js","sources":["../src/base64.ts"],"sourcesContent":["export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":"AAMM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;"}
1
+ {"version":3,"file":"base64.js","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from 'node:buffer';\n\nexport type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":"AAQM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;"}
@@ -19,6 +19,13 @@ function mapJoinEntry(entry, cb) {
19
19
  newId: entry.newId,
20
20
  axisFilters: entry.axisFilters,
21
21
  };
22
+ case 'artificialColumn':
23
+ return {
24
+ type: 'artificialColumn',
25
+ column: cb(entry.column),
26
+ newId: entry.newId,
27
+ axesIndices: entry.axesIndices,
28
+ };
22
29
  case 'inlineColumn':
23
30
  return entry;
24
31
  case 'inner':
@@ -1 +1 @@
1
- {"version":3,"file":"table_calculate.cjs","sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n"],"names":["assertNever"],"mappings":";;;;AAuXM,SAAU,YAAY,CAC1B,GAAkB,EAClB,EAAiB,EAAA;AAEjB,IAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;AACnD;AAEM,SAAU,YAAY,CAC1B,KAAoB,EACpB,EAAiB,EAAA;AAEjB,IAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,QAAA,KAAK,QAAQ;YACX,OAAO;AACL,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;aACzB;AACH,QAAA,KAAK,cAAc;YACjB,OAAO;AACL,gBAAA,IAAI,EAAE,cAAc;AACpB,gBAAA,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B;AACH,QAAA,KAAK,cAAc;AACjB,YAAA,OAAO,KAAK;AACd,QAAA,KAAK,OAAO;AACZ,QAAA,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI;AAChB,gBAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;aAC3D;AACH,QAAA,KAAK,OAAO;YACV,OAAO;AACL,gBAAA,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AACxC,gBAAA,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;aAC/D;AACH,QAAA;YACEA,gBAAW,CAAC,KAAK,CAAC;;AAExB;;;;;"}
1
+ {"version":3,"file":"table_calculate.cjs","sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\nexport interface ArtificialColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'artificialColumn';\n\n /** Column definition */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Indices of axes to pick from the column (zero-based) */\n readonly axesIndices: number[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | ArtificialColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'artificialColumn':\n return {\n type: 'artificialColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axesIndices: entry.axesIndices,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n"],"names":["assertNever"],"mappings":";;;;AAsYM,SAAU,YAAY,CAC1B,GAAkB,EAClB,EAAiB,EAAA;AAEjB,IAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,EA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C/D;AACH,QAAA;YACEA,gBAAW,CAAC,KAAK,CAAC;;AAExB;;;;;"}
@@ -33,6 +33,16 @@ export interface SlicedColumnJoinEntry<Col> {
33
33
  /** Non-empty list of axis filters */
34
34
  readonly axisFilters: ConstantAxisFilter[];
35
35
  }
36
+ export interface ArtificialColumnJoinEntry<Col> {
37
+ /** Node type discriminator */
38
+ readonly type: 'artificialColumn';
39
+ /** Column definition */
40
+ readonly column: Col;
41
+ /** New column id */
42
+ readonly newId: PObjectId;
43
+ /** Indices of axes to pick from the column (zero-based) */
44
+ readonly axesIndices: number[];
45
+ }
36
46
  /** Defines a terminal column node in the join request tree */
37
47
  export interface InlineColumnJoinEntry {
38
48
  /** Node type discriminator */
@@ -88,7 +98,7 @@ export interface OuterJoin<Col> {
88
98
  * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
89
99
  * from the columns axes spec.
90
100
  * */
91
- export type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
101
+ export type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
92
102
  /** Container representing whole data stored in specific PTable column. */
93
103
  export interface FullPTableColumnData {
94
104
  /** Unified spec */
@@ -1 +1 @@
1
- {"version":3,"file":"table_calculate.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/table_calculate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EA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AAS,CAAC,GAAG,CAAC,CAAC;IAE7B,qBAAqB;IACrB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAEvC,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;CACnC,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,EAAE,CAAC;AAEhE,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,EACjC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,EAClB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,SAAS,CAAC,EAAE,CAAC,CAEf;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,EACjC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,EACpB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,SAAS,CAAC,EAAE,CAAC,CAsCf"}
@@ -17,6 +17,13 @@ function mapJoinEntry(entry, cb) {
17
17
  newId: entry.newId,
18
18
  axisFilters: entry.axisFilters,
19
19
  };
20
+ case 'artificialColumn':
21
+ return {
22
+ type: 'artificialColumn',
23
+ column: cb(entry.column),
24
+ newId: entry.newId,
25
+ axesIndices: entry.axesIndices,
26
+ };
20
27
  case 'inlineColumn':
21
28
  return entry;
22
29
  case 'inner':
@@ -1 +1 @@
1
- {"version":3,"file":"table_calculate.js","sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n"],"names":[],"mappings":";;AAuXM,SAAU,YAAY,CAC1B,GAAkB,EAClB,EAAiB,EAAA;AAEjB,IAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;AACnD;AAEM,SAAU,YAAY,CAC1B,KAAoB,EACpB,EAAiB,EAAA;AAEjB,IAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,QAAA,KAAK,QAAQ;YACX,OAAO;AACL,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;aACzB;AACH,QAAA,KAAK,cAAc;YACjB,OAAO;AACL,gBAAA,IAAI,EAAE,cAAc;AACpB,gBAAA,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;gBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B;AACH,QAAA,KAAK,cAAc;AACjB,YAAA,OAAO,KAAK;AACd,QAAA,KAAK,OAAO;AACZ,QAAA,KAAK,MAAM;YACT,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI;AAChB,gBAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;aAC3D;AACH,QAAA,KAAK,OAAO;YACV,OAAO;AACL,gBAAA,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AACxC,gBAAA,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;aAC/D;AACH,QAAA;YACE,WAAW,CAAC,KAAK,CAAC;;AAExB;;;;"}
1
+ {"version":3,"file":"table_calculate.js","sources":["../../../src/drivers/pframe/table_calculate.ts"],"sourcesContent":["import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\nexport interface ArtificialColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'artificialColumn';\n\n /** Column definition */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Indices of axes to pick from the column (zero-based) */\n readonly axesIndices: number[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | ArtificialColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'artificialColumn':\n return {\n type: 'artificialColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axesIndices: entry.axesIndices,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n"],"names":[],"mappings":";;AAsYM,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AAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;aAC/D;AACH,QAAA;YACE,WAAW,CAAC,KAAK,CAAC;;AAExB;;;;"}
@@ -37,6 +37,9 @@ function extractAllColumns(entry) {
37
37
  case 'slicedColumn':
38
38
  columns.set(entry.column.id, entry.column);
39
39
  return;
40
+ case 'artificialColumn':
41
+ columns.set(entry.column.id, entry.column);
42
+ return;
40
43
  case 'inlineColumn':
41
44
  return;
42
45
  case 'full':
@@ -1 +1 @@
1
- {"version":3,"file":"spec.cjs","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"names":["assertNever"],"mappings":";;;;AAuCM,SAAU,aAAa,CAAC,IAAiB,EAAA;AAC7C,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS;AAChC;AAEM,SAAU,SAAS,CAAI,GAAe,EAAA;AAC1C,IAAA,OAAO,aAAa,CAAC,G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AC,CAAC,CAAC;gBAC/C;AACF,YAAA,KAAK,OAAO;AACV,gBAAA,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5B,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS;oBAAE,aAAa,CAAC,CAAC,CAAC;gBACjD;AACF,YAAA;gBACEA,gBAAW,CAAC,KAAK,CAAC;;AAExB,IAAA,CAAC;IACD,aAAa,CAAC,KAAK,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9B;;;;;;;;;;"}
1
+ {"version":3,"file":"spec.cjs","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'artificialColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"names":["assertNever"],"mappings":";;;;AAuCM,SAAU,aAAa,CAAC,IAAiB,EAAA;AAC7C,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS;AAChC;AAEM,SAAU,SAAS,CA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,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1F,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,EACnC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,EAC7B,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;AAa3B,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CA6B/E"}
package/dist/pool/spec.js CHANGED
@@ -35,6 +35,9 @@ function extractAllColumns(entry) {
35
35
  case 'slicedColumn':
36
36
  columns.set(entry.column.id, entry.column);
37
37
  return;
38
+ case 'artificialColumn':
39
+ columns.set(entry.column.id, entry.column);
40
+ return;
38
41
  case 'inlineColumn':
39
42
  return;
40
43
  case 'full':
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"names":[],"mappings":";;AAuCM,SAAU,aAAa,CAAC,IAAiB,EAAA;AAC7C,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS;AAChC;AAEM,SAAU,SAAS,CAAI,GAAe,EAAA;AAC1C,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;AAChC;AAEM,SAAU,mBAAmB,CACjC,CAA+B,EAAA;AAE/B,IAAA,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7B;AAEM,SAAU,eAAe,CAC7B,CAA8B,EAAA;IAE9B,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AAClC;AAEM,SAAU,aAAa,CAAI,GAAe,EAAA;AAC9C,IAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,EAAyB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAA,CAAA,CAAG,CAAC;AAC/E,IAAA,OAAO,GAAG;AACZ;AAYM,SAAU,cAAc,CAC5B,IAA6B,EAC7B,EAAiB,EAAA;IAEjB,OAAO,IAAI,KAAK;AACd,UAAE;AACF,UAAE;AACE,YAAA,GAAG,IAAI;AACP,YAAA,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;SACpB;AACP;AAEM,SAAU,iBAAiB,CAAI,KAA4B,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB;AAChD,IAAA,MAAM,aAAa,GAAG,CAAC,KAA4B,KAAI;AACrD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;AACjB,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;gBACjB;AACF,YAAA,KAAK,MAAM;AACX,YAAA,KAAK,OAAO;AACV,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO;oBAAE,aAAa,CAAC,CAAC,CAAC;gBAC/C;AACF,YAAA,KAAK,OAAO;AACV,gBAAA,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5B,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS;oBAAE,aAAa,CAAC,CAAC,CAAC;gBACjD;AACF,YAAA;gBACE,WAAW,CAAC,KAAK,CAAC;;AAExB,IAAA,CAAC;IACD,aAAa,CAAC,KAAK,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9B;;;;"}
1
+ {"version":3,"file":"spec.js","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'artificialColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"names":[],"mappings":";;AAuCM,SAAU,aAAa,CAAC,IAAiB,EAAA;AAC7C,IAAA,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS;AAChC;AAEM,SAAU,SAAS,CAAI,GAAe,EAAA;AAC1C,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;AAChC;AAEM,SAAU,mBAAmB,CACjC,CAA+B,EAAA;AAE/B,IAAA,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7B;AAEM,SAAU,eAAe,CAC7B,CAA8B,EAAA;IAE9B,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AAClC;AAEM,SAAU,aAAa,CAAI,GAAe,EAAA;AAC9C,IAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,EAAyB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAA,CAAA,CAAG,CAAC;AAC/E,IAAA,OAAO,GAAG;AACZ;AAYM,SAAU,cAAc,CAC5B,IAA6B,EAC7B,EAAiB,EAAA;IAEjB,OAAO,IAAI,KAAK;AACd,UAAE;AACF,UAAE;AACE,YAAA,GAAG,IAAI;AACP,YAAA,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;SACpB;AACP;AAEM,SAAU,iBAAiB,CAAI,KAA4B,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB;AAChD,IAAA,MAAM,aAAa,GAAG,CAAC,KAA4B,KAAI;AACrD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;AACjB,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,kBAAkB;AACrB,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;gBACjB;AACF,YAAA,KAAK,MAAM;AACX,YAAA,KAAK,OAAO;AACV,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO;oBAAE,aAAa,CAAC,CAAC,CAAC;gBAC/C;AACF,YAAA,KAAK,OAAO;AACV,gBAAA,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5B,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS;oBAAE,aAAa,CAAC,CAAC,CAAC;gBACjD;AACF,YAAA;gBACE,WAAW,CAAC,KAAK,CAAC;;AAExB,IAAA,CAAC;IACD,aAAa,CAAC,KAAK,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-common",
3
- "version": "1.19.18",
3
+ "version": "1.20.0",
4
4
  "description": "Platforma SDK Model",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -26,9 +26,9 @@
26
26
  "typescript": "~5.6.3",
27
27
  "vitest": "^2.1.9",
28
28
  "@milaboratories/build-configs": "1.0.8",
29
+ "@platforma-sdk/eslint-config": "1.1.0",
29
30
  "@milaboratories/ts-builder": "1.0.5",
30
- "@milaboratories/ts-configs": "1.0.6",
31
- "@platforma-sdk/eslint-config": "1.1.0"
31
+ "@milaboratories/ts-configs": "1.0.6"
32
32
  },
33
33
  "scripts": {
34
34
  "type-check": "ts-builder types --target node",
package/src/base64.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { WithImplicitCoercion } from 'node:buffer';
2
+
1
3
  export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
2
4
 
3
5
  export type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {
@@ -44,6 +44,20 @@ export interface SlicedColumnJoinEntry<Col> {
44
44
  readonly axisFilters: ConstantAxisFilter[];
45
45
  }
46
46
 
47
+ export interface ArtificialColumnJoinEntry<Col> {
48
+ /** Node type discriminator */
49
+ readonly type: 'artificialColumn';
50
+
51
+ /** Column definition */
52
+ readonly column: Col;
53
+
54
+ /** New column id */
55
+ readonly newId: PObjectId;
56
+
57
+ /** Indices of axes to pick from the column (zero-based) */
58
+ readonly axesIndices: number[];
59
+ }
60
+
47
61
  /** Defines a terminal column node in the join request tree */
48
62
  export interface InlineColumnJoinEntry {
49
63
  /** Node type discriminator */
@@ -111,6 +125,7 @@ export interface OuterJoin<Col> {
111
125
  export type JoinEntry<Col> =
112
126
  | ColumnJoinEntry<Col>
113
127
  | SlicedColumnJoinEntry<Col>
128
+ | ArtificialColumnJoinEntry<Col>
114
129
  | InlineColumnJoinEntry
115
130
  | InnerJoin<Col>
116
131
  | FullJoin<Col>
@@ -397,6 +412,13 @@ export function mapJoinEntry<C1, C2>(
397
412
  newId: entry.newId,
398
413
  axisFilters: entry.axisFilters,
399
414
  };
415
+ case 'artificialColumn':
416
+ return {
417
+ type: 'artificialColumn',
418
+ column: cb(entry.column),
419
+ newId: entry.newId,
420
+ axesIndices: entry.axesIndices,
421
+ };
400
422
  case 'inlineColumn':
401
423
  return entry;
402
424
  case 'inner':
package/src/pool/spec.ts CHANGED
@@ -94,6 +94,9 @@ export function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[]
94
94
  case 'slicedColumn':
95
95
  columns.set(entry.column.id, entry.column);
96
96
  return;
97
+ case 'artificialColumn':
98
+ columns.set(entry.column.id, entry.column);
99
+ return;
97
100
  case 'inlineColumn':
98
101
  return;
99
102
  case 'full':