-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathcolumn.hpp
1079 lines (944 loc) · 42.4 KB
/
column.hpp
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.
#pragma once
#include <node_cudf/scalar.hpp>
#include <node_cudf/utilities/dtypes.hpp>
#include <node_rmm/device_buffer.hpp>
#include <nv_node/objectwrap.hpp>
#include <nv_node/utilities/args.hpp>
#include <cudf/aggregation.hpp>
#include <cudf/binaryop.hpp>
#include <cudf/column/column_view.hpp>
#include <cudf/copying.hpp>
#include <cudf/reduction.hpp>
#include <cudf/replace.hpp>
#include <cudf/stream_compaction.hpp>
#include <cudf/strings/combine.hpp>
#include <cudf/strings/json.hpp>
#include <cudf/strings/padding.hpp>
#include <cudf/strings/regex/flags.hpp>
#include <cudf/types.hpp>
#include <cudf/unary.hpp>
#include <rmm/device_buffer.hpp>
#include <napi.h>
namespace nv {
/**
* @brief An owning wrapper around a cudf::Column.
*
*/
struct Column : public EnvLocalObjectWrap<Column> {
/**
* @brief Initialize and export the Column JavaScript constructor and prototype.
*
* @param env The active JavaScript environment.
* @param exports The exports object to decorate.
* @return Napi::Function The Column constructor function.
*/
static Napi::Function Init(Napi::Env const& env, Napi::Object exports);
/**
* @brief Construct a new Column instance from a cudf::column.
*
* @param column The column in device memory.
*/
static wrapper_t New(Napi::Env const& env, std::unique_ptr<cudf::column> column);
/**
* @brief Construct a new Column instance from JavaScript.
*
*/
Column(CallbackArgs const& args);
/**
* @brief Destructor called when the JavaScript VM garbage collects this Column
* instance.
*
* @param env The active JavaScript environment.
*/
void Finalize(Napi::Env) override;
/**
* @brief Explicitly free the device memory associated with this Column.
*
* @param env The active JavaScript environment.
*/
void dispose(Napi::Env);
/**
* @brief Returns the column's logical element type
*/
inline cudf::data_type type() const noexcept { return arrow_to_cudf_type(type_.Value()); }
/**
* @brief Returns the number of elements
*/
inline cudf::size_type size() const noexcept { return size_; }
/**
* @brief Returns the data element offset
*/
inline cudf::size_type offset() const noexcept { return offset_; }
/**
* @brief Return a const pointer to the data buffer
*/
inline DeviceBuffer::wrapper_t data() const { return data_.Value(); }
/**
* @brief Return a const pointer to the null bitmask buffer
*/
inline DeviceBuffer::wrapper_t null_mask() const { return null_mask_.Value(); }
/**
* @brief Sets the column's null value indicator bitmask to `new_null_mask`.
*
* @throw cudf::logic_error if new_null_count is larger than 0 and the size
* of `new_null_mask` does not match the size of this column.
*
* @param new_null_mask New null value indicator bitmask (lvalue overload &
* copied) to set the column's null value indicator mask. May be empty if
* `new_null_count` is 0 or `UNKOWN_NULL_COUNT`.
* @param new_null_count Optional, the count of null elements. If unknown,
* specify `UNKNOWN_NULL_COUNT` to indicate that the null count should be
* computed on the first invocation of `null_count()`.
*/
void set_null_mask(Napi::Value const& new_null_mask,
cudf::size_type new_null_count = cudf::UNKNOWN_NULL_COUNT);
/**
* @brief Updates the count of null elements.
*
* @note `UNKNOWN_NULL_COUNT` can be specified as `new_null_count` to force
* the next invocation of `null_count()` to recompute the null count from the
* null mask.
*
* @throw cudf::logic_error if `new_null_count > 0 and nullable() == false`
*
* @param new_null_count The new null count.
*/
void set_null_count(cudf::size_type new_null_count);
/**
* @brief Indicates whether it is possible for the column to contain null
* values, i.e., it has an allocated null mask.
*
* This may return `false` iff `null_count() == 0`.
*
* May return true even if `null_count() == 0`. This function simply indicates
* whether the column has an allocated null mask.
*
* @return true The column can hold null values
* @return false The column cannot hold null values
*/
inline bool nullable() const { return null_mask()->size() > 0; }
/**
* @brief Returns the count of null elements.
*
* @note If the column was constructed with `UNKNOWN_NULL_COUNT`, or if at any
* point `set_null_count(UNKNOWN_NULL_COUNT)` was invoked, then the
* first invocation of `null_count()` will compute and store the count of null
* elements indicated by the `null_mask` (if it exists).
*/
cudf::size_type null_count() const;
/**
* @brief Creates an immutable, non-owning view of the column's data and
* children.
*
* @return cudf::column_view The immutable, non-owning view
*/
cudf::column_view view() const;
/**
* @brief Returns the number of child columns
*/
inline cudf::size_type num_children() const { return children_.size(); }
/**
* @brief Returns a const reference to the specified child
*
* @param child_index Index of the desired child
* @return column const& Const reference to the desired child
*/
inline Column::wrapper_t child(cudf::size_type child_index) const noexcept {
return children_[child_index].Value();
};
/**
* @brief Returns aa vector of the column's childre
*
* @return Array of children
*/
inline Napi::Array children() const noexcept {
uint32_t idx = 0;
auto arr = Napi::Array::New(Env(), num_children());
std::for_each(children_.begin(),
children_.end(),
[&](Napi::Reference<Column::wrapper_t> const& val) mutable {
arr.Set((idx++), (val.Value()));
});
return arr;
}
/**
* @brief Creates a mutable, non-owning view of the column's data and
* children.
*
* @note Creating a mutable view of a `column` invalidates the `column`'s
* `null_count()` by setting it to `UNKNOWN_NULL_COUNT`. The user can
* either explicitly update the null count with `set_null_count()`, or
* if not, the null count will be recomputed on the next invocation of
*`null_count()`.
*
* @return cudf::mutable_column_view The mutable, non-owning view
*/
cudf::mutable_column_view mutable_view();
/**
* @brief Implicit conversion operator to a `column_view`.
*
* This allows passing a `column` object directly into a function that
* requires a `column_view`. The conversion is automatic.
*
* @return cudf::column_view Immutable, non-owning `column_view`
*/
inline operator cudf::column_view() const { return this->view(); };
/**
* @brief Implicit conversion operator to a `mutable_column_view`.
*
* This allows pasing a `column` object into a function that accepts a
*`mutable_column_view`. The conversion is automatic.
* @note Creating a mutable view of a `column` invalidates the `column`'s
* `null_count()` by setting it to `UNKNOWN_NULL_COUNT`. For best performance,
* the user should explicitly update the null count with `set_null_count()`.
* Otherwise, the null count will be recomputed on the next invocation of
* `null_count()`.
*
* @return cudf::mutable_column_view Mutable, non-owning `mutable_column_view`
*/
inline operator cudf::mutable_column_view() { return this->mutable_view(); };
// column/reductions.cpp
/**
* @copydoc cudf::minmax(cudf::column_view const& col, rmm::mr::device_memory_resource* mr)
*
* @return std::pair<Scalar, Scalar>
*/
std::pair<Scalar::wrapper_t, Scalar::wrapper_t> minmax(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @copydoc cudf::reduce(cudf::column_view const &col, std::unique_ptr<aggregation> const &agg,
* data_type output_dtype, rmm::mr::device_memory_resource* mr)
*
* @return Scalar
*/
Scalar::wrapper_t reduce(
std::unique_ptr<cudf::reduce_aggregation> const& agg,
cudf::data_type const& output_dtype,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @copydoc cudf::scan(cudf::column_view const &col, std::unique_ptr<aggregation> const &agg,
* cudf::scan_type inclusive, cudf::null_policy null_handling, rmm::mr::device_memory_resource*
* mr)
*
* @return Column
*/
Column::wrapper_t scan(
std::unique_ptr<cudf::scan_aggregation> const& agg,
cudf::scan_type inclusive,
cudf::null_policy null_handling = cudf::null_policy::EXCLUDE,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @copydoc cudf::sum(rmm::mr::device_memory_resource* mr)
*
* @return Scalar
*/
Scalar::wrapper_t sum(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @copydoc cudf::product(rmm::mr::device_memory_resource* mr)
*
* @return Scalar
*/
Scalar::wrapper_t product(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @copydoc cudf::sum_of_squares(rmm::mr::device_memory_resource* mr)
*
* @return Scalar
*/
Scalar::wrapper_t sum_of_squares(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_mean_aggregation()
*
* @param rmm::mr::device_memory_resource* mr
*
* @return Scalar
*/
Scalar::wrapper_t mean(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_median_aggregation()
*
* @param rmm::mr::device_memory_resource* mr
*
* @return Scalar
*/
Scalar::wrapper_t median(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_nunique_aggregation()
*
* @param bool dropna if true, compute using cudf::null_policy::EXCLUDE, else use
* cudf::null_policy::INCLUDE
* @param rmm::mr::device_memory_resource* mr
* @return Scalar
*/
Scalar::wrapper_t nunique(
bool dropna = true,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_variance_aggregation(ddof)
*
* @param cudf::size_type ddof Delta Degrees of Freedom. The divisor used in calculations is
* N - ddof, where N represents the number of elements. default is 1
* @param rmm::mr::device_memory_resource* mr
* @return Scalar
*/
Scalar::wrapper_t variance(
cudf::size_type ddof = 1,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_std_aggregation(ddof)
*
* @param cudf::size_type ddof Delta Degrees of Freedom. The divisor used in calculations is
* N - ddof, where N represents the number of elements. default is 1
* @param rmm::mr::device_memory_resource* mr
* @return Scalar
*/
Scalar::wrapper_t std(
cudf::size_type ddof = 1,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Returns a reduce computation based on cudf::make_quantile_aggregation(q, i)
*
* @param double q the quantile(s) to compute, 0<=q<=1, default 0.5
* @param rmm::mr::device_memory_resource* mr
* @return Scalar
*/
Scalar::wrapper_t quantile(
double q = 0.5,
cudf::interpolation i = cudf::interpolation::LINEAR,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Return the cumulative max
*
* @return Scalar
*/
Column::wrapper_t cumulative_max(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Return the cumulative minimum
*
* @return Scalar
*/
Column::wrapper_t cumulative_min(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Return the cumulative product
*
* @return Scalar
*/
Column::wrapper_t cumulative_product(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
/**
* @brief Return the cumulative sum
*
* @return Scalar
*/
Column::wrapper_t cumulative_sum(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/binaryop.cpp
// cudf::binary_operator::ADD
Column::wrapper_t operator+(Column const& other) const;
Column::wrapper_t operator+(Scalar const& other) const;
Column::wrapper_t add(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t add(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::SUB
Column::wrapper_t operator-(Column const& other) const;
Column::wrapper_t operator-(Scalar const& other) const;
Column::wrapper_t sub(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t sub(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::MUL
Column::wrapper_t operator*(Column const& other) const;
Column::wrapper_t operator*(Scalar const& other) const;
Column::wrapper_t mul(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t mul(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::DIV
Column::wrapper_t operator/(Column const& other) const;
Column::wrapper_t operator/(Scalar const& other) const;
Column::wrapper_t div(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t div(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::TRUE_DIV
Column::wrapper_t true_div(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t true_div(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::FLOOR_DIV
Column::wrapper_t floor_div(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t floor_div(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::MOD
Column::wrapper_t operator%(Column const& other) const;
Column::wrapper_t operator%(Scalar const& other) const;
Column::wrapper_t mod(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t mod(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::POW
Column::wrapper_t pow(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t pow(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::EQUAL
Column::wrapper_t operator==(Column const& other) const;
Column::wrapper_t operator==(Scalar const& other) const;
Column::wrapper_t eq(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t eq(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::NOT_EQUAL
Column::wrapper_t operator!=(Column const& other) const;
Column::wrapper_t operator!=(Scalar const& other) const;
Column::wrapper_t ne(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t ne(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::LESS
Column::wrapper_t operator<(Column const& other) const;
Column::wrapper_t operator<(Scalar const& other) const;
Column::wrapper_t lt(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t lt(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::GREATER
Column::wrapper_t operator>(Column const& other) const;
Column::wrapper_t operator>(Scalar const& other) const;
Column::wrapper_t gt(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t gt(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::LESS_EQUAL
Column::wrapper_t operator<=(Column const& other) const;
Column::wrapper_t operator<=(Scalar const& other) const;
Column::wrapper_t le(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t le(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::GREATER_EQUAL
Column::wrapper_t operator>=(Column const& other) const;
Column::wrapper_t operator>=(Scalar const& other) const;
Column::wrapper_t ge(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t ge(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::BITWISE_AND
Column::wrapper_t operator&(Column const& other) const;
Column::wrapper_t operator&(Scalar const& other) const;
Column::wrapper_t bitwise_and(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t bitwise_and(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::BITWISE_OR
Column::wrapper_t operator|(Column const& other) const;
Column::wrapper_t operator|(Scalar const& other) const;
Column::wrapper_t bitwise_or(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t bitwise_or(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::BITWISE_XOR
Column::wrapper_t operator^(Column const& other) const;
Column::wrapper_t operator^(Scalar const& other) const;
Column::wrapper_t bitwise_xor(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t bitwise_xor(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::LOGICAL_AND
Column::wrapper_t operator&&(Column const& other) const;
Column::wrapper_t operator&&(Scalar const& other) const;
Column::wrapper_t logical_and(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t logical_and(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::LOGICAL_OR
Column::wrapper_t operator||(Column const& other) const;
Column::wrapper_t operator||(Scalar const& other) const;
Column::wrapper_t logical_or(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t logical_or(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::SHIFT_LEFT
Column::wrapper_t operator<<(Column const& other) const;
Column::wrapper_t operator<<(Scalar const& other) const;
Column::wrapper_t shift_left(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t shift_left(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::SHIFT_RIGHT
Column::wrapper_t operator>>(Column const& other) const;
Column::wrapper_t operator>>(Scalar const& other) const;
Column::wrapper_t shift_right(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t shift_right(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::SHIFT_RIGHT_UNSIGNED
Column::wrapper_t shift_right_unsigned(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t shift_right_unsigned(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::LOG_BASE
Column::wrapper_t log_base(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t log_base(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::ATAN2
Column::wrapper_t atan2(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t atan2(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::NULL_EQUALS
Column::wrapper_t null_equals(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t null_equals(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::NULL_MAX
Column::wrapper_t null_max(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t null_max(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// cudf::binary_operator::NULL_MIN
Column::wrapper_t null_min(
Column const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t null_min(
Scalar const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t operator[](Column const& gather_map) const;
Column::wrapper_t binary_operation(
Column const& rhs,
cudf::binary_operator op,
cudf::type_id output_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t binary_operation(
Scalar const& rhs,
cudf::binary_operator op,
cudf::type_id output_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/concatenate.cpp
Column::wrapper_t concat(
cudf::column_view const& other,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/stream_compaction.cpp
Column::wrapper_t apply_boolean_mask(
Column const& boolean_mask,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t drop_nulls(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t drop_nans(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/filling.cpp
static Column::wrapper_t sequence(
Napi::Env const& env,
cudf::size_type size,
cudf::scalar const& init,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
static Column::wrapper_t sequence(
Napi::Env const& env,
cudf::size_type size,
cudf::scalar const& init,
cudf::scalar const& step,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
inline static Column::wrapper_t sequence(
Napi::Env const& env,
cudf::size_type size,
Scalar::wrapper_t const& init,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) {
return sequence(env, size, init->operator cudf::scalar&(), mr);
}
inline static Column::wrapper_t sequence(
Napi::Env const& env,
cudf::size_type size,
Scalar::wrapper_t const& init,
Scalar::wrapper_t const& step,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) {
return sequence(env, size, init->operator cudf::scalar&(), step->operator cudf::scalar&(), mr);
}
inline static Column::wrapper_t zeros(
Napi::Env const& env,
cudf::type_id type,
cudf::size_type size,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) {
auto zero = Scalar::New(env, Napi::Number::New(env, 0), cudf::data_type{type});
return sequence(env, size, zero->operator cudf::scalar&(), zero->operator cudf::scalar&(), mr);
}
// column/transform.cpp
std::pair<std::unique_ptr<rmm::device_buffer>, cudf::size_type> nans_to_nulls(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
std::pair<std::unique_ptr<rmm::device_buffer>, cudf::size_type> bools_to_mask(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/copying.cpp
Column::wrapper_t gather(
Column const& gather_map,
cudf::out_of_bounds_policy bounds_policy = cudf::out_of_bounds_policy::DONT_CHECK,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/filling.cpp
Column::wrapper_t fill(
cudf::size_type begin,
cudf::size_type end,
cudf::scalar const& value,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/filling/repeat.cpp
Column::wrapper_t repeat(
cudf::size_type repeats,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/replace.cpp
Column::wrapper_t replace_nulls(
cudf::column_view const& replacement,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
Column::wrapper_t replace_nulls(
cudf::scalar const& replacement,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
Column::wrapper_t replace_nulls(
cudf::replace_policy const& replace_policy,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
Column::wrapper_t replace_nans(
cudf::column_view const& replacement,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
Column::wrapper_t replace_nans(
cudf::scalar const& replacement,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/unaryop.cpp
Column::wrapper_t cast(
cudf::data_type out_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t is_null(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t is_valid(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t is_nan(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t is_not_nan(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t unary_operation(
cudf::unary_operator op,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/strings/attributes.cpp
Column::wrapper_t count_bytes(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t count_characters(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/strings/combine.cpp
static Column::wrapper_t concatenate(
Napi::Env const& env,
cudf::table_view const& columns,
cudf::string_scalar const& separator,
cudf::string_scalar const& narep,
cudf::strings::separator_on_nulls separator_on_nulls,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/strings/contains.cpp
Column::wrapper_t contains_re(
std::string const& pattern,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t count_re(
std::string const& pattern,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t matches_re(
std::string const& pattern,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/strings/json.cpp
Column::wrapper_t get_json_object(
std::string const& json_path,
cudf::strings::get_json_object_options const& opts,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
// column/strings/padding.cpp
Column::wrapper_t pad(
cudf::size_type width,
cudf::strings::pad_side pad_side,
std::string const& fill_char,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t zfill(
cudf::size_type width,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/strings/replace_re.cpp
Column::wrapper_t replace_re(
std::string const& pattern,
std::string const& replacement,
cudf::size_type max_replace_count = -1,
cudf::strings::regex_flags const flags = cudf::strings::regex_flags::DEFAULT,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/strings/replace_slice.cpp
Column::wrapper_t replace_slice(
std::string const& repl = "",
cudf::size_type start = 0,
cudf::size_type stop = -1,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
// column/convert.cpp
Column::wrapper_t strings_from_booleans(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t strings_to_booleans(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t string_is_timestamp(std::string_view format,
rmm::mr::device_memory_resource* mr) const;
Column::wrapper_t strings_from_timestamps(std::string_view format,
rmm::mr::device_memory_resource* mr) const;
Column::wrapper_t strings_to_timestamps(cudf::data_type timestamp_type,
std::string_view format,
rmm::mr::device_memory_resource* mr) const;
Column::wrapper_t string_is_float(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t strings_from_floats(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t strings_to_floats(
cudf::data_type out_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t string_is_integer(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t strings_from_integers(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t strings_to_integers(
cudf::data_type out_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t string_is_hex(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t hex_from_integers(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t hex_to_integers(
cudf::data_type out_type,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t string_is_ipv4(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t ipv4_from_integers(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
Column::wrapper_t ipv4_to_integers(
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) const;
private:
cudf::size_type size_{}; ///< The number of elements in the column
cudf::size_type offset_{}; ///< The offset of elements in the data
Napi::Reference<Napi::Object> type_; ///< Logical type of elements in the column
Napi::Reference<DeviceBuffer::wrapper_t> data_; ///< Dense, contiguous, type erased device memory
///< buffer containing the column elements
Napi::Reference<DeviceBuffer::wrapper_t> null_mask_; ///< Bitmask used to represent null values.
///< May be empty if `null_count() == 0`
mutable cudf::size_type null_count_{cudf::UNKNOWN_NULL_COUNT}; ///< The number of null elements
std::vector<Napi::Reference<Column::wrapper_t>>
children_; ///< Depending on element type, child
///< columns may contain additional data
bool disposed_{false}; ///< Flag indicating this column has been disposed
Napi::Value type(Napi::CallbackInfo const& info);
void type(Napi::CallbackInfo const& info, Napi::Value const& value);
Napi::Value offset(Napi::CallbackInfo const& info);
Napi::Value size(Napi::CallbackInfo const& info);
Napi::Value data(Napi::CallbackInfo const& info);
Napi::Value null_mask(Napi::CallbackInfo const& info);
Napi::Value disposed(Napi::CallbackInfo const& info);
Napi::Value has_nulls(Napi::CallbackInfo const& info);
Napi::Value null_count(Napi::CallbackInfo const& info);
Napi::Value is_nullable(Napi::CallbackInfo const& info);
Napi::Value num_children(Napi::CallbackInfo const& info);
void dispose(Napi::CallbackInfo const&);
Napi::Value gather(Napi::CallbackInfo const& info);
Napi::Value apply_boolean_mask(Napi::CallbackInfo const& info);
Napi::Value copy(Napi::CallbackInfo const& info);
Napi::Value get_child(Napi::CallbackInfo const& info);
Napi::Value get_value(Napi::CallbackInfo const& info);
void set_null_mask(Napi::CallbackInfo const& info);
void set_null_count(Napi::CallbackInfo const& info);
// column/binaryop.cpp
Napi::Value add(Napi::CallbackInfo const& info);
Napi::Value sub(Napi::CallbackInfo const& info);
Napi::Value mul(Napi::CallbackInfo const& info);
Napi::Value div(Napi::CallbackInfo const& info);
Napi::Value true_div(Napi::CallbackInfo const& info);
Napi::Value floor_div(Napi::CallbackInfo const& info);
Napi::Value mod(Napi::CallbackInfo const& info);
Napi::Value pow(Napi::CallbackInfo const& info);
Napi::Value eq(Napi::CallbackInfo const& info);
Napi::Value ne(Napi::CallbackInfo const& info);
Napi::Value lt(Napi::CallbackInfo const& info);
Napi::Value gt(Napi::CallbackInfo const& info);
Napi::Value le(Napi::CallbackInfo const& info);
Napi::Value ge(Napi::CallbackInfo const& info);
Napi::Value bitwise_and(Napi::CallbackInfo const& info);
Napi::Value bitwise_or(Napi::CallbackInfo const& info);
Napi::Value bitwise_xor(Napi::CallbackInfo const& info);
Napi::Value logical_and(Napi::CallbackInfo const& info);
Napi::Value logical_or(Napi::CallbackInfo const& info);
Napi::Value shift_left(Napi::CallbackInfo const& info);
Napi::Value shift_right(Napi::CallbackInfo const& info);
Napi::Value shift_right_unsigned(Napi::CallbackInfo const& info);
Napi::Value log_base(Napi::CallbackInfo const& info);
Napi::Value atan2(Napi::CallbackInfo const& info);
Napi::Value null_equals(Napi::CallbackInfo const& info);
Napi::Value null_max(Napi::CallbackInfo const& info);
Napi::Value null_min(Napi::CallbackInfo const& info);
// column/concatenate.cpp
Napi::Value concat(Napi::CallbackInfo const& info);
// column/filling.cpp
Napi::Value fill(Napi::CallbackInfo const& info);
void fill_in_place(Napi::CallbackInfo const& info);
// column/stream_compaction.cpp
Napi::Value drop_nulls(Napi::CallbackInfo const& info);
Napi::Value drop_nans(Napi::CallbackInfo const& info);
// column/filling.cpp
static Napi::Value sequence(Napi::CallbackInfo const& info);
// column/transform.cpp
Napi::Value bools_to_mask(Napi::CallbackInfo const& info);
Napi::Value nans_to_nulls(Napi::CallbackInfo const& info);
// column/reductions.cpp
Napi::Value min(Napi::CallbackInfo const& info);
Napi::Value max(Napi::CallbackInfo const& info);
Napi::Value minmax(Napi::CallbackInfo const& info);
Napi::Value sum(Napi::CallbackInfo const& info);
Napi::Value product(Napi::CallbackInfo const& info);
Napi::Value any(Napi::CallbackInfo const& info);
Napi::Value all(Napi::CallbackInfo const& info);
Napi::Value sum_of_squares(Napi::CallbackInfo const& info);
Napi::Value mean(Napi::CallbackInfo const& info);
Napi::Value median(Napi::CallbackInfo const& info);
Napi::Value nunique(Napi::CallbackInfo const& info);
Napi::Value variance(Napi::CallbackInfo const& info);
Napi::Value std(Napi::CallbackInfo const& info);
Napi::Value quantile(Napi::CallbackInfo const& info);
Napi::Value cumulative_max(Napi::CallbackInfo const& info);
Napi::Value cumulative_min(Napi::CallbackInfo const& info);
Napi::Value cumulative_product(Napi::CallbackInfo const& info);
Napi::Value cumulative_sum(Napi::CallbackInfo const& info);
// column/replace.cpp
Napi::Value replace_nulls(Napi::CallbackInfo const& info);
Napi::Value replace_nans(Napi::CallbackInfo const& info);
// column/unaryop.cpp
Napi::Value cast(Napi::CallbackInfo const& info);
Napi::Value is_null(Napi::CallbackInfo const& info);
Napi::Value is_valid(Napi::CallbackInfo const& info);
Napi::Value is_nan(Napi::CallbackInfo const& info);