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

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,8 +1,4 @@
1
1
  import { Expression, AggregationType } from './expressions';
2
- /**
3
- * Defines standard aggregation functions that operate on a single expression.
4
- */
5
- export type StandardAggregationType = 'sum' | 'mean' | 'median' | 'min' | 'max' | 'std' | 'var' | 'count' | 'first' | 'last' | 'n_unique';
6
2
  /**
7
3
  * Defines aggregation functions that select a value from one expression based on the min/max of another expression.
8
4
  */
@@ -409,7 +409,13 @@ export interface WindowExpression {
409
409
  /**
410
410
  * Represents a struct field access operation.
411
411
  * This operation retrieves a single field from a struct (nested data structure).
412
- * It corresponds to Polars' struct.field() functionality.
412
+ *
413
+ * Uses native Polars struct.field() functionality when possible for optimal performance,
414
+ * but falls back to Python UDF (map_elements) when dtype casting or default values
415
+ * are specified, trading performance for robust handling of missing fields and null structs.
416
+ *
417
+ * When fields is an array, the operation performs recursive field access,
418
+ * where each element in the array represents a level in the nested structure.
413
419
  */
414
420
  export interface StructFieldExpression {
415
421
  /** The type of operation, always 'struct_field'. */
@@ -417,8 +423,20 @@ export interface StructFieldExpression {
417
423
  /** The struct expression to extract fields from. */
418
424
  struct: Expression;
419
425
  /**
420
- * The field name to extract from the struct.
421
- * Currently only supports single field extraction due to Polars behavior limitations.
426
+ * The field name(s) to extract from the struct.
427
+ * - If a string, extracts a single field from the struct.
428
+ * - If an array, performs recursive field access where each element represents a level in the nested structure.
429
+ */
430
+ fields: string | string[];
431
+ /**
432
+ * Optional expected data type for the returned value.
433
+ * This can be used for type validation or casting of the extracted field.
434
+ */
435
+ dtype?: DataType;
436
+ /**
437
+ * Optional default value to return if the field is not found or is null.
438
+ * If not provided and the field is missing, the operation returns null.
439
+ * Only constant scalar values are supported.
422
440
  */
423
- fields: string;
441
+ default?: string | number | boolean | null;
424
442
  }
package/dist/sort.d.ts CHANGED
@@ -36,14 +36,8 @@ export interface SortStep {
36
36
  * An array of sort directives defining the columns and their respective sort orders.
37
37
  * The table is sorted by the first directive in the array, then by the second
38
38
  * for any ties, and so on.
39
+ *
40
+ * Note: Sorting is always stable (maintains relative order of equivalent rows).
39
41
  */
40
42
  by: SortDirective[];
41
- /**
42
- * Optional. If true, maintains the stability of the sort. This means that if
43
- * two rows are equivalent according to the sorting criteria, their relative order
44
- * from the input table is preserved in the output.
45
- * Corresponds to `maintain_order=True` in Polars `DataFrame.sort()`.
46
- * Defaults to false.
47
- */
48
- stable?: boolean;
49
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.software-ptabler.schema",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Type definitions for PTabler",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -18,10 +18,10 @@
18
18
  ],
19
19
  "dependencies": {},
20
20
  "devDependencies": {
21
- "@platforma-sdk/eslint-config": "^1.0.3",
22
- "vite-plugin-dts": "^4.5.4",
23
- "eslint": "^9.27.0",
24
- "typescript": "~5.5.4",
21
+ "@platforma-sdk/eslint-config": "",
22
+ "vite-plugin-dts": "^4.5.3",
23
+ "eslint": "^9.25.1",
24
+ "typescript": "~5.6.3",
25
25
  "vite": "^6.3.5"
26
26
  },
27
27
  "scripts": {
package/src/aggregate.ts CHANGED
@@ -1,21 +1,5 @@
1
1
  import type { Expression, AggregationType } from './expressions';
2
2
 
3
- /**
4
- * Defines standard aggregation functions that operate on a single expression.
5
- */
6
- export type StandardAggregationType =
7
- | 'sum'
8
- | 'mean'
9
- | 'median'
10
- | 'min'
11
- | 'max'
12
- | 'std'
13
- | 'var'
14
- | 'count'
15
- | 'first'
16
- | 'last'
17
- | 'n_unique';
18
-
19
3
  /**
20
4
  * Defines aggregation functions that select a value from one expression based on the min/max of another expression.
21
5
  */
@@ -519,7 +519,13 @@ export interface WindowExpression {
519
519
  /**
520
520
  * Represents a struct field access operation.
521
521
  * This operation retrieves a single field from a struct (nested data structure).
522
- * It corresponds to Polars' struct.field() functionality.
522
+ *
523
+ * Uses native Polars struct.field() functionality when possible for optimal performance,
524
+ * but falls back to Python UDF (map_elements) when dtype casting or default values
525
+ * are specified, trading performance for robust handling of missing fields and null structs.
526
+ *
527
+ * When fields is an array, the operation performs recursive field access,
528
+ * where each element in the array represents a level in the nested structure.
523
529
  */
524
530
  export interface StructFieldExpression {
525
531
  /** The type of operation, always 'struct_field'. */
@@ -527,8 +533,20 @@ export interface StructFieldExpression {
527
533
  /** The struct expression to extract fields from. */
528
534
  struct: Expression;
529
535
  /**
530
- * The field name to extract from the struct.
531
- * Currently only supports single field extraction due to Polars behavior limitations.
536
+ * The field name(s) to extract from the struct.
537
+ * - If a string, extracts a single field from the struct.
538
+ * - If an array, performs recursive field access where each element represents a level in the nested structure.
539
+ */
540
+ fields: string | string[];
541
+ /**
542
+ * Optional expected data type for the returned value.
543
+ * This can be used for type validation or casting of the extracted field.
544
+ */
545
+ dtype?: DataType;
546
+ /**
547
+ * Optional default value to return if the field is not found or is null.
548
+ * If not provided and the field is missing, the operation returns null.
549
+ * Only constant scalar values are supported.
532
550
  */
533
- fields: string;
551
+ default?: string | number | boolean | null;
534
552
  }
package/src/sort.ts CHANGED
@@ -43,15 +43,8 @@ export interface SortStep {
43
43
  * An array of sort directives defining the columns and their respective sort orders.
44
44
  * The table is sorted by the first directive in the array, then by the second
45
45
  * for any ties, and so on.
46
+ *
47
+ * Note: Sorting is always stable (maintains relative order of equivalent rows).
46
48
  */
47
49
  by: SortDirective[];
48
-
49
- /**
50
- * Optional. If true, maintains the stability of the sort. This means that if
51
- * two rows are equivalent according to the sorting criteria, their relative order
52
- * from the input table is preserved in the output.
53
- * Corresponds to `maintain_order=True` in Polars `DataFrame.sort()`.
54
- * Defaults to false.
55
- */
56
- stable?: boolean;
57
50
  }