@platforma-open/milaboratories.software-ptabler.schema 1.11.1 → 1.11.3

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,5 @@
1
1
  import { DataType } from './common';
2
- export type Expression = ComparisonExpression | BinaryArithmeticExpression | UnaryArithmeticExpression | CastExpression | BooleanLogicExpression | NotExpression | NullCheckExpression | StringJoinExpression | HashExpression | ColumnReferenceExpression | ConstantValueExpression | RankExpression | CumsumExpression | ExtendedUnaryStringExpression | StringDistanceExpression | FuzzyStringFilterExpression | WhenThenOtherwiseExpression | SubstringExpression | StringReplaceExpression | StringContainsExpression | StringStartsWithExpression | StringEndsWithExpression | StringContainsAnyExpression | StringCountMatchesExpression | StringExtractExpression | MinMaxExpression | FillNaExpression | WindowExpression | StructFieldExpression;
2
+ export type Expression = ComparisonExpression | BinaryArithmeticExpression | UnaryArithmeticExpression | CastExpression | BooleanLogicExpression | NotExpression | NullCheckExpression | StringJoinExpression | HashExpression | ColumnReferenceExpression | ConstantValueExpression | RankExpression | CumsumExpression | ExtendedUnaryStringExpression | StringDistanceExpression | FuzzyStringFilterExpression | WhenThenOtherwiseExpression | SubstringExpression | StringReplaceExpression | StringContainsExpression | StringStartsWithExpression | StringEndsWithExpression | StringContainsAnyExpression | StringCountMatchesExpression | StringExtractExpression | MinMaxExpression | FillNullExpression | FillNaNExpression | WindowExpression | StructFieldExpression;
3
3
  /** Represents all possible expression types in the system. */
4
4
  export type ComparisonOperator = 'gt' | 'ge' | 'eq' | 'lt' | 'le' | 'neq';
5
5
  /** Defines a comparison operation between two expressions. */
@@ -374,20 +374,35 @@ export interface MinMaxExpression {
374
374
  operands: Expression[];
375
375
  }
376
376
  /**
377
- * Represents a fill NA (null) operation.
377
+ * Represents a fill null operation.
378
378
  * If the 'input' expression evaluates to null, the 'fillValue' expression is used.
379
379
  * Otherwise, the 'input' expression's value is used.
380
380
  * This is a convenience shortcut for a common pattern often implemented with
381
- * conditional expressions (e.g., when(is_na(input), fillValue).otherwise(input)).
381
+ * conditional expressions (e.g., when(is_null(input), fillValue).otherwise(input)).
382
382
  */
