@narrative.io/data-collaboration-sdk-ts 2.94.1 → 2.95.0-beta.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.
Files changed (64) hide show
  1. package/build/access-rules/index.d.ts +1 -1
  2. package/build/access-tokens/index.d.ts +1 -1
  3. package/build/access-tokens/types.d.ts +2 -0
  4. package/build/access-tokens/types.js +2 -0
  5. package/build/apps/index.d.ts +8 -1
  6. package/build/apps/index.js +9 -0
  7. package/build/attributes/index.d.ts +1 -1
  8. package/build/authentication/index.d.ts +1 -1
  9. package/build/collaboration-policy/core/filter-builder.js +7 -1
  10. package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +45 -0
  11. package/build/collaboration-policy/core/jsonschema/json-schema-types.js +1 -0
  12. package/build/collaboration-policy/core/jsonschema/policy-branches.d.ts +49 -0
  13. package/build/collaboration-policy/core/jsonschema/policy-branches.js +1 -0
  14. package/build/collaboration-policy/core/jsonschema/policy-evaluator.d.ts +22 -0
  15. package/build/collaboration-policy/core/jsonschema/policy-evaluator.js +260 -0
  16. package/build/collaboration-policy/core/jsonschema/sql-builder.d.ts +79 -0
  17. package/build/collaboration-policy/core/jsonschema/sql-builder.js +306 -0
  18. package/build/collaboration-policy/core/jsonschema/sql-poc.d.ts +79 -0
  19. package/build/collaboration-policy/core/jsonschema/sql-poc.js +305 -0
  20. package/build/collaboration-policy/core/types.d.ts +81 -10
  21. package/build/collaboration-policy/index.d.ts +5 -4
  22. package/build/collaboration-policy/index.js +4 -3
  23. package/build/collaboration-policy/useCollaborationPolicy.d.ts +13 -4
  24. package/build/collaboration-policy/useCollaborationPolicy.js +23 -1
  25. package/build/collaboration-policy/utils/path-helpers.d.ts +7 -3
  26. package/build/collaboration-policy/utils/path-helpers.js +6 -22
  27. package/build/company-info/index.d.ts +1 -1
  28. package/build/connections/index.d.ts +1 -1
  29. package/build/contracts/index.d.ts +1 -1
  30. package/build/data-planes/types.d.ts +1 -1
  31. package/build/data-streams/index.d.ts +1 -1
  32. package/build/datasets/index.d.ts +21 -3
  33. package/build/datasets/index.js +31 -2
  34. package/build/datasets/statistics-types.d.ts +81 -0
  35. package/build/datasets/statistics-types.js +1 -0
  36. package/build/datasets/types.d.ts +85 -9
  37. package/build/datasets/types.js +1 -0
  38. package/build/forecast/index.d.ts +1 -1
  39. package/build/index.d.ts +1 -0
  40. package/build/index.js +1 -0
  41. package/build/installations/index.d.ts +1 -1
  42. package/build/jobs/index.d.ts +1 -1
  43. package/build/jobs/types.d.ts +1 -0
  44. package/build/mappings/index.d.ts +1 -1
  45. package/build/model-inference/index.d.ts +1 -1
  46. package/build/model-training/index.d.ts +1 -1
  47. package/build/models/index.d.ts +1 -1
  48. package/build/nql/Ast.d.ts +1 -1
  49. package/build/nql/SubstraitParser.d.ts +771 -0
  50. package/build/nql/SubstraitParser.js +797 -0
  51. package/build/nql/index.d.ts +1 -1
  52. package/build/nql/index.js +1 -1
  53. package/build/nql/types.d.ts +9 -9
  54. package/build/products/index.d.ts +1 -1
  55. package/build/queries/index.d.ts +1 -1
  56. package/build/resources/index.d.ts +1 -1
  57. package/build/rosetta/types.d.ts +1 -1
  58. package/build/rosetta/types.js +1 -1
  59. package/build/rosetta-stone/index.d.ts +1 -1
  60. package/build/subscriptions/index.d.ts +1 -1
  61. package/build/uploads/index.d.ts +1 -1
  62. package/build/views/index.d.ts +1 -1
  63. package/build/workflows/index.d.ts +1 -1
  64. package/package.json +11 -10
