-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathcolumn.ts
1628 lines (1495 loc) · 68 KB
/
column.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2020-2022, NVIDIA CORPORATION.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {MemoryData} from '@rapidsai/cuda';
import {DeviceBuffer, MemoryResource} from '@rapidsai/rmm';
import * as CUDF from './addon';
import {Scalar} from './scalar';
import {Table} from './table';
import {
Bool8,
DataType,
Float32,
Float64,
IndexType,
Int32,
Int64,
Integral,
Numeric,
Timestamp,
Utf8String
} from './types/dtypes';
import {GetJSONObjectOptions} from './types/json';
import {CommonType, Interpolation} from './types/mappings';
export type PadSideType = 'left'|'right'|'both';
export type ColumnProps<T extends DataType = any> = {
/*
* ColumnProps *with* a `nullMask` shouldn't allow `data` to be an Array with elements and
* nulls:
* ```javascript
* new Column({
* type: new Int32,
* data: [1, 0, 2, 3, 0], ///< must not include nulls
* nullMask: [true, false, true, true, false]
* })
* ```
*/
type: T;
data?: DeviceBuffer | MemoryData | T['scalarType'][] | null;
offset?: number;
length?: number;
nullCount?: number;
nullMask?: DeviceBuffer | MemoryData | any[] | boolean | null;
children?: ReadonlyArray<Column>| null;
}|{
/*
* ColumnProps *without* a `nullMask` should allow `data` to be an Array with elements and
* nulls:
* ```javascript
* new Column({
* type: new Int32,
* data: [1, null, 2, 3, null] ///< can include nulls
* })
* ```
*/
type: T;
data?: DeviceBuffer|MemoryData|(T['scalarType'] | null | undefined)[]|null;
offset?: number;
length?: number;
nullCount?: number;
nullMask?: never;
children?: ReadonlyArray<Column>|null;
};
export interface ColumnConstructor {
readonly prototype: Column;
new<T extends DataType = any>(props: ColumnProps<T>): Column<T>;
/**
* Row-wise concatenates the given list of strings columns and returns a single strings column
* result.
*
* @param columns List of string columns to concatenate.
* @param separator String that should inserted between each string from each row.
* @param nullRepr String that should be used in place of any null strings found in any column.
* Null value means any null entry in any column will produces a null result for that row.
* @param separate_nulls If true, then the separator is included for null rows if nullRepr is
* valid.
* @param memoryResource The optional MemoryResource used to allocate the result column's device
* memory
* @returns New column with concatenated results.
*/
concatenate(columns: Table,
separator: string,
nullRepr: string|null,
separate_nulls: boolean,
memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Fills a column with a sequence of values specified by an initial value and a step of 1.
*
* @param size Size of the output column
* @param init First value in the sequence
* @param memoryResource The optional MemoryResource used to allocate the result column's device
* memory
* @returns column with the sequence
*/
sequence<U extends DataType>(size: number, init: Scalar<U>, memoryResource?: MemoryResource):
Column<U>;
/**
* Fills a column with a sequence of values specified by an initial value and a step.
*
* @param size Size of the output column
* @param init First value in the sequence
* @param step Increment value
* @param memoryResource The optional MemoryResource used to allocate the result column's device
* memory
* @returns column with the sequence
*/
sequence<U extends DataType>(size: number,
init: Scalar<U>,
step: Scalar<U>,
memoryResource?: MemoryResource): Column<U>;
/**
* Fills a column with the Utf-8 string located at filepath. If a delimiter is included then
* the input string will be split into a sequence of strings. The delimiter will remain
* at the end of each string in the column, except for the last. If no delimiter is included,
* the input string will be read into a single string at element 0 of the Colum.
*
* @param filepath The location of the input file.
* @param delimiter Optional delimiter.
* @param memoryResource The optional MemoryResource used to allocate the result column's device
* memory
* @returns column containing one or more strings.
*
* @note The maximum size of a string read with this method is 2^30
*/
readText(filepath: string, delimiter: string, memoryResource?: MemoryResource):
Column<Utf8String>;
}
/**
* A low-level wrapper for libcudf Column Objects
*/
export interface Column<T extends DataType = any> {
readonly type: T;
readonly data: DeviceBuffer;
readonly mask: DeviceBuffer;
readonly disposed: boolean;
readonly offset: number;
readonly length: number;
readonly nullable: boolean;
readonly hasNulls: boolean;
readonly nullCount: number;
readonly numChildren: number;
/**
* @summary Explicitly free the device memory associated with this Column and all child Columns.
*/
dispose(): void;
/**
* @summary Return sub-selection from a Column.
*
* @description Gathers the rows of the source columns according to `selection`, such that row "i"
* in the resulting Column's columns will contain row `selection[i]` from the source columns. The
* number of rows in the result column will be equal to the number of elements in selection. A
* negative value i in the selection is interpreted as i+n, where `n` is the number of rows in
* the source column.
*
* For dictionary columns, the keys column component is copied and not trimmed if the gather
* results in abandoned key elements.
*
* @param selection A Series of 8/16/32-bit signed or unsigned integer indices to gather.
* @param nullify_out_of_bounds If `true`, coerce rows that corresponds to out-of-bounds indices
* in the selection to null. If `false`, skips all bounds checking for selection values. Pass
* false if you are certain that the selection contains only valid indices for better
* performance. If `false` and there are out-of-bounds indices in the selection, the behavior
* is undefined. Defaults to `false`.
* @param memoryResource An optional MemoryResource used to allocate the result's device memory.
*/
gather(selection: Column<IndexType>,
nullify_out_of_bounds: boolean,
memoryResource?: MemoryResource): Column<T>;
/**
* Return sub-selection from a Column
*
* @param selection A Series of bools.
* @param memoryResource An optional MemoryResource used to allocate the result's device memory.
*/
applyBooleanMask(selection: Column<Bool8>, memoryResource?: MemoryResource): Column<T>;
/**
* Return a copy of a Column
*
*/
copy(memoryResource?: MemoryResource): Column<T>;
/**
* Return a child at the specified index to host memory
*
* @param index
*/
getChild<R extends DataType>(index: number): Column<R>;
/**
* Return a value at the specified index to host memory
*
* @param index
*/
getValue(index: number): T['scalarType']|null;
// setValue(index: number, value?: T['scalarType'] | null): void;
/**
* Set the null count for the null mask
*
* @param nullCount
*/
setNullCount(nullCount: number): void;
/**
*
* @param mask The null-mask. Valid values are marked as 1; otherwise 0. The
* mask bit given the data index idx is computed as:
* ```
* (mask[idx // 8] >> (idx % 8)) & 1
* ```
* @param nullCount The number of null values. If None, it is calculated
* automatically.
*/
setNullMask(mask: MemoryData|ArrayLike<number>|ArrayLike<bigint>, nullCount?: number): void;
/**
* Fills a range of elements in a column out-of-place with a scalar value.
*
* @param begin The starting index of the fill range (inclusive).
* @param end The index of the last element in the fill range (exclusive).
* @param value The scalar value to fill.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*/
fill(value: Scalar<T>, begin?: number, end?: number, memoryResource?: MemoryResource): Column<T>;
/**
* Repeats the values of this n times.
*
* @param repeats The number of times to repeat the column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*/
repeat(value: Scalar<T>, begin?: number, end?: number, memoryResource?: MemoryResource):
Column<T>;
/**
* Fills a range of elements in-place in a column with a scalar value.
*
* @param begin The starting index of the fill range (inclusive)
* @param end The index of the last element in the fill range (exclusive)
* @param value The scalar value to fill
*/
fillInPlace(value: Scalar<T>, begin?: number, end?: number): Column<T>;
/**
* Replace null values with a `Column`, `Scalar`, or the first/last non-null value.
*
* @param value The value to use in place of nulls.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*/
replaceNulls(value: Column<T>, memoryResource?: MemoryResource): Column<T>;
replaceNulls(value: Scalar<T>, memoryResource?: MemoryResource): Column<T>;
replaceNulls(value: boolean, memoryResource?: MemoryResource): Column<T>;
/**
* Concat a Column to the end of the caller, returning a new Column.
*
* @param other The Column to concat to the end of the caller.
*/
concat(other: Column<T>, memoryResource?: MemoryResource): Column<T>;
/**
* Replace NaN values with a scalar value, or the corresponding elements from another Column.
*
* @param value The value to use in place of NaNs.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*/
replaceNaNs(value: Column<T>, memoryResource?: MemoryResource): Column<T>;
replaceNaNs(value: Scalar<T>, memoryResource?: MemoryResource): Column<T>;
/**
* Add this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to add to this Column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
add(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
add(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
add<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
add<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Subtract this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to subtract from this Column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
sub(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
sub(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
sub<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
sub<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Multiply this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to multiply this column by.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
mul(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
mul(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
mul<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
mul<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Divide this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to divide this Column by.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
div(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
div(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
div<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
div<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* True-divide this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to true-divide this Column by.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
trueDiv(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
trueDiv(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
trueDiv<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
trueDiv<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Floor-divide this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to floor-divide this Column by.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
floorDiv(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
floorDiv(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
floorDiv<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
floorDiv<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Modulo this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to mod with this Column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
mod(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
mod(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
mod<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
mod<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Power this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use as the exponent for the power operation.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
pow(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
pow(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
pow<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
pow<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform the binary '==' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
eq(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
eq(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
eq<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
eq<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform the binary '!=' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
ne(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
ne(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
ne<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
ne<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform the binary '<' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
lt(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
lt(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
lt<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
lt<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform the binary '<=' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
le(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
le(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
le<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
le<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform the binary '>' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
gt(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
gt(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
gt<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
gt<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform the binary '>=' operation between this column and another Column or scalar value.
*
* @rhs The other Column or scalar to compare with this column.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of booleans with the comparison result.
*/
ge(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
ge(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
ge<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
ge<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform a binary `&` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
bitwiseAnd(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
bitwiseAnd(rhs: number, memoryResource?: MemoryResource): Column<T>;
bitwiseAnd<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
bitwiseAnd<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `|` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
bitwiseOr(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
bitwiseOr(rhs: number, memoryResource?: MemoryResource): Column<T>;
bitwiseOr<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
bitwiseOr<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `^` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
bitwiseXor(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
bitwiseXor(rhs: number, memoryResource?: MemoryResource): Column<T>;
bitwiseXor<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
bitwiseXor<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `&&` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
logicalAnd(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
logicalAnd(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
logicalAnd<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
logicalAnd<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `||` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
logicalOr(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
logicalOr(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
logicalOr<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
logicalOr<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `<<` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
shiftLeft(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
shiftLeft(rhs: number, memoryResource?: MemoryResource): Column<T>;
shiftLeft<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
shiftLeft<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `>>` operation between this Column and another Column or scalar
* value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
shiftRight(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
shiftRight(rhs: number, memoryResource?: MemoryResource): Column<T>;
shiftRight<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
shiftRight<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `shiftRightUnsigned` operation between this Column and another Column or
* scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
shiftRightUnsigned(rhs: bigint, memoryResource?: MemoryResource): Column<T>;
shiftRightUnsigned(rhs: number, memoryResource?: MemoryResource): Column<T>;
shiftRightUnsigned<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
shiftRightUnsigned<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `logBase` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
logBase(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
logBase(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
logBase<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
logBase<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `atan2` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
atan2(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
atan2(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
atan2<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
atan2<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `nullEquals` operation between this Column and another Column or scalar
* value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
nullEquals(rhs: bigint, memoryResource?: MemoryResource): Column<Bool8>;
nullEquals(rhs: number, memoryResource?: MemoryResource): Column<Bool8>;
nullEquals<R extends Numeric>(rhs: Scalar<R>, memoryResource?: MemoryResource): Column<Bool8>;
nullEquals<R extends Numeric>(rhs: Column<R>, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Perform a binary `nullMax` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
nullMax(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
nullMax(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
nullMax<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
nullMax<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Perform a binary `nullMin` operation between this Column and another Column or scalar value.
*
* @param rhs The other Column or scalar to use.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A Column of a common numeric type with the results of the binary operation.
*/
nullMin(rhs: bigint, memoryResource?: MemoryResource): Column<Int64>;
nullMin(rhs: number, memoryResource?: MemoryResource): Column<Float64>;
nullMin<R extends Numeric>(rhs: Scalar<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
nullMin<R extends Numeric>(rhs: Column<R>,
memoryResource?: MemoryResource): Column<CommonType<T, R>>;
/**
* Casts data from dtype specified in input to dtype specified in output.
*
* @note Supports only fixed-width types.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns Column of same size as `input` containing result of the cast operation.
*/
cast<R extends DataType>(dataType: R, memoryResource?: MemoryResource): Column<R>;
/**
* Creates a column of `BOOL8` elements where `true` indicates the value is null and `false`
* indicates the row matches the given pattern
*
* @param pattern Regex pattern to match to each string.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing `null`
* values.
*/
containsRe(pattern: string, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Creates a column of `INT32` elements where `true` indicates the number of times the given
* regex pattern matches in each string.
*
* @param pattern Regex pattern to match to each string.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `INT32` counts
*/
countRe(pattern: string, memoryResource?: MemoryResource): Column<Int32>;
/**
* Creates a column of `BOOL8` elements where `true` indicates the value is null and `false`
* indicates the row matches the given pattern only at the beginning of the string
*
* @param pattern Regex pattern to match to each string.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing `null`
* values.
*/
matchesRe(pattern: string, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Creates a column of `BOOL8` elements where `true` indicates the value is null and `false`
* indicates the value is valid.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing `null`
* values.
*/
isNull(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Creates a column of `BOOL8` elements where `true` indicates the value is valid and `false`
* indicates the value is null.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `false` representing `null`
* values.
*/
isValid(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Creates a column of `BOOL8` elements indicating the presence of `NaN` values in a
* column of floating point values. The output element at row `i` is `true` if the element in
* `input` at row i is `NAN`, else `false`
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing `NAN`
* values
*/
isNaN(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Creates a column of `BOOL8` elements indicating the absence of `NaN` values in a
* column of floating point values. The output element at row `i` is `false` if the element in
* `input` at row i is `NAN`, else `true`
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing non-`NAN`
* values
*/
isNotNaN(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Convert a list column of strings into a formatted strings column.
*
* The `separators` column should contain 3 strings elements in the following order:
* - element separator (default is comma `,`)
* - left-hand enclosure (default is `[`)
* - right-hand enclosure (default is `]`)
*
* @param na_rep Replacement string for null elements.
* @param separators Strings to use for enclosing list components and separating elements.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A string Column with the lists as strings.
*/
stringsFromLists(na_rep: string, separators: Column<Utf8String>, memoryResource?: MemoryResource):
Column<Utf8String>;
/**
* Returns a new strings column converting the boolean values from the provided column into
* strings.
*
* Any null entries will result in corresponding null entries in the output column.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A string Column with booleans as strings.
*/
stringsFromBooleans(memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Returns a new Bool8 column parsing true/false values from the provided strings column.
*
* Any null entries will result in corresponding null entries in the output column.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of boolean type with the results of the conversion.
*/
stringsToBooleans(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Returns a new timestamp column converting a strings column into timestamps using the provided
* format pattern.
*
* The format pattern can include the following specifiers: "%Y,%y,%m,%d,%H,%I,%p,%M,%S,%f,%z".
*
* @param format The string specifying output format. Default format is "%Y-%m-%dT%H:%M:%SZ".
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of boolean type with the results of the conversion.
*/
stringIsTimestamp(format: string, memoryResource?: MemoryResource): Column<Bool8>;
/**
* Returns a new strings column converting a timestamp column into strings using the provided
* format pattern.
*
* The format pattern can include the following specifiers: "%Y,%y,%m,%d,%H,%I,%p,%M,%S,%f,%z,%Z"
*
* @param format The string specifying output format. Default format is "%Y-%m-%dT%H:%M:%SZ".
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of string type with the results of the conversion.
*/
stringsFromTimestamps(format: string, memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Returns a new timestamp column converting a strings column into timestamps using the provided
* format pattern.
*
* The format pattern can include the following specifiers: "%Y,%y,%m,%d,%H,%I,%p,%M,%S,%f,%z".
*
* @param type The timestamp type used for creating the output column.
* @param format String specifying the timestamp format in strings.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of timestamp type with the results of the conversion.
*/
stringsToTimestamps<T extends Timestamp>(type: T,
format: string,
memoryResource?: MemoryResource): Column<T>;
/**
* Creates a column of `BOOL8` elements indicating strings in which all characters are valid for
* conversion to floats.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing convertible
* values
*/
stringIsFloat(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Returns a new strings column converting the float values from the provided column into strings.
*
* Any null entries will result in corresponding null entries in the output column.
*
* For each float, a string is created in base-10 decimal. Negative numbers will include a '-'
* prefix. Numbers producing more than 10 significant digits will produce a string that includes
* scientific notation (e.g. "-1.78e+15").
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A string Column with floats as strings.
*/
stringsFromFloats(memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Returns a new floating point numeric column parsing float values from the provided
* strings column.
*
* Any null entries will result in corresponding null entries in the output column.
*
* Only characters [0-9] plus a prefix '-' and '+' and decimal '.' are recognized. Additionally,
* scientific notation is also supported (e.g. "-1.78e+5").
*
* @param dataType Type of floating numeric column to return.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of a the specified float type with the results of the conversion.
*/
stringsToFloats<R extends Float32|Float64>(dataType: R,
memoryResource?: MemoryResource): Column<R>;
/**
* Creates a column of `BOOL8` elements indicating strings in which all characters are valid for
* conversion to floats.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing convertible
* values
*/
stringIsInteger(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Returns a new strings column converting the integer values from the provided column into
* strings.
*
* Any null entries will result in corresponding null entries in the output column.
*
* For each integer, a string is created in base-10 decimal. Negative numbers will include a '-'
* prefix.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A string Column with integers as strings.
*/
stringsFromIntegers(memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Returns a new integer numeric column parsing integer values from the provided strings column.
*
* Any null entries will result in corresponding null entries in the output column.
*
* Only characters [0-9] plus a prefix '-' and '+' are recognized. When any other character is
* encountered, the parsing ends for that string and the current digits are converted into an
* integer.
*
* Overflow of the resulting integer type is not checked. Each string is converted using an int64
* type and then cast to the target integer type before storing it into the output column. If the
* resulting integer type is too small to hold the value, the stored value will be undefined.
*
* @param dataType Type of integer numeric column to return.
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A Column of a the specified integral type with the results of the conversion.
*/
stringsToIntegers<R extends DataType>(dataType: R, memoryResource?: MemoryResource): Column<R>;
/**
* Returns a boolean column identifying strings in which all characters are valid for conversion
* to integers from hex.
*
* The output row entry will be set to true if the corresponding string element has at least one
* character in [0-9A-Za-z]. Also, the string may start with '0x'.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
* @returns A non-nullable column of `BOOL8` elements with `true` representing convertible
* values
*/
stringIsHex(memoryResource?: MemoryResource): Column<Bool8>;
/**
* Returns a new strings column converting integer columns to hexadecimal characters.
*
* Any null entries will result in corresponding null entries in the output column.
*
* The output character set is '0'-'9' and 'A'-'F'. The output string width will be a multiple of
* 2 depending on the size of the integer type. A single leading zero is applied to the first
* non-zero output byte if it less than 0x10.
*
* Leading zeros are suppressed unless filling out a complete byte as in 1234 -> 04D2 instead of
* 000004D2 or 4D2.
*
* @param memoryResource The optional MemoryResource used to allocate the result Column's device
* memory.
*
* @returns A string Column with integers as strings.
*/
hexFromIntegers(memoryResource?: MemoryResource): Column<Utf8String>;
/**
* Returns a new integer numeric column parsing hexadecimal values from the provided strings
* column.
*
* Any null entries will result in corresponding null entries in the output column.
*
* Only characters [0-9] and [A-F] are recognized. When any other character is encountered,
* the parsing ends for that string. No interpretation is made on the sign of the integer.
*
* Overflow of the resulting integer type is not checked. Each string is converted using an
* int64 type and then cast to the target integer type before storing it into the output column.
* If the resulting integer type is too small to hold the value, the stored value will be
* undefined.
*