polars-df 0.20.0 → 0.21.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/Cargo.lock +192 -186
- data/LICENSE.txt +1 -1
- data/ext/polars/Cargo.toml +19 -9
- data/ext/polars/src/batched_csv.rs +2 -2
- data/ext/polars/src/catalog/mod.rs +1 -0
- data/ext/polars/src/catalog/unity.rs +450 -0
- data/ext/polars/src/conversion/any_value.rs +9 -19
- data/ext/polars/src/conversion/categorical.rs +30 -0
- data/ext/polars/src/conversion/chunked_array.rs +8 -8
- data/ext/polars/src/conversion/mod.rs +275 -109
- data/ext/polars/src/dataframe/construction.rs +2 -2
- data/ext/polars/src/dataframe/export.rs +2 -2
- data/ext/polars/src/dataframe/general.rs +4 -2
- data/ext/polars/src/dataframe/io.rs +2 -2
- data/ext/polars/src/exceptions.rs +2 -1
- data/ext/polars/src/expr/array.rs +73 -4
- data/ext/polars/src/expr/binary.rs +26 -1
- data/ext/polars/src/expr/bitwise.rs +39 -0
- data/ext/polars/src/expr/categorical.rs +20 -0
- data/ext/polars/src/expr/datatype.rs +37 -0
- data/ext/polars/src/expr/datetime.rs +58 -0
- data/ext/polars/src/expr/general.rs +106 -22
- data/ext/polars/src/expr/list.rs +45 -2
- data/ext/polars/src/expr/meta.rs +5 -28
- data/ext/polars/src/expr/mod.rs +4 -1
- data/ext/polars/src/expr/name.rs +10 -2
- data/ext/polars/src/expr/rolling.rs +21 -1
- data/ext/polars/src/expr/selector.rs +219 -0
- data/ext/polars/src/expr/string.rs +73 -6
- data/ext/polars/src/expr/struct.rs +9 -1
- data/ext/polars/src/file.rs +11 -5
- data/ext/polars/src/functions/io.rs +21 -11
- data/ext/polars/src/functions/lazy.rs +26 -54
- data/ext/polars/src/functions/meta.rs +2 -2
- data/ext/polars/src/functions/misc.rs +1 -1
- data/ext/polars/src/functions/string_cache.rs +4 -5
- data/ext/polars/src/interop/numo/numo_rs.rs +1 -1
- data/ext/polars/src/interop/numo/to_numo_series.rs +1 -1
- data/ext/polars/src/io/mod.rs +102 -0
- data/ext/polars/src/lazyframe/general.rs +124 -111
- data/ext/polars/src/lazyframe/serde.rs +1 -1
- data/ext/polars/src/lazyframe/sink.rs +6 -6
- data/ext/polars/src/lib.rs +216 -29
- data/ext/polars/src/map/dataframe.rs +9 -9
- data/ext/polars/src/map/lazy.rs +1 -1
- data/ext/polars/src/map/mod.rs +31 -19
- data/ext/polars/src/map/series.rs +9 -9
- data/ext/polars/src/on_startup.rs +5 -2
- data/ext/polars/src/rb_modules.rs +1 -1
- data/ext/polars/src/series/aggregation.rs +44 -0
- data/ext/polars/src/series/construction.rs +11 -7
- data/ext/polars/src/series/export.rs +6 -4
- data/ext/polars/src/series/general.rs +75 -210
- data/ext/polars/src/series/import.rs +2 -2
- data/ext/polars/src/series/map.rs +227 -0
- data/ext/polars/src/series/mod.rs +2 -1
- data/ext/polars/src/series/scatter.rs +1 -1
- data/ext/polars/src/utils.rs +10 -2
- data/lib/polars/array_expr.rb +382 -3
- data/lib/polars/array_name_space.rb +281 -0
- data/lib/polars/binary_expr.rb +67 -0
- data/lib/polars/binary_name_space.rb +43 -0
- data/lib/polars/cat_expr.rb +224 -0
- data/lib/polars/cat_name_space.rb +130 -32
- data/lib/polars/catalog/unity/catalog_info.rb +20 -0
- data/lib/polars/catalog/unity/column_info.rb +31 -0
- data/lib/polars/catalog/unity/namespace_info.rb +21 -0
- data/lib/polars/catalog/unity/table_info.rb +50 -0
- data/lib/polars/catalog.rb +448 -0
- data/lib/polars/config.rb +2 -2
- data/lib/polars/convert.rb +12 -2
- data/lib/polars/data_frame.rb +834 -48
- data/lib/polars/data_type_expr.rb +52 -0
- data/lib/polars/data_types.rb +61 -5
- data/lib/polars/date_time_expr.rb +251 -0
- data/lib/polars/date_time_name_space.rb +299 -0
- data/lib/polars/exceptions.rb +7 -2
- data/lib/polars/expr.rb +1247 -211
- data/lib/polars/functions/col.rb +6 -5
- data/lib/polars/functions/datatype.rb +21 -0
- data/lib/polars/functions/lazy.rb +127 -15
- data/lib/polars/functions/repeat.rb +4 -0
- data/lib/polars/io/csv.rb +19 -1
- data/lib/polars/io/json.rb +16 -0
- data/lib/polars/io/ndjson.rb +13 -0
- data/lib/polars/io/parquet.rb +70 -66
- data/lib/polars/io/scan_options.rb +47 -0
- data/lib/polars/lazy_frame.rb +1099 -95
- data/lib/polars/list_expr.rb +400 -11
- data/lib/polars/list_name_space.rb +321 -5
- data/lib/polars/meta_expr.rb +71 -22
- data/lib/polars/name_expr.rb +36 -0
- data/lib/polars/scan_cast_options.rb +64 -0
- data/lib/polars/schema.rb +84 -3
- data/lib/polars/selector.rb +210 -0
- data/lib/polars/selectors.rb +932 -203
- data/lib/polars/series.rb +1083 -63
- data/lib/polars/string_expr.rb +435 -9
- data/lib/polars/string_name_space.rb +729 -45
- data/lib/polars/struct_expr.rb +103 -0
- data/lib/polars/struct_name_space.rb +19 -1
- data/lib/polars/utils/parse.rb +40 -0
- data/lib/polars/utils/various.rb +18 -1
- data/lib/polars/utils.rb +9 -1
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +10 -0
- metadata +20 -2
data/ext/polars/src/lib.rs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
mod allocator;
|
2
2
|
mod batched_csv;
|
3
|
+
mod catalog;
|
3
4
|
mod conversion;
|
4
5
|
mod dataframe;
|
5
6
|
mod error;
|
@@ -8,6 +9,7 @@ mod expr;
|
|
8
9
|
mod file;
|
9
10
|
mod functions;
|
10
11
|
mod interop;
|
12
|
+
mod io;
|
11
13
|
mod lazyframe;
|
12
14
|
mod lazygroupby;
|
13
15
|
mod map;
|
@@ -20,23 +22,26 @@ mod sql;
|
|
20
22
|
mod utils;
|
21
23
|
|
22
24
|
use batched_csv::RbBatchedCsv;
|
25
|
+
use catalog::unity::RbCatalogClient;
|
23
26
|
use conversion::*;
|
24
27
|
use dataframe::RbDataFrame;
|
25
28
|
use error::RbPolarsErr;
|
26
29
|
use exceptions::{RbTypeError, RbValueError};
|
27
|
-
use expr::rb_exprs_to_exprs;
|
28
30
|
use expr::RbExpr;
|
31
|
+
use expr::datatype::RbDataTypeExpr;
|
32
|
+
use expr::rb_exprs_to_exprs;
|
33
|
+
use expr::selector::RbSelector;
|
29
34
|
use functions::string_cache::RbStringCacheHolder;
|
30
35
|
use functions::whenthen::{RbChainedThen, RbChainedWhen, RbThen, RbWhen};
|
31
36
|
use interop::arrow::to_ruby::RbArrowArrayStream;
|
32
37
|
use lazyframe::RbLazyFrame;
|
33
38
|
use lazygroupby::RbLazyGroupBy;
|
34
|
-
use magnus::{define_module, function, method, prelude
|
39
|
+
use magnus::{Ruby, define_module, function, method, prelude::*};
|
35
40
|
use series::RbSeries;
|
36
41
|
use sql::RbSQLContext;
|
37
42
|
|
38
|
-
use magnus::error::Result as RbResult;
|
39
43
|
use magnus::Error as RbErr;
|
44
|
+
use magnus::error::Result as RbResult;
|
40
45
|
|
41
46
|
// TODO move
|
42
47
|
fn re_escape(pattern: String) -> String {
|
@@ -143,7 +148,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
143
148
|
class.define_method("pivot_expr", method!(RbDataFrame::pivot_expr, 7))?;
|
144
149
|
class.define_method("partition_by", method!(RbDataFrame::partition_by, 3))?;
|
145
150
|
class.define_method("lazy", method!(RbDataFrame::lazy, 0))?;
|
146
|
-
class.define_method("to_dummies", method!(RbDataFrame::to_dummies,
|
151
|
+
class.define_method("to_dummies", method!(RbDataFrame::to_dummies, 4))?;
|
147
152
|
class.define_method("null_count", method!(RbDataFrame::null_count, 0))?;
|
148
153
|
class.define_method("map_rows", method!(RbDataFrame::map_rows, 3))?;
|
149
154
|
class.define_method("shrink_to_fit", method!(RbDataFrame::shrink_to_fit, 0))?;
|
@@ -217,6 +222,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
217
222
|
class.define_method("peak_max", method!(RbExpr::peak_max, 0))?;
|
218
223
|
class.define_method("arg_max", method!(RbExpr::arg_max, 0))?;
|
219
224
|
class.define_method("arg_min", method!(RbExpr::arg_min, 0))?;
|
225
|
+
class.define_method("index_of", method!(RbExpr::index_of, 1))?;
|
220
226
|
class.define_method("search_sorted", method!(RbExpr::search_sorted, 3))?;
|
221
227
|
class.define_method("gather", method!(RbExpr::gather, 1))?;
|
222
228
|
class.define_method("get", method!(RbExpr::get, 1))?;
|
@@ -236,6 +242,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
236
242
|
class.define_method("var", method!(RbExpr::var, 1))?;
|
237
243
|
class.define_method("is_unique", method!(RbExpr::is_unique, 0))?;
|
238
244
|
class.define_method("is_between", method!(RbExpr::is_between, 3))?;
|
245
|
+
class.define_method("is_close", method!(RbExpr::is_close, 4))?;
|
239
246
|
class.define_method("approx_n_unique", method!(RbExpr::approx_n_unique, 0))?;
|
240
247
|
class.define_method("is_first_distinct", method!(RbExpr::is_first_distinct, 0))?;
|
241
248
|
class.define_method("is_last_distinct", method!(RbExpr::is_last_distinct, 0))?;
|
@@ -247,6 +254,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
247
254
|
class.define_method("append", method!(RbExpr::append, 2))?;
|
248
255
|
class.define_method("rechunk", method!(RbExpr::rechunk, 0))?;
|
249
256
|
class.define_method("round", method!(RbExpr::round, 2))?;
|
257
|
+
class.define_method("round_sig_figs", method!(RbExpr::round_sig_figs, 1))?;
|
250
258
|
class.define_method("floor", method!(RbExpr::floor, 0))?;
|
251
259
|
class.define_method("ceil", method!(RbExpr::ceil, 0))?;
|
252
260
|
class.define_method("clip", method!(RbExpr::clip, 2))?;
|
@@ -254,6 +262,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
254
262
|
class.define_method("sin", method!(RbExpr::sin, 0))?;
|
255
263
|
class.define_method("cos", method!(RbExpr::cos, 0))?;
|
256
264
|
class.define_method("tan", method!(RbExpr::tan, 0))?;
|
265
|
+
class.define_method("cot", method!(RbExpr::cot, 0))?;
|
257
266
|
class.define_method("arcsin", method!(RbExpr::arcsin, 0))?;
|
258
267
|
class.define_method("arccos", method!(RbExpr::arccos, 0))?;
|
259
268
|
class.define_method("arctan", method!(RbExpr::arctan, 0))?;
|
@@ -263,15 +272,20 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
263
272
|
class.define_method("arcsinh", method!(RbExpr::arcsinh, 0))?;
|
264
273
|
class.define_method("arccosh", method!(RbExpr::arccosh, 0))?;
|
265
274
|
class.define_method("arctanh", method!(RbExpr::arctanh, 0))?;
|
275
|
+
class.define_method("degrees", method!(RbExpr::degrees, 0))?;
|
276
|
+
class.define_method("radians", method!(RbExpr::radians, 0))?;
|
266
277
|
class.define_method("sign", method!(RbExpr::sign, 0))?;
|
267
278
|
class.define_method("is_duplicated", method!(RbExpr::is_duplicated, 0))?;
|
268
279
|
class.define_method("over", method!(RbExpr::over, 1))?;
|
269
|
-
class.define_method("
|
270
|
-
class.define_method("
|
271
|
-
class.define_method("
|
280
|
+
class.define_method("rolling", method!(RbExpr::rolling, 4))?;
|
281
|
+
class.define_method("and_", method!(RbExpr::and_, 1))?;
|
282
|
+
class.define_method("or_", method!(RbExpr::or_, 1))?;
|
283
|
+
class.define_method("xor_", method!(RbExpr::xor_, 1))?;
|
272
284
|
class.define_method("is_in", method!(RbExpr::is_in, 2))?;
|
273
285
|
class.define_method("repeat_by", method!(RbExpr::repeat_by, 1))?;
|
274
286
|
class.define_method("pow", method!(RbExpr::pow, 1))?;
|
287
|
+
class.define_method("sqrt", method!(RbExpr::sqrt, 0))?;
|
288
|
+
class.define_method("cbrt", method!(RbExpr::cbrt, 0))?;
|
275
289
|
class.define_method("cum_sum", method!(RbExpr::cum_sum, 1))?;
|
276
290
|
class.define_method("cum_max", method!(RbExpr::cum_max, 1))?;
|
277
291
|
class.define_method("cum_min", method!(RbExpr::cum_min, 1))?;
|
@@ -293,6 +307,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
293
307
|
class.define_method("str_strip_prefix", method!(RbExpr::str_strip_prefix, 1))?;
|
294
308
|
class.define_method("str_strip_suffix", method!(RbExpr::str_strip_suffix, 1))?;
|
295
309
|
class.define_method("str_slice", method!(RbExpr::str_slice, 2))?;
|
310
|
+
class.define_method("str_head", method!(RbExpr::str_head, 1))?;
|
311
|
+
class.define_method("str_tail", method!(RbExpr::str_tail, 1))?;
|
296
312
|
class.define_method("str_to_uppercase", method!(RbExpr::str_to_uppercase, 0))?;
|
297
313
|
class.define_method("str_to_lowercase", method!(RbExpr::str_to_lowercase, 0))?;
|
298
314
|
// class.define_method("str_to_titlecase", method!(RbExpr::str_to_titlecase, 0))?;
|
@@ -300,17 +316,25 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
300
316
|
class.define_method("str_len_chars", method!(RbExpr::str_len_chars, 0))?;
|
301
317
|
class.define_method("str_replace_n", method!(RbExpr::str_replace_n, 4))?;
|
302
318
|
class.define_method("str_replace_all", method!(RbExpr::str_replace_all, 3))?;
|
319
|
+
class.define_method("str_normalize", method!(RbExpr::str_normalize, 1))?;
|
303
320
|
class.define_method("str_reverse", method!(RbExpr::str_reverse, 0))?;
|
304
321
|
class.define_method("str_zfill", method!(RbExpr::str_zfill, 1))?;
|
305
322
|
class.define_method("str_pad_start", method!(RbExpr::str_pad_start, 2))?;
|
306
323
|
class.define_method("str_pad_end", method!(RbExpr::str_pad_end, 2))?;
|
307
324
|
class.define_method("str_contains", method!(RbExpr::str_contains, 3))?;
|
325
|
+
class.define_method("str_find", method!(RbExpr::str_find, 3))?;
|
308
326
|
class.define_method("str_ends_with", method!(RbExpr::str_ends_with, 1))?;
|
309
327
|
class.define_method("str_starts_with", method!(RbExpr::str_starts_with, 1))?;
|
310
|
-
class.define_method("
|
311
|
-
class.define_method("
|
312
|
-
class.define_method("
|
328
|
+
class.define_method("arr_len", method!(RbExpr::arr_len, 0))?;
|
329
|
+
class.define_method("arr_max", method!(RbExpr::arr_max, 0))?;
|
330
|
+
class.define_method("arr_min", method!(RbExpr::arr_min, 0))?;
|
331
|
+
class.define_method("arr_sum", method!(RbExpr::arr_sum, 0))?;
|
332
|
+
class.define_method("arr_std", method!(RbExpr::arr_std, 1))?;
|
333
|
+
class.define_method("arr_var", method!(RbExpr::arr_var, 1))?;
|
334
|
+
class.define_method("arr_mean", method!(RbExpr::arr_mean, 0))?;
|
335
|
+
class.define_method("arr_median", method!(RbExpr::arr_median, 0))?;
|
313
336
|
class.define_method("arr_unique", method!(RbExpr::arr_unique, 1))?;
|
337
|
+
class.define_method("arr_n_unique", method!(RbExpr::arr_n_unique, 0))?;
|
314
338
|
class.define_method("arr_to_list", method!(RbExpr::arr_to_list, 0))?;
|
315
339
|
class.define_method("arr_all", method!(RbExpr::arr_all, 0))?;
|
316
340
|
class.define_method("arr_any", method!(RbExpr::arr_any, 0))?;
|
@@ -322,6 +346,11 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
322
346
|
class.define_method("arr_join", method!(RbExpr::arr_join, 2))?;
|
323
347
|
class.define_method("arr_contains", method!(RbExpr::arr_contains, 2))?;
|
324
348
|
class.define_method("arr_count_matches", method!(RbExpr::arr_count_matches, 1))?;
|
349
|
+
class.define_method("arr_to_struct", method!(RbExpr::arr_to_struct, 1))?;
|
350
|
+
class.define_method("arr_slice", method!(RbExpr::arr_slice, 3))?;
|
351
|
+
class.define_method("arr_tail", method!(RbExpr::arr_tail, 2))?;
|
352
|
+
class.define_method("arr_shift", method!(RbExpr::arr_shift, 1))?;
|
353
|
+
class.define_method("arr_explode", method!(RbExpr::arr_explode, 0))?;
|
325
354
|
class.define_method("binary_contains", method!(RbExpr::bin_contains, 1))?;
|
326
355
|
class.define_method("binary_ends_with", method!(RbExpr::bin_ends_with, 1))?;
|
327
356
|
class.define_method("binary_starts_with", method!(RbExpr::bin_starts_with, 1))?;
|
@@ -329,7 +358,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
329
358
|
class.define_method("str_hex_decode", method!(RbExpr::str_hex_decode, 1))?;
|
330
359
|
class.define_method("str_base64_encode", method!(RbExpr::str_base64_encode, 0))?;
|
331
360
|
class.define_method("str_base64_decode", method!(RbExpr::str_base64_decode, 1))?;
|
332
|
-
class.define_method("str_to_integer", method!(RbExpr::str_to_integer,
|
361
|
+
class.define_method("str_to_integer", method!(RbExpr::str_to_integer, 3))?;
|
333
362
|
class.define_method("str_json_decode", method!(RbExpr::str_json_decode, 2))?;
|
334
363
|
class.define_method("binary_hex_encode", method!(RbExpr::bin_hex_encode, 0))?;
|
335
364
|
class.define_method("binary_hex_decode", method!(RbExpr::bin_hex_decode, 1))?;
|
@@ -341,6 +370,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
341
370
|
"binary_base64_decode",
|
342
371
|
method!(RbExpr::bin_base64_decode, 1),
|
343
372
|
)?;
|
373
|
+
class.define_method("bin_reinterpret", method!(RbExpr::bin_reinterpret, 2))?;
|
374
|
+
class.define_method("bin_size_bytes", method!(RbExpr::bin_size_bytes, 0))?;
|
344
375
|
class.define_method(
|
345
376
|
"str_json_path_match",
|
346
377
|
method!(RbExpr::str_json_path_match, 1),
|
@@ -349,7 +380,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
349
380
|
class.define_method("str_extract_all", method!(RbExpr::str_extract_all, 1))?;
|
350
381
|
class.define_method("str_extract_groups", method!(RbExpr::str_extract_groups, 1))?;
|
351
382
|
class.define_method("str_count_matches", method!(RbExpr::str_count_matches, 2))?;
|
352
|
-
class.define_method("strftime", method!(RbExpr::dt_to_string, 1))?;
|
353
383
|
class.define_method("str_split", method!(RbExpr::str_split, 1))?;
|
354
384
|
class.define_method(
|
355
385
|
"str_split_inclusive",
|
@@ -364,10 +394,21 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
364
394
|
class.define_method("str_to_decimal", method!(RbExpr::str_to_decimal, 1))?;
|
365
395
|
class.define_method("str_contains_any", method!(RbExpr::str_contains_any, 2))?;
|
366
396
|
class.define_method("str_replace_many", method!(RbExpr::str_replace_many, 3))?;
|
397
|
+
class.define_method("str_extract_many", method!(RbExpr::str_extract_many, 3))?;
|
398
|
+
class.define_method("str_find_many", method!(RbExpr::str_find_many, 3))?;
|
399
|
+
class.define_method("str_escape_regex", method!(RbExpr::str_escape_regex, 0))?;
|
367
400
|
class.define_method("list_len", method!(RbExpr::list_len, 0))?;
|
368
401
|
class.define_method("list_contains", method!(RbExpr::list_contains, 2))?;
|
369
402
|
class.define_method("list_count_matches", method!(RbExpr::list_count_matches, 1))?;
|
403
|
+
class.define_method(
|
404
|
+
"dt_add_business_days",
|
405
|
+
method!(RbExpr::dt_add_business_days, 4),
|
406
|
+
)?;
|
407
|
+
class.define_method("strftime", method!(RbExpr::dt_to_string, 1))?;
|
408
|
+
class.define_method("dt_millennium", method!(RbExpr::dt_millennium, 0))?;
|
409
|
+
class.define_method("dt_century", method!(RbExpr::dt_century, 0))?;
|
370
410
|
class.define_method("dt_year", method!(RbExpr::dt_year, 0))?;
|
411
|
+
class.define_method("dt_is_business_day", method!(RbExpr::dt_is_business_day, 2))?;
|
371
412
|
class.define_method("dt_is_leap_year", method!(RbExpr::dt_is_leap_year, 0))?;
|
372
413
|
class.define_method("dt_iso_year", method!(RbExpr::dt_iso_year, 0))?;
|
373
414
|
class.define_method("dt_quarter", method!(RbExpr::dt_quarter, 0))?;
|
@@ -421,12 +462,12 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
421
462
|
class.define_method("dt_base_utc_offset", method!(RbExpr::dt_base_utc_offset, 0))?;
|
422
463
|
class.define_method("dt_dst_offset", method!(RbExpr::dt_dst_offset, 0))?;
|
423
464
|
class.define_method("dt_round", method!(RbExpr::dt_round, 1))?;
|
465
|
+
class.define_method("dt_replace", method!(RbExpr::dt_replace, 8))?;
|
424
466
|
class.define_method("dt_combine", method!(RbExpr::dt_combine, 2))?;
|
425
467
|
class.define_method("map_batches", method!(RbExpr::map_batches, 5))?;
|
426
468
|
class.define_method("dot", method!(RbExpr::dot, 1))?;
|
427
469
|
class.define_method("reinterpret", method!(RbExpr::reinterpret, 1))?;
|
428
470
|
class.define_method("mode", method!(RbExpr::mode, 0))?;
|
429
|
-
class.define_method("exclude", method!(RbExpr::exclude, 1))?;
|
430
471
|
class.define_method("interpolate", method!(RbExpr::interpolate, 1))?;
|
431
472
|
class.define_method("interpolate_by", method!(RbExpr::interpolate_by, 1))?;
|
432
473
|
class.define_method("rolling_sum", method!(RbExpr::rolling_sum, 4))?;
|
@@ -449,6 +490,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
449
490
|
method!(RbExpr::rolling_quantile_by, 6),
|
450
491
|
)?;
|
451
492
|
class.define_method("rolling_skew", method!(RbExpr::rolling_skew, 4))?;
|
493
|
+
class.define_method("rolling_kurtosis", method!(RbExpr::rolling_kurtosis, 5))?;
|
452
494
|
class.define_method("lower_bound", method!(RbExpr::lower_bound, 0))?;
|
453
495
|
class.define_method("upper_bound", method!(RbExpr::upper_bound, 0))?;
|
454
496
|
class.define_method("list_max", method!(RbExpr::list_max, 0))?;
|
@@ -461,12 +503,18 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
461
503
|
method!(RbExpr::list_sample_fraction, 4),
|
462
504
|
)?;
|
463
505
|
class.define_method("list_gather", method!(RbExpr::list_gather, 2))?;
|
506
|
+
class.define_method("list_gather_every", method!(RbExpr::list_gather_every, 2))?;
|
464
507
|
class.define_method("list_to_array", method!(RbExpr::list_to_array, 1))?;
|
465
508
|
class.define_method("list_mean", method!(RbExpr::list_mean, 0))?;
|
509
|
+
class.define_method("list_median", method!(RbExpr::list_median, 0))?;
|
510
|
+
class.define_method("list_std", method!(RbExpr::list_std, 1))?;
|
511
|
+
class.define_method("list_var", method!(RbExpr::list_var, 1))?;
|
466
512
|
class.define_method("list_tail", method!(RbExpr::list_tail, 1))?;
|
467
513
|
class.define_method("list_sort", method!(RbExpr::list_sort, 2))?;
|
468
514
|
class.define_method("list_reverse", method!(RbExpr::list_reverse, 0))?;
|
515
|
+
class.define_method("list_n_unique", method!(RbExpr::list_n_unique, 0))?;
|
469
516
|
class.define_method("list_unique", method!(RbExpr::list_unique, 1))?;
|
517
|
+
class.define_method("list_set_operation", method!(RbExpr::list_set_operation, 2))?;
|
470
518
|
class.define_method("list_get", method!(RbExpr::list_get, 2))?;
|
471
519
|
class.define_method("list_join", method!(RbExpr::list_join, 2))?;
|
472
520
|
class.define_method("list_arg_min", method!(RbExpr::list_arg_min, 0))?;
|
@@ -477,6 +525,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
477
525
|
class.define_method("list_shift", method!(RbExpr::list_shift, 1))?;
|
478
526
|
class.define_method("list_slice", method!(RbExpr::list_slice, 2))?;
|
479
527
|
class.define_method("list_eval", method!(RbExpr::list_eval, 1))?;
|
528
|
+
class.define_method("list_filter", method!(RbExpr::list_filter, 1))?;
|
480
529
|
class.define_method("cumulative_eval", method!(RbExpr::cumulative_eval, 2))?;
|
481
530
|
class.define_method("list_to_struct", method!(RbExpr::list_to_struct, 3))?;
|
482
531
|
class.define_method("rank", method!(RbExpr::rank, 3))?;
|
@@ -486,6 +535,11 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
486
535
|
class.define_method("kurtosis", method!(RbExpr::kurtosis, 2))?;
|
487
536
|
class.define_method("str_join", method!(RbExpr::str_join, 2))?;
|
488
537
|
class.define_method("cat_get_categories", method!(RbExpr::cat_get_categories, 0))?;
|
538
|
+
class.define_method("cat_len_bytes", method!(RbExpr::cat_len_bytes, 0))?;
|
539
|
+
class.define_method("cat_len_chars", method!(RbExpr::cat_len_chars, 0))?;
|
540
|
+
class.define_method("cat_starts_with", method!(RbExpr::cat_starts_with, 1))?;
|
541
|
+
class.define_method("cat_ends_with", method!(RbExpr::cat_ends_with, 1))?;
|
542
|
+
class.define_method("cat_slice", method!(RbExpr::cat_slice, 2))?;
|
489
543
|
class.define_method("reshape", method!(RbExpr::reshape, 1))?;
|
490
544
|
class.define_method("cum_count", method!(RbExpr::cum_count, 1))?;
|
491
545
|
class.define_method("to_physical", method!(RbExpr::to_physical, 0))?;
|
@@ -493,6 +547,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
493
547
|
class.define_method("sample_n", method!(RbExpr::sample_n, 4))?;
|
494
548
|
class.define_method("sample_frac", method!(RbExpr::sample_frac, 4))?;
|
495
549
|
class.define_method("ewm_mean", method!(RbExpr::ewm_mean, 4))?;
|
550
|
+
class.define_method("ewm_mean_by", method!(RbExpr::ewm_mean_by, 2))?;
|
496
551
|
class.define_method("ewm_std", method!(RbExpr::ewm_std, 5))?;
|
497
552
|
class.define_method("ewm_var", method!(RbExpr::ewm_var, 5))?;
|
498
553
|
class.define_method("extend_constant", method!(RbExpr::extend_constant, 2))?;
|
@@ -511,13 +566,44 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
511
566
|
method!(RbExpr::struct_rename_fields, 1),
|
512
567
|
)?;
|
513
568
|
class.define_method("struct_json_encode", method!(RbExpr::struct_json_encode, 0))?;
|
569
|
+
class.define_method("struct_with_fields", method!(RbExpr::struct_with_fields, 1))?;
|
514
570
|
class.define_method("log", method!(RbExpr::log, 1))?;
|
571
|
+
class.define_method("log1p", method!(RbExpr::log1p, 0))?;
|
515
572
|
class.define_method("exp", method!(RbExpr::exp, 0))?;
|
516
573
|
class.define_method("entropy", method!(RbExpr::entropy, 2))?;
|
517
574
|
class.define_method("_hash", method!(RbExpr::hash, 4))?;
|
518
575
|
class.define_method("set_sorted_flag", method!(RbExpr::set_sorted_flag, 1))?;
|
519
576
|
class.define_method("replace", method!(RbExpr::replace, 2))?;
|
520
577
|
class.define_method("replace_strict", method!(RbExpr::replace_strict, 4))?;
|
578
|
+
class.define_method("hist", method!(RbExpr::hist, 4))?;
|
579
|
+
class.define_method("into_selector", method!(RbExpr::into_selector, 0))?;
|
580
|
+
class.define_singleton_method("new_selector", function!(RbExpr::new_selector, 1))?;
|
581
|
+
|
582
|
+
// bitwise
|
583
|
+
class.define_method("bitwise_count_ones", method!(RbExpr::bitwise_count_ones, 0))?;
|
584
|
+
class.define_method(
|
585
|
+
"bitwise_count_zeros",
|
586
|
+
method!(RbExpr::bitwise_count_zeros, 0),
|
587
|
+
)?;
|
588
|
+
class.define_method(
|
589
|
+
"bitwise_leading_ones",
|
590
|
+
method!(RbExpr::bitwise_leading_ones, 0),
|
591
|
+
)?;
|
592
|
+
class.define_method(
|
593
|
+
"bitwise_leading_zeros",
|
594
|
+
method!(RbExpr::bitwise_leading_zeros, 0),
|
595
|
+
)?;
|
596
|
+
class.define_method(
|
597
|
+
"bitwise_trailing_ones",
|
598
|
+
method!(RbExpr::bitwise_trailing_ones, 0),
|
599
|
+
)?;
|
600
|
+
class.define_method(
|
601
|
+
"bitwise_trailing_zeros",
|
602
|
+
method!(RbExpr::bitwise_trailing_zeros, 0),
|
603
|
+
)?;
|
604
|
+
class.define_method("bitwise_and", method!(RbExpr::bitwise_and, 0))?;
|
605
|
+
class.define_method("bitwise_or", method!(RbExpr::bitwise_or, 0))?;
|
606
|
+
class.define_method("bitwise_xor", method!(RbExpr::bitwise_xor, 0))?;
|
521
607
|
|
522
608
|
// meta
|
523
609
|
class.define_method("meta_pop", method!(RbExpr::meta_pop, 1))?;
|
@@ -534,10 +620,11 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
534
620
|
"meta_is_regex_projection",
|
535
621
|
method!(RbExpr::meta_is_regex_projection, 0),
|
536
622
|
)?;
|
537
|
-
class.define_method(
|
538
|
-
|
539
|
-
|
540
|
-
|
623
|
+
class.define_method(
|
624
|
+
"meta_is_column_selection",
|
625
|
+
method!(RbExpr::meta_is_column_selection, 1),
|
626
|
+
)?;
|
627
|
+
class.define_method("meta_is_literal", method!(RbExpr::meta_is_literal, 1))?;
|
541
628
|
class.define_method("meta_tree_format", method!(RbExpr::meta_tree_format, 1))?;
|
542
629
|
|
543
630
|
// name
|
@@ -547,18 +634,15 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
547
634
|
class.define_method("name_suffix", method!(RbExpr::name_suffix, 1))?;
|
548
635
|
class.define_method("name_to_lowercase", method!(RbExpr::name_to_lowercase, 0))?;
|
549
636
|
class.define_method("name_to_uppercase", method!(RbExpr::name_to_uppercase, 0))?;
|
637
|
+
class.define_method("name_prefix_fields", method!(RbExpr::name_prefix_fields, 1))?;
|
638
|
+
class.define_method("name_suffix_fields", method!(RbExpr::name_suffix_fields, 1))?;
|
550
639
|
|
551
640
|
// maybe add to different class
|
552
641
|
let class = module.define_module("Plr")?;
|
553
|
-
class.define_singleton_method("dtype_cols", function!(functions::lazy::dtype_cols, 1))?;
|
554
|
-
class.define_singleton_method("index_cols", function!(functions::lazy::index_cols, 1))?;
|
555
642
|
class.define_singleton_method("col", function!(functions::lazy::col, 1))?;
|
556
643
|
class.define_singleton_method("len", function!(functions::lazy::len, 0))?;
|
557
|
-
class.define_singleton_method("first", function!(functions::lazy::first, 0))?;
|
558
|
-
class.define_singleton_method("last", function!(functions::lazy::last, 0))?;
|
559
|
-
class.define_singleton_method("cols", function!(functions::lazy::cols, 1))?;
|
560
644
|
class.define_singleton_method("fold", function!(functions::lazy::fold, 5))?;
|
561
|
-
class.define_singleton_method("cum_fold", function!(functions::lazy::cum_fold,
|
645
|
+
class.define_singleton_method("cum_fold", function!(functions::lazy::cum_fold, 6))?;
|
562
646
|
class.define_singleton_method("lit", function!(functions::lazy::lit, 3))?;
|
563
647
|
class.define_singleton_method("int_range", function!(functions::range::int_range, 4))?;
|
564
648
|
class.define_singleton_method("int_ranges", function!(functions::range::int_ranges, 4))?;
|
@@ -607,6 +691,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
607
691
|
function!(functions::aggregation::mean_horizontal, 2),
|
608
692
|
)?;
|
609
693
|
class.define_singleton_method("as_struct", function!(functions::lazy::as_struct, 1))?;
|
694
|
+
class.define_singleton_method("field", function!(functions::lazy::field, 1))?;
|
610
695
|
class.define_singleton_method("coalesce", function!(functions::lazy::coalesce, 1))?;
|
611
696
|
class.define_singleton_method("arg_where", function!(functions::lazy::arg_where, 1))?;
|
612
697
|
class.define_singleton_method(
|
@@ -633,6 +718,10 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
633
718
|
)?;
|
634
719
|
class.define_singleton_method("duration", function!(functions::lazy::duration, 9))?;
|
635
720
|
class.define_singleton_method("ipc_schema", function!(functions::io::read_ipc_schema, 1))?;
|
721
|
+
class.define_singleton_method(
|
722
|
+
"read_parquet_metadata",
|
723
|
+
function!(functions::io::read_parquet_metadata, 1),
|
724
|
+
)?;
|
636
725
|
class.define_singleton_method(
|
637
726
|
"parquet_schema",
|
638
727
|
function!(functions::io::read_parquet_schema, 1),
|
@@ -729,7 +818,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
729
818
|
class.define_singleton_method("new_from_csv", function!(RbLazyFrame::new_from_csv, -1))?;
|
730
819
|
class.define_singleton_method(
|
731
820
|
"new_from_parquet",
|
732
|
-
function!(RbLazyFrame::new_from_parquet,
|
821
|
+
function!(RbLazyFrame::new_from_parquet, 6),
|
733
822
|
)?;
|
734
823
|
class.define_singleton_method("new_from_ipc", function!(RbLazyFrame::new_from_ipc, 10))?;
|
735
824
|
class.define_method("write_json", method!(RbLazyFrame::write_json, 1))?;
|
@@ -744,14 +833,16 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
744
833
|
)?;
|
745
834
|
class.define_method("sort", method!(RbLazyFrame::sort, 5))?;
|
746
835
|
class.define_method("sort_by_exprs", method!(RbLazyFrame::sort_by_exprs, 5))?;
|
836
|
+
class.define_method("top_k", method!(RbLazyFrame::top_k, 3))?;
|
837
|
+
class.define_method("bottom_k", method!(RbLazyFrame::bottom_k, 3))?;
|
747
838
|
class.define_method("cache", method!(RbLazyFrame::cache, 0))?;
|
748
839
|
class.define_method("collect", method!(RbLazyFrame::collect, 0))?;
|
749
840
|
class.define_method("sink_parquet", method!(RbLazyFrame::sink_parquet, 9))?;
|
750
841
|
class.define_method("sink_ipc", method!(RbLazyFrame::sink_ipc, 5))?;
|
751
842
|
class.define_method("sink_csv", method!(RbLazyFrame::sink_csv, -1))?;
|
752
843
|
class.define_method("sink_json", method!(RbLazyFrame::sink_json, 4))?;
|
753
|
-
class.define_method("fetch", method!(RbLazyFrame::fetch, 1))?;
|
754
844
|
class.define_method("filter", method!(RbLazyFrame::filter, 1))?;
|
845
|
+
class.define_method("remove", method!(RbLazyFrame::remove, 1))?;
|
755
846
|
class.define_method("select", method!(RbLazyFrame::select, 1))?;
|
756
847
|
class.define_method("select_seq", method!(RbLazyFrame::select_seq, 1))?;
|
757
848
|
class.define_method("group_by", method!(RbLazyFrame::group_by, 2))?;
|
@@ -763,6 +854,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
763
854
|
class.define_method("with_context", method!(RbLazyFrame::with_context, 1))?;
|
764
855
|
class.define_method("join_asof", method!(RbLazyFrame::join_asof, 14))?;
|
765
856
|
class.define_method("join", method!(RbLazyFrame::join, 11))?;
|
857
|
+
class.define_method("join_where", method!(RbLazyFrame::join_where, 3))?;
|
766
858
|
class.define_method("with_column", method!(RbLazyFrame::with_column, 1))?;
|
767
859
|
class.define_method("with_columns", method!(RbLazyFrame::with_columns, 1))?;
|
768
860
|
class.define_method(
|
@@ -784,6 +876,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
784
876
|
class.define_method("explode", method!(RbLazyFrame::explode, 1))?;
|
785
877
|
class.define_method("null_count", method!(RbLazyFrame::null_count, 0))?;
|
786
878
|
class.define_method("unique", method!(RbLazyFrame::unique, 3))?;
|
879
|
+
class.define_method("drop_nans", method!(RbLazyFrame::drop_nans, 1))?;
|
787
880
|
class.define_method("drop_nulls", method!(RbLazyFrame::drop_nulls, 1))?;
|
788
881
|
class.define_method("slice", method!(RbLazyFrame::slice, 2))?;
|
789
882
|
class.define_method("tail", method!(RbLazyFrame::tail, 1))?;
|
@@ -858,7 +951,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
858
951
|
class.define_method("estimated_size", method!(RbSeries::estimated_size, 0))?;
|
859
952
|
class.define_method("get_fmt", method!(RbSeries::get_fmt, 2))?;
|
860
953
|
class.define_method("rechunk", method!(RbSeries::rechunk, 1))?;
|
861
|
-
class.define_method("
|
954
|
+
class.define_method("get_index", method!(RbSeries::get_index, 1))?;
|
955
|
+
class.define_method("get_index_signed", method!(RbSeries::get_index_signed, 1))?;
|
862
956
|
class.define_method("bitand", method!(RbSeries::bitand, 1))?;
|
863
957
|
class.define_method("bitor", method!(RbSeries::bitor, 1))?;
|
864
958
|
class.define_method("bitxor", method!(RbSeries::bitxor, 1))?;
|
@@ -872,6 +966,12 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
872
966
|
class.define_method("max", method!(RbSeries::max, 0))?;
|
873
967
|
class.define_method("min", method!(RbSeries::min, 0))?;
|
874
968
|
class.define_method("sum", method!(RbSeries::sum, 0))?;
|
969
|
+
class.define_method("first", method!(RbSeries::first, 0))?;
|
970
|
+
class.define_method("last", method!(RbSeries::last, 0))?;
|
971
|
+
class.define_method("approx_n_unique", method!(RbSeries::approx_n_unique, 0))?;
|
972
|
+
class.define_method("bitwise_and", method!(RbSeries::bitwise_and, 0))?;
|
973
|
+
class.define_method("bitwise_or", method!(RbSeries::bitwise_or, 0))?;
|
974
|
+
class.define_method("bitwise_xor", method!(RbSeries::bitwise_xor, 0))?;
|
875
975
|
class.define_method("n_chunks", method!(RbSeries::n_chunks, 0))?;
|
876
976
|
class.define_method("append", method!(RbSeries::append, 1))?;
|
877
977
|
class.define_method("extend", method!(RbSeries::extend, 1))?;
|
@@ -901,16 +1001,16 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
901
1001
|
class.define_method("gt_eq", method!(RbSeries::gt_eq, 1))?;
|
902
1002
|
class.define_method("lt", method!(RbSeries::lt, 1))?;
|
903
1003
|
class.define_method("lt_eq", method!(RbSeries::lt_eq, 1))?;
|
904
|
-
class.define_method("
|
1004
|
+
class.define_method("not_", method!(RbSeries::not_, 0))?;
|
905
1005
|
class.define_method("to_s", method!(RbSeries::to_s, 0))?;
|
906
1006
|
class.define_method("len", method!(RbSeries::len, 0))?;
|
907
1007
|
class.define_method("to_a", method!(RbSeries::to_a, 0))?;
|
908
1008
|
class.define_method("median", method!(RbSeries::median, 0))?;
|
909
1009
|
class.define_method("quantile", method!(RbSeries::quantile, 2))?;
|
910
1010
|
class.define_method("_clone", method!(RbSeries::clone, 0))?;
|
911
|
-
class.define_method("
|
1011
|
+
class.define_method("map_elements", method!(RbSeries::map_elements, 3))?;
|
912
1012
|
class.define_method("zip_with", method!(RbSeries::zip_with, 2))?;
|
913
|
-
class.define_method("to_dummies", method!(RbSeries::to_dummies,
|
1013
|
+
class.define_method("to_dummies", method!(RbSeries::to_dummies, 3))?;
|
914
1014
|
class.define_method("n_unique", method!(RbSeries::n_unique, 0))?;
|
915
1015
|
class.define_method("floor", method!(RbSeries::floor, 0))?;
|
916
1016
|
class.define_method("shrink_to_fit", method!(RbSeries::shrink_to_fit, 0))?;
|
@@ -918,6 +1018,9 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
918
1018
|
class.define_method("skew", method!(RbSeries::skew, 1))?;
|
919
1019
|
class.define_method("kurtosis", method!(RbSeries::kurtosis, 2))?;
|
920
1020
|
class.define_method("cast", method!(RbSeries::cast, 2))?;
|
1021
|
+
class.define_method("get_chunks", method!(RbSeries::get_chunks, 0))?;
|
1022
|
+
class.define_method("is_sorted", method!(RbSeries::is_sorted, 2))?;
|
1023
|
+
class.define_method("clear", method!(RbSeries::clear, 0))?;
|
921
1024
|
class.define_method("time_unit", method!(RbSeries::time_unit, 0))?;
|
922
1025
|
class.define_method("scatter", method!(RbSeries::scatter, 2))?;
|
923
1026
|
|
@@ -1111,5 +1214,89 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
1111
1214
|
let class = module.define_class("ArrowArrayStream", ruby.class_object())?;
|
1112
1215
|
class.define_method("to_i", method!(RbArrowArrayStream::to_i, 0))?;
|
1113
1216
|
|
1217
|
+
// catalog
|
1218
|
+
let class = module.define_class("RbCatalogClient", ruby.class_object())?;
|
1219
|
+
class.define_singleton_method("new", function!(RbCatalogClient::new, 2))?;
|
1220
|
+
class.define_singleton_method(
|
1221
|
+
"type_json_to_polars_type",
|
1222
|
+
function!(RbCatalogClient::type_json_to_polars_type, 1),
|
1223
|
+
)?;
|
1224
|
+
class.define_method("list_catalogs", method!(RbCatalogClient::list_catalogs, 0))?;
|
1225
|
+
class.define_method(
|
1226
|
+
"list_namespaces",
|
1227
|
+
method!(RbCatalogClient::list_namespaces, 1),
|
1228
|
+
)?;
|
1229
|
+
class.define_method("list_tables", method!(RbCatalogClient::list_tables, 2))?;
|
1230
|
+
class.define_method(
|
1231
|
+
"get_table_info",
|
1232
|
+
method!(RbCatalogClient::get_table_info, 3),
|
1233
|
+
)?;
|
1234
|
+
class.define_method(
|
1235
|
+
"create_catalog",
|
1236
|
+
method!(RbCatalogClient::create_catalog, 3),
|
1237
|
+
)?;
|
1238
|
+
class.define_method(
|
1239
|
+
"delete_catalog",
|
1240
|
+
method!(RbCatalogClient::delete_catalog, 2),
|
1241
|
+
)?;
|
1242
|
+
class.define_method(
|
1243
|
+
"create_namespace",
|
1244
|
+
method!(RbCatalogClient::create_namespace, 4),
|
1245
|
+
)?;
|
1246
|
+
class.define_method(
|
1247
|
+
"delete_namespace",
|
1248
|
+
method!(RbCatalogClient::delete_namespace, 3),
|
1249
|
+
)?;
|
1250
|
+
class.define_method("create_table", method!(RbCatalogClient::create_table, 9))?;
|
1251
|
+
class.define_method("delete_table", method!(RbCatalogClient::delete_table, 3))?;
|
1252
|
+
|
1253
|
+
// categories
|
1254
|
+
let class = module.define_class("RbCategories", ruby.class_object())?;
|
1255
|
+
class.define_singleton_method(
|
1256
|
+
"global_categories",
|
1257
|
+
function!(RbCategories::global_categories, 0),
|
1258
|
+
)?;
|
1259
|
+
|
1260
|
+
// data type expr
|
1261
|
+
let class = module.define_class("RbDataTypeExpr", ruby.class_object())?;
|
1262
|
+
class.define_singleton_method("from_dtype", function!(RbDataTypeExpr::from_dtype, 1))?;
|
1263
|
+
class.define_singleton_method("of_expr", function!(RbDataTypeExpr::of_expr, 1))?;
|
1264
|
+
class.define_method("collect_dtype", method!(RbDataTypeExpr::collect_dtype, 1))?;
|
1265
|
+
|
1266
|
+
// selector
|
1267
|
+
let class = module.define_class("RbSelector", ruby.class_object())?;
|
1268
|
+
class.define_method("union", method!(RbSelector::union, 1))?;
|
1269
|
+
class.define_method("difference", method!(RbSelector::difference, 1))?;
|
1270
|
+
class.define_method("exclusive_or", method!(RbSelector::exclusive_or, 1))?;
|
1271
|
+
class.define_method("intersect", method!(RbSelector::intersect, 1))?;
|
1272
|
+
class.define_singleton_method("by_dtype", function!(RbSelector::by_dtype, 1))?;
|
1273
|
+
class.define_singleton_method("by_name", function!(RbSelector::by_name, 2))?;
|
1274
|
+
class.define_singleton_method("by_index", function!(RbSelector::by_index, 2))?;
|
1275
|
+
class.define_singleton_method("first", function!(RbSelector::first, 1))?;
|
1276
|
+
class.define_singleton_method("last", function!(RbSelector::last, 1))?;
|
1277
|
+
class.define_singleton_method("matches", function!(RbSelector::matches, 1))?;
|
1278
|
+
class.define_singleton_method("enum_", function!(RbSelector::enum_, 0))?;
|
1279
|
+
class.define_singleton_method("categorical", function!(RbSelector::categorical, 0))?;
|
1280
|
+
class.define_singleton_method("nested", function!(RbSelector::nested, 0))?;
|
1281
|
+
class.define_singleton_method("list", function!(RbSelector::list, 1))?;
|
1282
|
+
class.define_singleton_method("array", function!(RbSelector::array, 2))?;
|
1283
|
+
class.define_singleton_method("struct_", function!(RbSelector::struct_, 0))?;
|
1284
|
+
class.define_singleton_method("integer", function!(RbSelector::integer, 0))?;
|
1285
|
+
class.define_singleton_method("signed_integer", function!(RbSelector::signed_integer, 0))?;
|
1286
|
+
class.define_singleton_method(
|
1287
|
+
"unsigned_integer",
|
1288
|
+
function!(RbSelector::unsigned_integer, 0),
|
1289
|
+
)?;
|
1290
|
+
class.define_singleton_method("float", function!(RbSelector::float, 0))?;
|
1291
|
+
class.define_singleton_method("decimal", function!(RbSelector::decimal, 0))?;
|
1292
|
+
class.define_singleton_method("numeric", function!(RbSelector::numeric, 0))?;
|
1293
|
+
class.define_singleton_method("temporal", function!(RbSelector::temporal, 0))?;
|
1294
|
+
class.define_singleton_method("datetime", function!(RbSelector::datetime, 2))?;
|
1295
|
+
class.define_singleton_method("duration", function!(RbSelector::duration, 1))?;
|
1296
|
+
class.define_singleton_method("object", function!(RbSelector::object, 0))?;
|
1297
|
+
class.define_singleton_method("empty", function!(RbSelector::empty, 0))?;
|
1298
|
+
class.define_singleton_method("all", function!(RbSelector::all, 0))?;
|
1299
|
+
class.define_method("_hash", method!(RbSelector::hash, 0))?;
|
1300
|
+
|
1114
1301
|
Ok(())
|
1115
1302
|
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
use magnus::{
|
1
|
+
use magnus::{IntoValue, RArray, TryConvert, Value, class, prelude::*, typed_data::Obj};
|
2
2
|
use polars::prelude::*;
|
3
|
-
use polars_core::frame::row::{
|
3
|
+
use polars_core::frame::row::{Row, rows_to_schema_first_non_null};
|
4
4
|
use polars_core::series::SeriesIter;
|
5
5
|
|
6
6
|
use super::*;
|
7
7
|
use crate::{RbDataFrame, RbPolarsErr, RbSeries, Wrap};
|
8
8
|
|
9
|
-
fn get_iters(df: &DataFrame) -> Vec<SeriesIter
|
9
|
+
fn get_iters(df: &DataFrame) -> Vec<SeriesIter<'_>> {
|
10
10
|
df.get_columns()
|
11
11
|
.iter()
|
12
12
|
.map(|s| s.as_materialized_series().iter())
|
13
13
|
.collect()
|
14
14
|
}
|
15
15
|
|
16
|
-
fn get_iters_skip(df: &DataFrame, skip: usize) -> Vec<std::iter::Skip<SeriesIter
|
16
|
+
fn get_iters_skip(df: &DataFrame, skip: usize) -> Vec<std::iter::Skip<SeriesIter<'_>>> {
|
17
17
|
df.get_columns()
|
18
18
|
.iter()
|
19
19
|
.map(|s| s.as_materialized_series().iter().skip(skip))
|
@@ -144,7 +144,7 @@ where
|
|
144
144
|
let tpl = (RArray::from_iter(iter),);
|
145
145
|
match lambda.funcall::<_, _, Value>("call", tpl) {
|
146
146
|
Ok(val) => T::try_convert(val).ok(),
|
147
|
-
Err(e) => panic!("ruby function failed {}"
|
147
|
+
Err(e) => panic!("ruby function failed {e}"),
|
148
148
|
}
|
149
149
|
})
|
150
150
|
}
|
@@ -157,7 +157,7 @@ pub fn apply_lambda_with_primitive_out_type<D>(
|
|
157
157
|
first_value: Option<D::Native>,
|
158
158
|
) -> ChunkedArray<D>
|
159
159
|
where
|
160
|
-
D:
|
160
|
+
D: RbPolarsNumericType,
|
161
161
|
D::Native: IntoValue + TryConvert,
|
162
162
|
{
|
163
163
|
let skip = usize::from(first_value.is_some());
|
@@ -247,11 +247,11 @@ pub fn apply_lambda_with_list_out_type(
|
|
247
247
|
if val.is_nil() {
|
248
248
|
None
|
249
249
|
} else {
|
250
|
-
panic!("should return a Series, got a {:?}"
|
250
|
+
panic!("should return a Series, got a {val:?}")
|
251
251
|
}
|
252
252
|
}
|
253
253
|
},
|
254
|
-
Err(e) => panic!("ruby function failed {}"
|
254
|
+
Err(e) => panic!("ruby function failed {e}"),
|
255
255
|
}
|
256
256
|
});
|
257
257
|
iterator_to_list(
|
@@ -302,7 +302,7 @@ pub fn apply_lambda_with_rows_output<'a>(
|
|
302
302
|
None => Ok(&null_row),
|
303
303
|
}
|
304
304
|
}
|
305
|
-
Err(e) => panic!("ruby function failed {}"
|
305
|
+
Err(e) => panic!("ruby function failed {e}"),
|
306
306
|
}
|
307
307
|
});
|
308
308
|
|
data/ext/polars/src/map/lazy.rs
CHANGED