@@ -0,0 +1,771 @@
1
+ /*!
2
+ Copyright 2023 Narrative I/O, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ NOTICE: THIS FILE HAS BEEN MODIFIED BY NARRATIVE I/O UNDER COMPLIANCE WITH THE APACHE 2.0 LICENCE FROM THE ORIGINAL WORK
11
+ OF THE COMPANY Substrait (https://github.com/substrait-io/substrait-js).
12
+ */
13
+ type Nullability = "NULLABILITY_UNSPECIFIED" | "NULLABILITY_NULLABLE" | "NULLABILITY_REQUIRED";
14
+ type FailureBehavior = "FAILURE_BEHAVIOR_UNSPECIFIED" | "FAILURE_BEHAVIOR_RETURN_NULL" | "THROW_EXCEPTION";
15
+ interface AdvancedExtension {
16
+ optimization: unknown;
17
+ enhancement: unknown;
18
+ }
19
+ type LogicalOperator = "and" | "or" | "not";
20
+ interface Expression {
21
+ selection?: FieldReference;
22
+ scalarFunction?: ScalarFunction;
23
+ literal?: Literal;
24
+ cast?: CastExpression;
25
+ }
26
+ interface FilterRelation {
27
+ common: RelCommon;
28
+ input: Rel;
29
+ condition: Expression;
30
+ advancedExtension?: AdvancedExtension;
31
+ }
32
+ interface ProjectRelation {
33
+ common: RelCommon;
34
+ input: Rel;
35
+ expressions: Expression[];
36
+ advancedExtension?: AdvancedExtension;
37
+ }
38
+ interface JoinRelation {
39
+ common: RelCommon;
40
+ left: Rel;
41
+ right: Rel;
42
+ expression: Expression;
43
+ postJoinFilter: Expression;
44
+ type: JoinType;
45
+ advancedExtension?: AdvancedExtension;
46
+ }
47
+ interface CrossRelation {
48
+ common: RelCommon;
49
+ left: Rel;
50
+ right: Rel;
51
+ advancedExtension?: AdvancedExtension;
52
+ }
53
+ interface PlanRelation {
54
+ rel?: Rel;
55
+ root?: RelationRoot;
56
+ }
57
+ interface Extension {
58
+ extensionFunction: ExtensionFunction;
59
+ }
60
+ export interface Plan {
61
+ version?: Version;
62
+ extensionUris: ExtensionUri[];
63
+ extensionUriAnchor?: number;
64
+ extensions: Extension[];
65
+ relations: PlanRelation[];
66
+ advancedExtensions?: AdvancedExtension[];
67
+ expectedTypeUrls: string[];
68
+ }
69
+ interface Version {
70
+ major_number: number;
71
+ minor_number: number;
72
+ patch_number: number;
73
+ git_hash?: string;
74
+ producer?: string;
75
+ }
76
+ interface FetchRelation {
77
+ common: RelCommon;
78
+ input: Rel;
79
+ offset: number;
80
+ count: number;
81
+ advancedExtension: AdvancedExtension;
82
+ }
83
+ interface AggregateRelation {
84
+ common: RelCommon;
85
+ input: Rel;
86
+ groupings: Grouping[];
87
+ measures: Measure[];
88
+ advancedExtension: AdvancedExtension;
89
+ }
90
+ type FunctionTyp = ScalarFunction | AggregateFunction;
91
+ interface ScalarFunction {
92
+ functionReference: number;
93
+ args: FunctionArgument[];
94
+ options: FunctionOption[];
95
+ outputType: LiteralType;
96
+ arguments: FunctionArgument[];
97
+ }
98
+ interface Grouping {
99
+ groupingExpressions: Expression[];
100
+ }
101
+ interface Measure {
102
+ measure: AggregateFunction;
103
+ filter: Expression;
104
+ }
105
+ declare enum AggregationInvocation {
106
+ AGGREGATION_INVOCATION_UNSPECIFIED = 0,
107
+ AGGREGATION_INVOCATION_ALL = 1,
108
+ AGGREGATION_INVOCATION_DISTINCT = 2
109
+ }
110
+ interface EnumTyp {
111
+ deprecated?: boolean;
112
+ specified?: string;
113
+ unspecified?: {
114
+ deprecated?: boolean;
115
+ };
116
+ }
117
+ interface FunctionArgument {
118
+ enum?: EnumTyp;
119
+ type?: LiteralType;
120
+ value?: Expression;
121
+ }
122
+ declare enum AggregationPhase {
123
+ AGGREGATION_PHASE_UNSPECIFIED = 0,
124
+ AGGREGATION_PHASE_INITIAL_TO_INTERMEDIATE = 1,
125
+ AGGREGATION_PHASE_INTERMEDIATE_TO_INTERMEDIATE = 2,
126
+ AGGREGATION_PHASE_INITIAL_TO_RESULT = 3,
127
+ AGGREGATION_PHASE_INTERMEDIATE_TO_RESULT = 4
128
+ }
129
+ interface FunctionOption {
130
+ name: string;
131
+ preference: string[];
132
+ }
133
+ interface AggregateFunction {
134
+ functionReference: number;
135
+ arguments: FunctionArgument[];
136
+ options: FunctionOption[];
137
+ outputType: LiteralType;
138
+ phase: AggregationPhase;
139
+ sorts: SortField[];
140
+ invocation: AggregationInvocation;
141
+ args: FunctionArgument[];
142
+ }
143
+ interface SortRelation {
144
+ common: RelCommon;
145
+ input: Rel;
146
+ sorts: SortField[];
147
+ advancedExtension?: AdvancedExtension;
148
+ }
149
+ interface FilterRelation {
150
+ common: RelCommon;
151
+ input: Rel;
152
+ condition: Expression;
153
+ advancedExtension?: AdvancedExtension;
154
+ }
155
+ declare enum JoinType {
156
+ JOIN_TYPE_UNSPECIFIED = 0,
157
+ JOIN_TYPE_INNER = 1,
158
+ JOIN_TYPE_OUTER = 2,
159
+ JOIN_TYPE_LEFT = 3,
160
+ JOIN_TYPE_RIGHT = 4,
161
+ JOIN_TYPE_SEMI = 5,
162
+ JOIN_TYPE_ANTI = 6,
163
+ JOIN_TYPE_SINGLE = 7
164
+ }
165
+ declare enum SetOp {
166
+ SET_OP_UNSPECIFIED = 0,
167
+ SET_OP_MINUS_PRIMARY = 1,
168
+ SET_OP_MINUS_MULTISET = 2,
169
+ SET_OP_INTERSECTION_PRIMARY = 3,
170
+ SET_OP_INTERSECTION_MULTISET = 4,
171
+ SET_OP_UNION_DISTINCT = 5,
172
+ SET_OP_UNION_ALL = 6
173
+ }
174
+ interface SetRelation {
175
+ common: RelCommon;
176
+ inputs: Rel[];
177
+ op: SetOp;
178
+ advancedExtension?: AdvancedExtension;
179
+ }
180
+ interface ExtensionSingleRelation {
181
+ common: RelCommon;
182
+ input: Rel;
183
+ detail: unknown;
184
+ }
185
+ interface ExtensionLeafRelation {
186
+ common: RelCommon;
187
+ detail: unknown;
188
+ }
189
+ interface ExtensionMultiRelation {
190
+ common: RelCommon;
191
+ inputs: Rel[];
192
+ detail: unknown;
193
+ }
194
+ interface MaskExpression {
195
+ select?: {
196
+ struct?: {
197
+ structItems: StructItem[];
198
+ };
199
+ list?: {
200
+ selection: ListSelectItem[];
201
+ child?: Select;
202
+ };
203
+ map?: MapSelect;
204
+ };
205
+ maintain_singular_struct?: boolean;
206
+ }
207
+ interface StructItem {
208
+ field: number;
209
+ child?: StructItem;
210
+ }
211
+ interface ListSelectItem {
212
+ item?: {
213
+ field: number;
214
+ };
215
+ slice?: {
216
+ start: number;
217
+ end: number;
218
+ };
219
+ }
220
+ interface MapSelect {
221
+ key: string;
222
+ child?: Select;
223
+ }
224
+ interface Select {
225
+ struct?: {
226
+ struct_items: StructItem[];
227
+ };
228
+ list?: {
229
+ selection: ListSelectItem[];
230
+ child?: Select;
231
+ };
232
+ map?: MapSelect;
233
+ }
234
+ interface ReferenceSegment {
235
+ mapKey?: {
236
+ map_key: Literal;
237
+ child?: ReferenceSegment;
238
+ };
239
+ structField?: StructItem;
240
+ listElement?: {
241
+ offset: number;
242
+ child?: ReferenceSegment;
243
+ };
244
+ }
245
+ interface FieldReference {
246
+ directReference?: ReferenceSegment;
247
+ maskedReference?: MaskExpression;
248
+ expression?: Expression;
249
+ rootReference?: RootReference;
250
+ outerReference?: OuterReference;
251
+ }
252
+ type RootReference = unknown;
253
+ interface OuterReference {
254
+ steps_out: number;
255
+ }
256
+ interface RelationRoot {
257
+ input: Rel;
258
+ names: string[];
259
+ }
260
+ interface ScatterFields {
261
+ fields: FieldReference[];
262
+ }
263
+ interface SingleBucketExpression {
264
+ expression: Expression;
265
+ }
266
+ interface MultiBucketExpression {
267
+ expression: Expression;
268
+ constrained_to_count: boolean;
269
+ }
270
+ interface Broadcast {
271
+ }
272
+ interface RoundRobin {
273
+ exact: boolean;
274
+ }
275
+ interface ExchangeTarget {
276
+ partition_id: number[];
277
+ target_type: string | unknown;
278
+ }
279
+ interface ExchangeRelation {
280
+ common: RelCommon;
281
+ input: Rel;
282
+ partition_count: number;
283
+ targets: ExchangeTarget[];
284
+ exchange_kind: ScatterFields | SingleBucketExpression | MultiBucketExpression | RoundRobin | Broadcast;
285
+ advancedExtension?: AdvancedExtension;
286
+ }
287
+ interface Rel {
288
+ root?: RelationRoot;
289
+ filter?: FilterRelation;
290
+ project?: ProjectRelation;
291
+ join?: JoinRelation;
292
+ cross?: CrossRelation;
293
+ fetch?: FetchRelation;
294
+ aggregate?: AggregateRelation;
295
+ sort?: SortRelation;
296
+ set?: SetRelation;
297
+ single?: ExtensionSingleRelation;
298
+ leaf?: ExtensionLeafRelation;
299
+ multi?: ExtensionMultiRelation;
300
+ exchange?: ExchangeRelation;
301
+ read?: ReadRelation;
302
+ }
303
+ interface CastExpression {
304
+ type: LiteralType;
305
+ input: Expression;
306
+ failureBehavior: FailureBehavior;
307
+ }
308
+ declare enum SortDirection {
309
+ UNSPECIFIED = 0,
310
+ ASCENDING_NULLS_FIRST = 1,
311
+ ASCENDING_NULLS_LAST = 2,
312
+ DESCENDING_NULLS_FIRST = 3,
313
+ DESCENDING_NULLS_LAST = 4,
314
+ CLUSTERED = 5
315
+ }
316
+ interface SortField {
317
+ expr: Expression;
318
+ direction: SortDirection;
319
+ }
320
+ interface Literal extends LiteralType {
321
+ nullable: boolean;
322
+ typeVariationReference: number;
323
+ }
324
+ interface LiteralType {
325
+ bool?: BoolTyp;
326
+ i8?: number;
327
+ i16?: number;
328
+ i32?: I32;
329
+ i64?: I64;
330
+ fp32?: number;
331
+ fp64?: FP64;
332
+ string?: StrType;
333
+ binary?: Uint8Array;
334
+ timestamp?: number;
335
+ date?: Date;
336
+ time?: number;
337
+ intervalYearToMonth?: IntervalYearToMonth;
338
+ intervalDayToSecond?: IntervalDayToSecond;
339
+ fixedChar?: FixedChar | string;
340
+ varchar?: VarChar;
341
+ fixedBinary?: FixedBinary;
342
+ decimal?: Decimal;
343
+ struct?: Struct;
344
+ map?: MapTyp;
345
+ timestampTz?: TimestampTz;
346
+ uuid?: Uint8Array;
347
+ null?: unknown;
348
+ list?: List;
349
+ empty_list?: unknown;
350
+ empty_map?: unknown;
351
+ user_defined?: unknown;
352
+ }
353
+ interface FixedBinary {
354
+ typeVariationReference: number;
355
+ value?: Uint8Array;
356
+ length: number;
357
+ nullability: Nullability;
358
+ }
359
+ interface TimestampTz {
360
+ typeVariationReference: number;
361
+ value?: number;
362
+ nullability: Nullability;
363
+ }
364
+ interface BoolTyp {
365
+ typeVariationReference: number;
366
+ value?: boolean;
367
+ nullability: Nullability;
368
+ }
369
+ interface StrType {
370
+ typeVariationReference: number;
371
+ value?: string;
372
+ nullability: Nullability;
373
+ }
374
+ interface I32 {
375
+ typeVariationReference: number;
376
+ value?: number;
377
+ nullability: Nullability;
378
+ }
379
+ interface FP64 {
380
+ typeVariationReference: number;
381
+ value?: number;
382
+ nullability: Nullability;
383
+ }
384
+ interface I64 {
385
+ typeVariationReference: number;
386
+ value?: number;
387
+ nullability: Nullability;
388
+ }
389
+ interface Date {
390
+ typeVariationReference: number;
391
+ nullability: Nullability;
392
+ value?: number;
393
+ }
394
+ interface FixedChar {
395
+ typeVariationReference: number;
396
+ value?: string;
397
+ length: number;
398
+ nullability: Nullability;
399
+ }
400
+ interface VarChar {
401
+ typeVariationReference: number;
402
+ value?: string;
403
+ length: number;
404
+ nullability: Nullability;
405
+ }
406
+ interface Decimal {
407
+ value?: string;
408
+ precision: number;
409
+ scale: number;
410
+ nullability?: Nullability;
411
+ typeVariationReference?: number;
412
+ }
413
+ interface MapTyp {
414
+ typeVariationReference: number;
415
+ key_values: KeyValue[];
416
+ }
417
+ interface KeyValue {
418
+ key: Literal;
419
+ value: Literal;
420
+ }
421
+ interface IntervalYearToMonth {
422
+ typeVariationReference: number;
423
+ years: number;
424
+ months: number;
425
+ }
426
+ interface IntervalDayToSecond {
427
+ typeVariationReference: number;
428
+ days: number;
429
+ seconds: number;
430
+ microseconds: number;
431
+ }
432
+ interface List {
433
+ type: LiteralType;
434
+ typeVariationReference: number;
435
+ values?: Literal[];
436
+ nullability: Nullability;
437
+ }
438
+ interface ExtensionUri {
439
+ extensionUriAnchor: number;
440
+ uri: string;
441
+ }
442
+ interface Extension {
443
+ extensionFunction: ExtensionFunction;
444
+ }
445
+ interface NamedTable {
446
+ names: string[];
447
+ }
448
+ interface SimpleProperty {
449
+ name: string;
450
+ value: string;
451
+ }
452
+ interface NamedStruct {
453
+ names: string[];
454
+ struct: Struct;
455
+ }
456
+ interface Stats {
457
+ row_count: number;
458
+ record_size: number;
459
+ advancedExtension?: AdvancedExtension;
460
+ }
461
+ interface RuntimeConstraint {
462
+ advancedExtension?: AdvancedExtension;
463
+ }
464
+ interface Hint {
465
+ stats: Stats;
466
+ constraint: RuntimeConstraint;
467
+ advancedExtension?: AdvancedExtension;
468
+ }
469
+ interface RelCommon {
470
+ emit?: Emit;
471
+ hint?: Hint;
472
+ advancedExtension?: AdvancedExtension;
473
+ direct?: unknown;
474
+ }
475
+ interface Struct {
476
+ types: LiteralType[];
477
+ nullability: Nullability;
478
+ typeVariationReference: number;
479
+ fields?: Literal[];
480
+ }
481
+ interface Emit {
482
+ outputMapping: number[];
483
+ }
484
+ interface ReadRelation {
485
+ namedTable: NamedTable;
486
+ baseSchema: NamedStruct;
487
+ common: RelCommon;
488
+ }
489
+ interface ExtensionFunction {
490
+ functionAnchor: number;
491
+ name: string;
492
+ extensionUriReference: number;
493
+ }
494
+ interface Field {
495
+ name: string;
496
+ type: string;
497
+ nullability: Nullability;
498
+ children: Field[];
499
+ }
500
+ interface PrintNode {
501
+ id: string;
502
+ type: string;
503
+ inputs: PrintNode[];
504
+ props: SimpleProperty[];
505
+ schema: Field;
506
+ }
507
+ declare class SubstraitParser {
508
+ idCounters: Map<string, number>;
509
+ extSet: Map<number, string>;
510
+ fieldNames: string[];
511
+ selectedFields: string[];
512
+ filters: string[];
513
+ logicalOperators: LogicalOperator[];
514
+ /**
515
+ * Constructs a SubstraitParser
516
+ * @param {SubstraitPlan} plan the Substrait plan
517
+ */
518
+ constructor(plan: Plan);
519
+ /**
520
+ * Creates a map from anchor to function name
521
+ * @param {SubstraitPlan} plan the Substrait plan
522
+ * @return {Map<number, string>} the created mapping
523
+ */
524
+ buildExtensionSet(plan: Plan): Map<number, string>;
525
+ /**
526
+ * Geneate a unique id for the node
527
+ * @param {string} type The type of the node
528
+ * @return {string} A unique id
529
+ */
530
+ nextId(type: string): string;
531
+ /**
532
+ * Create a schema field
533
+ *
534
+ * This is a special field with an empty name and an empty type string
535
+ * and uknown nullability
536
+ *
537
+ * @param {Field[]} fields the fields of the schema
538
+ * @return {Field} a schema field
539
+ */
540
+ makeSchemaField(fields: Field[]): Field;
541
+ /**
542
+ * Applies a Substrait emit to an output schema
543
+ * @param {Field} schema the original output schema
544
+ * @param {Object} emit a potential remapping of fields
545
+ * @return {Field} the remapped output schema
546
+ */
547
+ applyEmit(schema: Field, emit?: Emit): Field;
548
+ /**
549
+ * Create a print node, generating a new id
550
+ *
551
+ * @param {string} type the node type
552
+ * @param {PrintNode[]} inputs the inputs to the node
553
+ * @param {SimpleProperty[]} props properties describing the node
554
+ * @param {Field} schema the output schema of the node
555
+ * @param {Object} emit the Substrait emit for the node
556
+ * @return {PrintNode} a print node
557
+ */
558
+ makePrintNode(type: string, inputs: PrintNode[], props: SimpleProperty[], schema: Field, emit?: Emit): PrintNode;
559
+ /**
560
+ * Recursive helper for structFieldToStr
561
+ * @param {*} field the Substrait field to convert
562
+ * @param {*} currentName the current name
563
+ * @param {Field} currentField the current input field
564
+ * @return {Field} a stringified represenstation
565
+ */
566
+ structFieldHelper(field: StructItem, currentName: string, currentField: Field): Field;
567
+ /**
568
+ * Convert a struct field to a stringified representation
569
+ *
570
+ * Struct fields are usually intuitively written with names.
571
+ * For example, a.b.c. However, fields in Substrait plans
572
+ * are not typically named. So instead we represent them as
573
+ * $0, $1, $2, ... where $N means the field at index N.
574
+ *
575
+ * If the field does happen to be named we will use that.
576
+ *
577
+ * @param {StructItem} field a Substrait struct field
578
+ * @param {Field} exprIn the input to the expression
579
+ * @return {Field} a stringified representation
580
+ */
581
+ structFieldToField(field: StructItem, exprIn: Field): Field;
582
+ /**
583
+ * Convert a direct reference to a stringified representation
584
+ * @param {Object} ref A Substrait direct reference
585
+ * @param {Object} exprIn the input to the expression
586
+ * @return {Field} a string representation
587
+ */
588
+ directReferenceToField(ref: ReferenceSegment, exprIn: Field): Field;
589
+ /**
590
+ * Convert a reference to a stringified representation
591
+ * @param {Object} ref A Substrait reference expression
592
+ * @param {Object} exprIn the input to the expression
593
+ * @return {Field} a string representation
594
+ */
595
+ referenceToField(ref: FieldReference, exprIn: Field): Field;
596
+ /**
597
+ * Convert a Substrait function argument to a string
598
+ * @param {Object} arg the argument to convert
599
+ * @param {Field} inp the input field
600
+ * @return {string} a string representation
601
+ */
602
+ functionArgumentToStr(arg: FunctionArgument, inp: Field): string;
603
+ /**
604
+ * Converts a Substrait function reference to a string
605
+ * @param {number} ref a Substrait function reference
606
+ * @return {string} a string version of the reference
607
+ */
608
+ functionRefToName(ref: number): string;
609
+ /**
610
+ * Convert arguments to a joined string
611
+ * @param {FunctionTyp} func A Substrait function call
612
+ * @param {Field} schema The input type
613
+ * @return {string} A string representation
614
+ */
615
+ argsToString(func: FunctionTyp, schema: Field): string;
616
+ /**
617
+ * Convert a scalar function to a stringified representation
618
+ * @param {Object} func the function to convert
619
+ * @param {Field} schema the input type info
620
+ * @return {Field} a string version of the function
621
+ */
622
+ scalarFunctionToField(func: ScalarFunction, schema: Field): Field;
623
+ /**
624
+ * Converts a Substrait literal to a field
625
+ * @param {Object} lit the Substrait literal
626
+ * @return {Field} a field representation
627
+ */
628
+ literalToField(lit: Literal): Field;
629
+ /**
630
+ * Convert a cast expression to a stringified representation
631
+ * @param {Object} cast A Substrait cast expression
632
+ * @param {Field} schema The input schema
633
+ * @return {Field} A field representation
634
+ */
635
+ castToField(cast: CastExpression, schema: Field): Field;
636
+ /**
637
+ * Convert an expression to a stringified representation
638
+ *
639
+ * The expression is returned as a field where the type
640
+ * of the field is the output type of the expression and the
641
+ * name of the field is a string representation of the expression
642
+ *
643
+ * @param {Object} expr A Substrait expression
644
+ * @param {Object} exprIn the input to the expression
645
+ * @return {Field} a string representation
646
+ */
647
+ expressionToStr(expr: Expression, exprIn: Field): Field;
648
+ /**
649
+ * Convert a project relation to a print node
650
+ * @param {Object} project A Substrait ProjectRel
651
+ * @return {PrintNode} a print node
652
+ */
653
+ projectToNode(project: ProjectRelation): PrintNode;
654
+ /**
655
+ * Convert a Substrait data type to an unnamed Field
656
+ *
657
+ * The field's name will be an empty string
658
+ *
659
+ * @param {Object} type a Substrait data type
660
+ * @return {Field} an unnamed field
661
+ */
662
+ typeToField(type: LiteralType): Field;
663
+ /**
664
+ * Convert a named struct to an array of Field
665
+ * @param {NamedStruct} struct a Substrait named struct
666
+ * @return {Field[]} named fields
667
+ */
668
+ namedStructToSchema(struct: NamedStruct): Field;
669
+ /**
670
+ * Extract the properties from a read relation
671
+ * @param {Object} read a Substrait read relation
672
+ * @return {SimpleProperty[]} properties for the relation
673
+ */
674
+ readTypeToProps(read: ReadRelation): SimpleProperty[];
675
+ /**
676
+ * Convert a Substrait read relation to a print node
677
+ * @param {Object} read a Substrait read relation
678
+ * @return {PrintNode} a print node
679
+ */
680
+ readToNode(read: ReadRelation): PrintNode;
681
+ /**
682
+ * True if the object has a field with the given name
683
+ * @param {Object} obj the object to test
684
+ * @param {string} fieldName the field name to look for
685
+ * @return {boolean} the result of the test
686
+ */
687
+ hasValue(obj: object, fieldName: string): boolean;
688
+ /**
689
+ * Convert a Substrait fetch relation to a print node
690
+ * @param {Object} fetch a Substrait fetch relation
691
+ * @return {PrintNode} a print node
692
+ */
693
+ fetchToNode(fetch: FetchRelation): PrintNode;
694
+ /**
695
+ * Convert a Substrait sort field to a property
696
+ * @param {Object} sortField a Substrait sort field
697
+ * @param {Field} schema the schema of the sort input
698
+ * @return {SimpleProperty} a property describing the sort
699
+ */
700
+ sortFieldToStr(sortField: SortField, schema: Field): string | undefined;
701
+ /**
702
+ * Convert a Substrait sort relation to a print node
703
+ * @param {Object} sort a Substrait sort relation
704
+ * @return {PrintNode} a print node
705
+ */
706
+ sortToNode(sort: SortRelation): PrintNode;
707
+ /**
708
+ * Convert a Substrait aggregate function to a field
709
+ * @param {Object} func the Substrait aggregate function
710
+ * @param {Field} inp the input field
711
+ * @return {Field} a field representation of the function
712
+ */
713
+ aggregateFunctionToField(func: AggregateFunction, inp: Field): Field;
714
+ /**
715
+ * Convert a Substrait aggregate relation to a print node
716
+ * @param {Object} agg a Substrait aggregate relation
717
+ * @return {PrintNode} a print node
718
+ */
719
+ aggToNode(agg: AggregateRelation): PrintNode;
720
+ /**
721
+ * Convert a Substrait filter relation to a print node
722
+ * @param {Object} filt a Substrait filter relation
723
+ * @return {PrintNode} a print node
724
+ */
725
+ filterToNode(filt: FilterRelation): PrintNode;
726
+ /**
727
+ * Converts a Substrait join relation to a print node
728
+ * @param {Object} join a Substrait join relation
729
+ * @return {PrintNode} a print node
730
+ */
731
+ joinToNode(join: JoinRelation): PrintNode;
732
+ /**
733
+ * Converts a Substrait relation to a print node
734
+ * @param {Object} rel the Substrait relation to convert
735
+ * @return {PrintNode} a print node
736
+ */
737
+ relToNode(rel: Rel): PrintNode;
738
+ /**
739
+ * Converts a Substrait root relation to a print node
740
+ * @param {Object} rel the Substrait relation to convert
741
+ * @return {PrintNode} a print node
742
+ */
743
+ rootRelToNode(rel: RelationRoot): PrintNode;
744
+ /**
745
+ * Converts a Substrait plan to a print node
746
+ * @param {Object} plan the Substrait plan to convert
747
+ * @return {PrintNode} a print node
748
+ */
749
+ planToNode(plan: Plan): PrintNode;
750
+ parse(plan: Plan): {
751
+ selection: string[];
752
+ filters: string[];
753
+ logicalOperators: LogicalOperator[];
754
+ };
755
+ /**
756
+ * Converts a base64 string into a decimal number.
757
+ *
758
+ * @public
759
+ * @param {string} base64 - The base64 string to convert.
760
+ * @param {number} precision - The total number of digits in the output number.
761
+ * @param {number} scale - The number of digits after the decimal point in the output number.
762
+ * @throws {Error} Will throw an error if the conversion fails.
763
+ * @returns {number} The converted decimal number.
764
+ * @example
765
+ * // returns 123.45
766
+ * this.base64ToDecimal('MTIzNDU=', 5, 2);
767
+ */
768
+ base64ToDecimal(base64: string, precision: number, scale: number): number;
769
+ private deduplicate;
770
+ }
771
+ export { SubstraitParser };