383
- export interface FillNaExpression {
384
- /** The type of operation, always 'fill_na'. */
385
- type: 'fill_na';
383
+ export interface FillNullExpression {
384
+ /** The type of operation, always 'fill_null'. */
385
+ type: 'fill_null';
386
386
  /** The primary expression to evaluate. */
387
387
  input: Expression;
388
388
  /** The expression whose value is used if 'input' is null. */
389
389
  fillValue: Expression;
390
390
  }
391
+ /**
392
+ * Represents a fill NaN operation.
393
+ * If the 'input' expression evaluates to NaN, the 'fillValue' expression is used.
394
+ * Otherwise, the 'input' expression's value is used.
395
+ * This is a convenience shortcut for a common pattern often implemented with
396
+ * conditional expressions (e.g., when(is_nan(input), fillValue).otherwise(input)).
397
+ */
398
+ export interface FillNaNExpression {
399
+ /** The type of operation, always 'fill_nan'. */
400
+ type: 'fill_nan';
401
+ /** The primary expression to evaluate. */
402
+ input: Expression;
403
+ /** The expression whose value is used if 'input' is NaN. */
404
+ fillValue: Expression;
405
+ }
391
406
  /**
392
407
  * Defines standard aggregation functions that can be used in window expressions.
393
408
  */
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { ReadCsvStep, ReadNdjsonStep, WriteCsvStep, WriteNdjsonStep, BaseFileReadStep, BaseFileWriteStep } from './io';
1
+ import { ReadCsvStep, ReadNdjsonStep, WriteCsvStep, WriteNdjsonStep, BaseFileReadStep, BaseFileWriteStep, WriteParquetStep, ReadParquetStep } from './io';
2
2
  import { AddColumnsStep, FilterStep, SelectStep, WithColumnsStep, WithoutColumnsStep } from './basic_steps';
3
3
  import { AggregateStep } from './aggregate';
4
4
  import { AnyJoinStep } from './join';
5
5
  import { ConcatenateStep } from './concatenate';
6
6
  import { SortStep } from './sort';
7
- export type PTablerStep = ReadCsvStep | ReadNdjsonStep | WriteCsvStep | WriteNdjsonStep | AddColumnsStep | FilterStep | AggregateStep | AnyJoinStep | ConcatenateStep | SortStep | SelectStep | WithColumnsStep | WithoutColumnsStep;
7
+ import { WriteFrameStep } from './write_frame';
8
+ export type PTablerStep = ReadCsvStep | ReadNdjsonStep | ReadParquetStep | WriteCsvStep | WriteNdjsonStep | WriteParquetStep | AddColumnsStep | FilterStep | AggregateStep | AnyJoinStep | ConcatenateStep | SortStep | SelectStep | WithColumnsStep | WithoutColumnsStep | WriteFrameStep;
8
9
  export type PTablerWorkflow = {
9
10
  workflow: PTablerStep[];
10
11
  };
package/dist/io.d.ts CHANGED
@@ -59,6 +59,11 @@ export interface ReadNdjsonStep extends BaseFileReadStep {
59
59
  /** The type of the step, which is always 'read_ndjson' for this operation. */
60
60
  type: 'read_ndjson';
61
61
  }
62
+ /** Represents the configuration for a step that reads data from an Apache Parquet file into the tablespace. */
63
+ export interface ReadParquetStep extends BaseFileReadStep {
64
+ /** The type of the step, which is always 'read_parquet' for this operation. */
65
+ type: 'read_parquet';
66
+ }
62
67
  /**
63
68
  * Base interface for file writing operations that contains common fields
64
69
  * shared across different file format writers.
@@ -87,3 +92,10 @@ export interface WriteNdjsonStep extends BaseFileWriteStep {
87
92
  /** The type of the step, which is always 'write_ndjson' for this operation. */
88
93
  type: 'write_ndjson';
89
94
  }
