@milaboratories/pl-model-common 1.13.1 → 1.13.2

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,5 +1,6 @@
1
1
  import type { PTableColumnId, PTableColumnSpec } from './table_common';
2
2
  import type { PTableVector } from './data_types';
3
+ import type { PObjectId } from '../../pool';
3
4
  import { assertNever } from '../../util';
4
5
 
5
6
  /** Defines a terminal column node in the join request tree */
@@ -11,6 +12,36 @@ export interface ColumnJoinEntry<Col> {
11
12
  readonly column: Col;
12
13
  }
13
14
 
15
+ /**
16
+ * Axis filter slicing target axis from column axes.
17
+ * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
18
+ * */
19
+ export interface ConstantAxisFilter {
20
+ /** Filter type discriminator */
21
+ readonly type: 'constant';
22
+
23
+ /** Index of axis to slice (zero-based) */
24
+ readonly axisIndex: number;
25
+
26
+ /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
27
+ readonly constant: string | number;
28
+ }
29
+
30
+ /** Defines a terminal column node in the join request tree */
31
+ export interface SlicedColumnJoinEntry<Col> {
32
+ /** Node type discriminator */
33
+ readonly type: 'slicedColumn';
34
+
35
+ /** Local column */
36
+ readonly column: Col;
37
+
38
+ /** New column id */
39
+ readonly newId: PObjectId;
40
+
41
+ /** Non-empty list of axis filters */
42
+ readonly axisFilters: ConstantAxisFilter[];
43
+ }
44
+
14
45
  /**
15
46
  * Defines a join request tree node that will output only records present in
16
47
  * all child nodes ({@link entries}).
@@ -68,6 +99,7 @@ export interface OuterJoin<Col> {
68
99
  * */
69
100
  export type JoinEntry<Col> =
70
101
  | ColumnJoinEntry<Col>
102
+ | SlicedColumnJoinEntry<Col>
71
103
  | InnerJoin<Col>
72
104
  | FullJoin<Col>
73
105
  | OuterJoin<Col>;
@@ -325,6 +357,13 @@ export function mapJoinEntry<C1, C2>(
325
357
  type: 'column',
326
358
  column: cb(entry.column),
327
359
  };
360
+ case 'slicedColumn':
361
+ return {
362
+ type: 'slicedColumn',
363
+ column: cb(entry.column),
364
+ newId: entry.newId,
365
+ axisFilters: entry.axisFilters,
366
+ };
328
367
  case 'inner':
329
368
  case 'full':
330
369
  return {
package/src/pool/spec.ts CHANGED
@@ -85,6 +85,9 @@ export function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[]
85
85
  case 'column':
86
86
  columns.set(entry.column.id, entry.column);
87
87
  return;
88
+ case 'slicedColumn':
89
+ columns.set(entry.column.id, entry.column);
90
+ return;
88
91
  case 'full':
89
92
  case 'inner':
90
93
  for (const e of entry.entries) addAllColumns(e);