95
+ /**
96
+ * Represents the configuration for a step that writes a table from the tablespace to an Apache Parquet file.
97
+ */
98
+ export interface WriteParquetStep extends BaseFileWriteStep {
99
+ /** The type of the step, which is always 'write_parquet' for this operation. */
100
+ type: 'write_parquet';
101
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Axes values are used as unique key to access the column data,
3
+ * so they cannot be floating point numbers.
4
+ */
5
+ export type AxisType = 'Int' | 'Long' | 'String';
6
+ /** PColumn values could be of any type supported by PFrames. */
7
+ export type ColumnType = 'Int' | 'Long' | 'Float' | 'Double' | 'String';
8
+ export interface AxisMapping {
9
+ /** The name of the column in the input table. */
10
+ column: string;
11
+ /**
12
+ * The type of the axis to be created.
13
+ * A cast would be performed if the type of the column in the input table is different.
14
+ * Warning: cast failure will result in an error.
15
+ */
16
+ type: AxisType;
17
+ }
18
+ export interface ColumnMapping {
19
+ /** The name of the column in the input table. */
20
+ column: string;
21
+ /**
22
+ * The value type of the PColumn to be created.
23
+ * A cast would be performed if the type of the column in the input table is different.
24
+ * Warning: cast failure will produce null values in the PColumn.
25
+ */
26
+ type: ColumnType;
27
+ }
28
+ /** Defines a step that creates a PFrame from the lazy table. */
29
+ export interface WriteFrameStep {
30
+ /** The type identifier for this step. */
31
+ type: 'write_frame';
32
+ /** The name of the table from the tablespace which will be written. */
33
+ inputTable: string;
34
+ /**
35
+ * The name of the frame to be created.
36
+ * A folder with this name will be created in the working directory.
37
+ * The folder will contain the .datainfo and .parquet files representing the frame's PColumns.
38
+ */
39
+ frameName: string;
40
+ /**
41
+ * Axes specs, the order of axes in PColumns will match the order of axes in this array.
42
+ * Each column in the input table could be used as axis or PColumn only once.
43
+ * Warning: rows with null values in axes columns of input table will be discarded.
44
+ */
45
+ axes: AxisMapping[];
46
+ /**
47
+ * PColumns specs.
48
+ * Each column in the input table could be used as axis or PColumn only once.
49
+ */
50
+ columns: ColumnMapping[];
51
+ /**
52
+ * Partition key length, specifies the number of axes to be split into metadata partition key.
53
+ * Default: 0, which means no partitioning.
54
+ * Must be strictly less than the number of axes.
55
+ */
56
+ partitionKeyLength: number;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.software-ptabler.schema",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "Type definitions for PTabler",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {},
20
20
  "devDependencies": {
21
- "@platforma-sdk/eslint-config": "",
22
21
  "vite-plugin-dts": "^4.5.3",
23
22
  "eslint": "^9.25.1",
24
23
  "typescript": "~5.6.3",
25
- "vite": "^6.3.5"
24
+ "vite": "^6.3.5",
25
+ "@platforma-sdk/eslint-config": "1.1.0"
26
26
  },
27
27
  "scripts": {
28
28
  "type-check": "tsc --noEmit --composite false",
@@ -27,7 +27,8 @@ export type Expression =
27
27
  | StringCountMatchesExpression
28
28
  | StringExtractExpression
29
29
  | MinMaxExpression
30
- | FillNaExpression
30
+ | FillNullExpression
31
+ | FillNaNExpression
31
32
  | WindowExpression
32
33
  | StructFieldExpression;
33
34
 
@@ -470,21 +471,37 @@ export interface MinMaxExpression {
470
471
  }
471
472
 
472
473
  /**
473
- * Represents a fill NA (null) operation.
474
+ * Represents a fill null operation.
474
475
  * If the 'input' expression evaluates to null, the 'fillValue' expression is used.
475
476
  * Otherwise, the 'input' expression's value is used.
476
477
  * This is a convenience shortcut for a common pattern often implemented with
477
- * conditional expressions (e.g., when(is_na(input), fillValue).otherwise(input)).
478
+ * conditional expressions (e.g., when(is_null(input), fillValue).otherwise(input)).
478
479
  */
479
- export interface FillNaExpression {
480
- /** The type of operation, always 'fill_na'. */
481
- type: 'fill_na';
480
+ export interface FillNullExpression {
481
+ /** The type of operation, always 'fill_null'. */
482
+ type: 'fill_null';
482
483
  /** The primary expression to evaluate. */
483
484
  input: Expression;
484
485
  /** The expression whose value is used if 'input' is null. */
485
486
  fillValue: Expression;
486
487
  }
487
488
 
489
+ /**
490
+ * Represents a fill NaN operation.
491
+ * If the 'input' expression evaluates to NaN, the 'fillValue' expression is used.
492
+ * Otherwise, the 'input' expression's value is used.
493
+ * This is a convenience shortcut for a common pattern often implemented with
494
+ * conditional expressions (e.g., when(is_nan(input), fillValue).otherwise(input)).
495
+ */
496
+ export interface FillNaNExpression {
497
+ /** The type of operation, always 'fill_nan'. */
498
+ type: 'fill_nan';
499
+ /** The primary expression to evaluate. */
500
+ input: Expression;
501
+ /** The expression whose value is used if 'input' is NaN. */
502
+ fillValue: Expression;
503
+ }
504
+
488
505
  /**
489
506
  * Defines standard aggregation functions that can be used in window expressions.
490
507
  */
package/src/index.ts CHANGED
@@ -1,15 +1,33 @@
1
- import type { ReadCsvStep, ReadNdjsonStep, WriteCsvStep, WriteNdjsonStep, BaseFileReadStep, BaseFileWriteStep } from './io';
2
- import type { AddColumnsStep, FilterStep, SelectStep, WithColumnsStep, WithoutColumnsStep } from './basic_steps';
1
+ import type {
2
+ ReadCsvStep,
3
+ ReadNdjsonStep,
4
+ WriteCsvStep,
5
+ WriteNdjsonStep,
6
+ BaseFileReadStep,
7
+ BaseFileWriteStep,
8
+ WriteParquetStep,
9
+ ReadParquetStep,
10
+ } from './io';
11
+ import type {
12
+ AddColumnsStep,
13
+ FilterStep,
14
+ SelectStep,
15
+ WithColumnsStep,
16
+ WithoutColumnsStep,
17
+ } from './basic_steps';
3
18
  import type { AggregateStep } from './aggregate';
4
19
  import type { AnyJoinStep } from './join';
5
20
  import type { ConcatenateStep } from './concatenate';
6
21
  import type { SortStep } from './sort';
22
+ import type { WriteFrameStep } from './write_frame';
7
23
 
8
24
  export type PTablerStep =
9
25
  | ReadCsvStep
10
26
  | ReadNdjsonStep
27
+ | ReadParquetStep
11
28
  | WriteCsvStep
12
29
  | WriteNdjsonStep
30
+ | WriteParquetStep
13
31
  | AddColumnsStep
14
32
  | FilterStep
15
33
  | AggregateStep
@@ -18,7 +36,8 @@ export type PTablerStep =
18
36
  | SortStep
19
37
  | SelectStep
20
38
  | WithColumnsStep
21
- | WithoutColumnsStep;
39
+ | WithoutColumnsStep
40
+ | WriteFrameStep;
22
41
 
23
42
  export type PTablerWorkflow = {
24
43
  workflow: PTablerStep[];
package/src/io.ts CHANGED
@@ -64,6 +64,12 @@ export interface ReadNdjsonStep extends BaseFileReadStep {
64
64
  type: 'read_ndjson';
65
65
  }
66
66
 
67
+ /** Represents the configuration for a step that reads data from an Apache Parquet file into the tablespace. */
68
+ export interface ReadParquetStep extends BaseFileReadStep {
69
+ /** The type of the step, which is always 'read_parquet' for this operation. */
70
+ type: 'read_parquet';
71
+ }
72
+
67
73
  /**
68
74
  * Base interface for file writing operations that contains common fields
69
75
  * shared across different file format writers.
@@ -104,3 +110,11 @@ export interface WriteNdjsonStep extends BaseFileWriteStep {
104
110
  /** The type of the step, which is always 'write_ndjson' for this operation. */
105
111
  type: 'write_ndjson';
106
112
  }
113
+
114
+ /**
115
+ * Represents the configuration for a step that writes a table from the tablespace to an Apache Parquet file.
116
+ */
117
+ export interface WriteParquetStep extends BaseFileWriteStep {
118
+ /** The type of the step, which is always 'write_parquet' for this operation. */
119
+ type: 'write_parquet';
120
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Axes values are used as unique key to access the column data,
3
+ * so they cannot be floating point numbers.
4
+ */
5
+ export type AxisType = 'Int' | 'Long' | 'String';
6
+
7
+ /** PColumn values could be of any type supported by PFrames. */
8
+ export type ColumnType = 'Int' | 'Long' | 'Float' | 'Double' | 'String';
9
+
10
+ export interface AxisMapping {
11
+ /** The name of the column in the input table. */
12
+ column: string;
13
+ /**
14
+ * The type of the axis to be created.
15
+ * A cast would be performed if the type of the column in the input table is different.
16
+ * Warning: cast failure will result in an error.
17
+ */
18
+ type: AxisType;
19
+ }
20
+
21
+ export interface ColumnMapping {
22
+ /** The name of the column in the input table. */
23
+ column: string;
24
+ /**
25
+ * The value type of the PColumn to be created.
26
+ * A cast would be performed if the type of the column in the input table is different.
27
+ * Warning: cast failure will produce null values in the PColumn.
28
+ */
29
+ type: ColumnType;
30
+ }
31
+
32
+ /** Defines a step that creates a PFrame from the lazy table. */
33
+ export interface WriteFrameStep {
34
+ /** The type identifier for this step. */
35
+ type: 'write_frame';
36
+
37
+ /** The name of the table from the tablespace which will be written. */
38
+ inputTable: string;
39
+
40
+ /**
41
+ * The name of the frame to be created.
42
+ * A folder with this name will be created in the working directory.
43
+ * The folder will contain the .datainfo and .parquet files representing the frame's PColumns.
44
+ */
45
+ frameName: string;
46
+
47
+ /**
48
+ * Axes specs, the order of axes in PColumns will match the order of axes in this array.
49
+ * Each column in the input table could be used as axis or PColumn only once.
50
+ * Warning: rows with null values in axes columns of input table will be discarded.
51
+ */
52
+ axes: AxisMapping[];
53
+
54
+ /**
55
+ * PColumns specs.
56
+ * Each column in the input table could be used as axis or PColumn only once.
57
+ */
58
+ columns: ColumnMapping[];
59
+
60
+ /**
61
+ * Partition key length, specifies the number of axes to be split into metadata partition key.
62
+ * Default: 0, which means no partitioning.
63
+ * Must be strictly less than the number of axes.
64
+ */
65
+ partitionKeyLength: number;
66
+ }