polars-df 0.23.0 → 0.24.0
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 +127 -1
- data/Cargo.lock +72 -58
- data/README.md +31 -27
- data/ext/polars/Cargo.toml +15 -6
- data/ext/polars/src/batched_csv.rs +35 -39
- data/ext/polars/src/c_api/allocator.rs +7 -0
- data/ext/polars/src/c_api/mod.rs +1 -0
- data/ext/polars/src/catalog/unity.rs +123 -101
- data/ext/polars/src/conversion/any_value.rs +13 -17
- data/ext/polars/src/conversion/chunked_array.rs +5 -5
- data/ext/polars/src/conversion/datetime.rs +3 -2
- data/ext/polars/src/conversion/mod.rs +50 -45
- data/ext/polars/src/dataframe/export.rs +13 -13
- data/ext/polars/src/dataframe/general.rs +223 -223
- data/ext/polars/src/dataframe/io.rs +27 -141
- data/ext/polars/src/dataframe/mod.rs +13 -5
- data/ext/polars/src/dataframe/serde.rs +1 -1
- data/ext/polars/src/error.rs +44 -7
- data/ext/polars/src/exceptions.rs +45 -12
- data/ext/polars/src/expr/array.rs +12 -0
- data/ext/polars/src/expr/datatype.rs +2 -2
- data/ext/polars/src/expr/datetime.rs +4 -5
- data/ext/polars/src/expr/general.rs +49 -13
- data/ext/polars/src/expr/list.rs +4 -0
- data/ext/polars/src/expr/meta.rs +8 -3
- data/ext/polars/src/expr/mod.rs +22 -6
- data/ext/polars/src/expr/name.rs +19 -8
- data/ext/polars/src/expr/rolling.rs +50 -1
- data/ext/polars/src/expr/string.rs +0 -1
- data/ext/polars/src/expr/struct.rs +7 -2
- data/ext/polars/src/file.rs +136 -103
- data/ext/polars/src/functions/aggregation.rs +9 -8
- data/ext/polars/src/functions/io.rs +81 -10
- data/ext/polars/src/functions/lazy.rs +95 -21
- data/ext/polars/src/functions/mod.rs +2 -0
- data/ext/polars/src/functions/range.rs +19 -3
- data/ext/polars/src/functions/strings.rs +6 -0
- data/ext/polars/src/functions/utils.rs +6 -0
- data/ext/polars/src/interop/arrow/mod.rs +50 -1
- data/ext/polars/src/interop/arrow/{to_ruby.rs → to_rb.rs} +30 -0
- data/ext/polars/src/interop/arrow/to_rust.rs +43 -0
- data/ext/polars/src/interop/numo/to_numo_df.rs +1 -1
- data/ext/polars/src/interop/numo/to_numo_series.rs +1 -1
- data/ext/polars/src/lazyframe/exitable.rs +39 -0
- data/ext/polars/src/lazyframe/general.rs +340 -236
- data/ext/polars/src/lazyframe/mod.rs +46 -10
- data/ext/polars/src/lazyframe/optflags.rs +5 -4
- data/ext/polars/src/lazyframe/serde.rs +11 -3
- data/ext/polars/src/lazyframe/sink.rs +10 -5
- data/ext/polars/src/lazygroupby.rs +6 -7
- data/ext/polars/src/lib.rs +141 -76
- data/ext/polars/src/map/dataframe.rs +12 -12
- data/ext/polars/src/map/lazy.rs +7 -5
- data/ext/polars/src/map/mod.rs +15 -8
- data/ext/polars/src/map/series.rs +3 -3
- data/ext/polars/src/on_startup.rs +16 -8
- data/ext/polars/src/prelude.rs +1 -0
- data/ext/polars/src/rb_modules.rs +19 -49
- data/ext/polars/src/series/aggregation.rs +79 -140
- data/ext/polars/src/series/arithmetic.rs +16 -22
- data/ext/polars/src/series/comparison.rs +101 -222
- data/ext/polars/src/series/construction.rs +17 -18
- data/ext/polars/src/series/export.rs +1 -1
- data/ext/polars/src/series/general.rs +254 -289
- data/ext/polars/src/series/import.rs +17 -0
- data/ext/polars/src/series/map.rs +178 -160
- data/ext/polars/src/series/mod.rs +28 -12
- data/ext/polars/src/series/scatter.rs +12 -9
- data/ext/polars/src/sql.rs +16 -9
- data/ext/polars/src/testing/frame.rs +31 -0
- data/ext/polars/src/testing/mod.rs +5 -0
- data/ext/polars/src/testing/series.rs +31 -0
- data/ext/polars/src/timeout.rs +105 -0
- data/ext/polars/src/utils.rs +159 -1
- data/lib/polars/array_expr.rb +81 -12
- data/lib/polars/array_name_space.rb +74 -7
- data/lib/polars/batched_csv_reader.rb +21 -21
- data/lib/polars/binary_name_space.rb +1 -1
- data/lib/polars/cat_expr.rb +7 -7
- data/lib/polars/config.rb +1 -1
- data/lib/polars/convert.rb +189 -34
- data/lib/polars/data_frame.rb +1066 -831
- data/lib/polars/data_frame_plot.rb +173 -0
- data/lib/polars/data_type_group.rb +1 -0
- data/lib/polars/data_types.rb +31 -12
- data/lib/polars/date_time_expr.rb +51 -69
- data/lib/polars/date_time_name_space.rb +80 -112
- data/lib/polars/dynamic_group_by.rb +7 -7
- data/lib/polars/exceptions.rb +50 -10
- data/lib/polars/expr.rb +470 -517
- data/lib/polars/functions/aggregation/horizontal.rb +0 -1
- data/lib/polars/functions/aggregation/vertical.rb +2 -3
- data/lib/polars/functions/as_datatype.rb +290 -8
- data/lib/polars/functions/eager.rb +204 -10
- data/lib/polars/functions/escape_regex.rb +21 -0
- data/lib/polars/functions/lazy.rb +409 -169
- data/lib/polars/functions/lit.rb +17 -1
- data/lib/polars/functions/range/int_range.rb +74 -2
- data/lib/polars/functions/range/linear_space.rb +77 -0
- data/lib/polars/functions/range/time_range.rb +1 -1
- data/lib/polars/functions/repeat.rb +3 -12
- data/lib/polars/functions/whenthen.rb +2 -2
- data/lib/polars/group_by.rb +72 -20
- data/lib/polars/iceberg_dataset.rb +1 -6
- data/lib/polars/in_process_query.rb +37 -0
- data/lib/polars/io/cloud.rb +18 -0
- data/lib/polars/io/csv.rb +265 -126
- data/lib/polars/io/database.rb +0 -1
- data/lib/polars/io/delta.rb +15 -7
- data/lib/polars/io/ipc.rb +24 -17
- data/lib/polars/io/ndjson.rb +161 -24
- data/lib/polars/io/parquet.rb +101 -38
- data/lib/polars/lazy_frame.rb +849 -558
- data/lib/polars/lazy_group_by.rb +327 -2
- data/lib/polars/list_expr.rb +94 -16
- data/lib/polars/list_name_space.rb +88 -24
- data/lib/polars/meta_expr.rb +42 -1
- data/lib/polars/name_expr.rb +41 -4
- data/lib/polars/query_opt_flags.rb +198 -2
- data/lib/polars/rolling_group_by.rb +3 -3
- data/lib/polars/schema.rb +21 -3
- data/lib/polars/selector.rb +37 -2
- data/lib/polars/selectors.rb +45 -9
- data/lib/polars/series.rb +1156 -728
- data/lib/polars/series_plot.rb +72 -0
- data/lib/polars/slice.rb +1 -1
- data/lib/polars/sql_context.rb +11 -4
- data/lib/polars/string_expr.rb +59 -68
- data/lib/polars/string_name_space.rb +51 -87
- data/lib/polars/struct_expr.rb +36 -18
- data/lib/polars/testing.rb +24 -273
- data/lib/polars/utils/constants.rb +2 -0
- data/lib/polars/utils/construction/data_frame.rb +410 -0
- data/lib/polars/utils/construction/series.rb +364 -0
- data/lib/polars/utils/construction/utils.rb +9 -0
- data/lib/polars/utils/deprecation.rb +11 -0
- data/lib/polars/utils/serde.rb +8 -3
- data/lib/polars/utils/unstable.rb +19 -0
- data/lib/polars/utils/various.rb +59 -0
- data/lib/polars/utils.rb +46 -47
- data/lib/polars/version.rb +1 -1
- data/lib/polars.rb +47 -1
- metadata +25 -6
- data/ext/polars/src/allocator.rs +0 -13
- data/lib/polars/plot.rb +0 -109
data/ext/polars/src/lib.rs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
#![allow(clippy::too_many_arguments)]
|
|
2
|
+
|
|
2
3
|
mod batched_csv;
|
|
4
|
+
mod c_api;
|
|
3
5
|
mod catalog;
|
|
4
6
|
mod conversion;
|
|
5
7
|
mod dataframe;
|
|
@@ -19,6 +21,8 @@ mod prelude;
|
|
|
19
21
|
pub(crate) mod rb_modules;
|
|
20
22
|
mod series;
|
|
21
23
|
mod sql;
|
|
24
|
+
mod testing;
|
|
25
|
+
mod timeout;
|
|
22
26
|
mod utils;
|
|
23
27
|
|
|
24
28
|
use batched_csv::RbBatchedCsv;
|
|
@@ -29,12 +33,11 @@ use error::RbPolarsErr;
|
|
|
29
33
|
use exceptions::{RbTypeError, RbValueError};
|
|
30
34
|
use expr::RbExpr;
|
|
31
35
|
use expr::datatype::RbDataTypeExpr;
|
|
32
|
-
use expr::rb_exprs_to_exprs;
|
|
33
36
|
use expr::selector::RbSelector;
|
|
34
37
|
use functions::string_cache::RbStringCacheHolder;
|
|
35
38
|
use functions::whenthen::{RbChainedThen, RbChainedWhen, RbThen, RbWhen};
|
|
36
|
-
use interop::arrow::
|
|
37
|
-
use lazyframe::{RbLazyFrame, RbOptFlags};
|
|
39
|
+
use interop::arrow::to_rb::{RbArrowArrayStream, RbArrowSchema};
|
|
40
|
+
use lazyframe::{RbInProcessQuery, RbLazyFrame, RbOptFlags};
|
|
38
41
|
use lazygroupby::RbLazyGroupBy;
|
|
39
42
|
use magnus::{Ruby, function, method, prelude::*};
|
|
40
43
|
use series::RbSeries;
|
|
@@ -48,9 +51,9 @@ fn re_escape(pattern: String) -> String {
|
|
|
48
51
|
regex::escape(&pattern)
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
#[magnus::init]
|
|
54
|
+
#[magnus::init(name = "polars")]
|
|
52
55
|
fn init(ruby: &Ruby) -> RbResult<()> {
|
|
53
|
-
crate::on_startup::register_startup_deps();
|
|
56
|
+
crate::on_startup::register_startup_deps(true);
|
|
54
57
|
|
|
55
58
|
let module = ruby.define_module("Polars")?;
|
|
56
59
|
|
|
@@ -70,14 +73,10 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
70
73
|
class.define_singleton_method("from_rows", function!(RbDataFrame::from_rows, 3))?;
|
|
71
74
|
class.define_singleton_method("from_hashes", function!(RbDataFrame::from_hashes, 5))?;
|
|
72
75
|
class.define_singleton_method("read_json", function!(RbDataFrame::read_json, 4))?;
|
|
73
|
-
class.define_singleton_method("read_ndjson", function!(RbDataFrame::read_ndjson, 4))?;
|
|
74
76
|
class.define_method("estimated_size", method!(RbDataFrame::estimated_size, 0))?;
|
|
75
77
|
class.define_method("dtype_strings", method!(RbDataFrame::dtype_strings, 0))?;
|
|
76
78
|
class.define_method("write_avro", method!(RbDataFrame::write_avro, 3))?;
|
|
77
79
|
class.define_method("write_json", method!(RbDataFrame::write_json, 1))?;
|
|
78
|
-
class.define_method("write_ndjson", method!(RbDataFrame::write_ndjson, 1))?;
|
|
79
|
-
class.define_method("write_csv", method!(RbDataFrame::write_csv, 10))?;
|
|
80
|
-
class.define_method("write_ipc", method!(RbDataFrame::write_ipc, 5))?;
|
|
81
80
|
class.define_method(
|
|
82
81
|
"write_ipc_stream",
|
|
83
82
|
method!(RbDataFrame::write_ipc_stream, 3),
|
|
@@ -89,7 +88,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
89
88
|
method!(RbDataFrame::__arrow_c_stream__, 0),
|
|
90
89
|
)?;
|
|
91
90
|
class.define_method("to_numo", method!(RbDataFrame::to_numo, 0))?;
|
|
92
|
-
class.define_method("write_parquet", method!(RbDataFrame::write_parquet, 6))?;
|
|
93
91
|
class.define_method("add", method!(RbDataFrame::add, 1))?;
|
|
94
92
|
class.define_method("sub", method!(RbDataFrame::sub, 1))?;
|
|
95
93
|
class.define_method("div", method!(RbDataFrame::div, 1))?;
|
|
@@ -121,17 +119,17 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
121
119
|
class.define_method("vstack_mut", method!(RbDataFrame::vstack_mut, 1))?;
|
|
122
120
|
class.define_method("vstack", method!(RbDataFrame::vstack, 1))?;
|
|
123
121
|
class.define_method("drop_in_place", method!(RbDataFrame::drop_in_place, 1))?;
|
|
124
|
-
class.define_method("
|
|
122
|
+
class.define_method("to_series", method!(RbDataFrame::to_series, 1))?;
|
|
125
123
|
class.define_method(
|
|
126
124
|
"get_column_index",
|
|
127
125
|
method!(RbDataFrame::get_column_index, 1),
|
|
128
126
|
)?;
|
|
129
127
|
class.define_method("get_column", method!(RbDataFrame::get_column, 1))?;
|
|
130
128
|
class.define_method("select", method!(RbDataFrame::select, 1))?;
|
|
131
|
-
class.define_method("
|
|
129
|
+
class.define_method("gather", method!(RbDataFrame::gather, 1))?;
|
|
132
130
|
class.define_method(
|
|
133
|
-
"
|
|
134
|
-
method!(RbDataFrame::
|
|
131
|
+
"gather_with_series",
|
|
132
|
+
method!(RbDataFrame::gather_with_series, 1),
|
|
135
133
|
)?;
|
|
136
134
|
class.define_method("replace", method!(RbDataFrame::replace, 2))?;
|
|
137
135
|
class.define_method("replace_column", method!(RbDataFrame::replace_column, 2))?;
|
|
@@ -204,6 +202,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
204
202
|
class.define_method("unique_stable", method!(RbExpr::unique_stable, 0))?;
|
|
205
203
|
class.define_method("first", method!(RbExpr::first, 0))?;
|
|
206
204
|
class.define_method("last", method!(RbExpr::last, 0))?;
|
|
205
|
+
class.define_method("item", method!(RbExpr::item, 1))?;
|
|
207
206
|
class.define_method("implode", method!(RbExpr::implode, 0))?;
|
|
208
207
|
class.define_method("quantile", method!(RbExpr::quantile, 2))?;
|
|
209
208
|
class.define_method("cut", method!(RbExpr::cut, 4))?;
|
|
@@ -217,7 +216,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
217
216
|
class.define_method("value_counts", method!(RbExpr::value_counts, 4))?;
|
|
218
217
|
class.define_method("unique_counts", method!(RbExpr::unique_counts, 0))?;
|
|
219
218
|
class.define_method("null_count", method!(RbExpr::null_count, 0))?;
|
|
220
|
-
class.define_method("cast", method!(RbExpr::cast,
|
|
219
|
+
class.define_method("cast", method!(RbExpr::cast, 3))?;
|
|
221
220
|
class.define_method("sort_with", method!(RbExpr::sort_with, 2))?;
|
|
222
221
|
class.define_method("arg_sort", method!(RbExpr::arg_sort, 2))?;
|
|
223
222
|
class.define_method("top_k", method!(RbExpr::top_k, 1))?;
|
|
@@ -282,7 +281,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
282
281
|
class.define_method("radians", method!(RbExpr::radians, 0))?;
|
|
283
282
|
class.define_method("sign", method!(RbExpr::sign, 0))?;
|
|
284
283
|
class.define_method("is_duplicated", method!(RbExpr::is_duplicated, 0))?;
|
|
285
|
-
class.define_method("over", method!(RbExpr::over,
|
|
284
|
+
class.define_method("over", method!(RbExpr::over, 5))?;
|
|
286
285
|
class.define_method("rolling", method!(RbExpr::rolling, 4))?;
|
|
287
286
|
class.define_method("and_", method!(RbExpr::and_, 1))?;
|
|
288
287
|
class.define_method("or_", method!(RbExpr::or_, 1))?;
|
|
@@ -356,6 +355,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
356
355
|
class.define_method("arr_tail", method!(RbExpr::arr_tail, 2))?;
|
|
357
356
|
class.define_method("arr_shift", method!(RbExpr::arr_shift, 1))?;
|
|
358
357
|
class.define_method("arr_explode", method!(RbExpr::arr_explode, 0))?;
|
|
358
|
+
class.define_method("arr_eval", method!(RbExpr::arr_eval, 2))?;
|
|
359
|
+
class.define_method("arr_agg", method!(RbExpr::arr_agg, 1))?;
|
|
359
360
|
class.define_method("binary_contains", method!(RbExpr::bin_contains, 1))?;
|
|
360
361
|
class.define_method("binary_ends_with", method!(RbExpr::bin_ends_with, 1))?;
|
|
361
362
|
class.define_method("binary_starts_with", method!(RbExpr::bin_starts_with, 1))?;
|
|
@@ -418,6 +419,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
418
419
|
class.define_method("dt_iso_year", method!(RbExpr::dt_iso_year, 0))?;
|
|
419
420
|
class.define_method("dt_quarter", method!(RbExpr::dt_quarter, 0))?;
|
|
420
421
|
class.define_method("dt_month", method!(RbExpr::dt_month, 0))?;
|
|
422
|
+
class.define_method("dt_days_in_month", method!(RbExpr::dt_days_in_month, 0))?;
|
|
421
423
|
class.define_method("dt_week", method!(RbExpr::dt_week, 0))?;
|
|
422
424
|
class.define_method("dt_weekday", method!(RbExpr::dt_weekday, 0))?;
|
|
423
425
|
class.define_method("dt_day", method!(RbExpr::dt_day, 0))?;
|
|
@@ -450,7 +452,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
450
452
|
class.define_method("dt_timestamp", method!(RbExpr::dt_timestamp, 1))?;
|
|
451
453
|
class.define_method("dt_to_string", method!(RbExpr::dt_to_string, 1))?;
|
|
452
454
|
class.define_method("dt_offset_by", method!(RbExpr::dt_offset_by, 1))?;
|
|
453
|
-
class.define_method("dt_with_time_unit", method!(RbExpr::dt_with_time_unit, 1))?;
|
|
454
455
|
class.define_method(
|
|
455
456
|
"dt_convert_time_zone",
|
|
456
457
|
method!(RbExpr::dt_convert_time_zone, 1),
|
|
@@ -493,6 +494,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
493
494
|
"rolling_quantile_by",
|
|
494
495
|
method!(RbExpr::rolling_quantile_by, 6),
|
|
495
496
|
)?;
|
|
497
|
+
class.define_method("rolling_rank", method!(RbExpr::rolling_rank, 5))?;
|
|
498
|
+
class.define_method("rolling_rank_by", method!(RbExpr::rolling_rank_by, 6))?;
|
|
496
499
|
class.define_method("rolling_skew", method!(RbExpr::rolling_skew, 4))?;
|
|
497
500
|
class.define_method("rolling_kurtosis", method!(RbExpr::rolling_kurtosis, 5))?;
|
|
498
501
|
class.define_method("lower_bound", method!(RbExpr::lower_bound, 0))?;
|
|
@@ -529,6 +532,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
529
532
|
class.define_method("list_shift", method!(RbExpr::list_shift, 1))?;
|
|
530
533
|
class.define_method("list_slice", method!(RbExpr::list_slice, 2))?;
|
|
531
534
|
class.define_method("list_eval", method!(RbExpr::list_eval, 1))?;
|
|
535
|
+
class.define_method("list_agg", method!(RbExpr::list_agg, 1))?;
|
|
532
536
|
class.define_method("list_filter", method!(RbExpr::list_filter, 1))?;
|
|
533
537
|
class.define_method("cumulative_eval", method!(RbExpr::cumulative_eval, 2))?;
|
|
534
538
|
class.define_method("list_to_struct", method!(RbExpr::list_to_struct, 1))?;
|
|
@@ -561,6 +565,10 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
561
565
|
"struct_field_by_name",
|
|
562
566
|
method!(RbExpr::struct_field_by_name, 1),
|
|
563
567
|
)?;
|
|
568
|
+
class.define_method(
|
|
569
|
+
"struct_multiple_fields",
|
|
570
|
+
method!(RbExpr::struct_multiple_fields, 1),
|
|
571
|
+
)?;
|
|
564
572
|
class.define_method(
|
|
565
573
|
"struct_field_by_index",
|
|
566
574
|
method!(RbExpr::struct_field_by_index, 1),
|
|
@@ -637,6 +645,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
637
645
|
)?;
|
|
638
646
|
class.define_method("meta_is_literal", method!(RbExpr::meta_is_literal, 1))?;
|
|
639
647
|
class.define_method("meta_tree_format", method!(RbExpr::meta_tree_format, 1))?;
|
|
648
|
+
class.define_method("meta_show_graph", method!(RbExpr::meta_show_graph, 1))?;
|
|
640
649
|
|
|
641
650
|
// name
|
|
642
651
|
class.define_method("name_keep", method!(RbExpr::name_keep, 0))?;
|
|
@@ -645,6 +654,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
645
654
|
class.define_method("name_suffix", method!(RbExpr::name_suffix, 1))?;
|
|
646
655
|
class.define_method("name_to_lowercase", method!(RbExpr::name_to_lowercase, 0))?;
|
|
647
656
|
class.define_method("name_to_uppercase", method!(RbExpr::name_to_uppercase, 0))?;
|
|
657
|
+
class.define_method("name_replace", method!(RbExpr::name_replace, 3))?;
|
|
648
658
|
class.define_method("name_prefix_fields", method!(RbExpr::name_prefix_fields, 1))?;
|
|
649
659
|
class.define_method("name_suffix_fields", method!(RbExpr::name_suffix_fields, 1))?;
|
|
650
660
|
|
|
@@ -654,6 +664,8 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
654
664
|
class.define_singleton_method("len", function!(functions::lazy::len, 0))?;
|
|
655
665
|
class.define_singleton_method("fold", function!(functions::lazy::fold, 5))?;
|
|
656
666
|
class.define_singleton_method("cum_fold", function!(functions::lazy::cum_fold, 6))?;
|
|
667
|
+
class.define_singleton_method("cum_reduce", function!(functions::lazy::cum_reduce, 4))?;
|
|
668
|
+
class.define_singleton_method("datetime", function!(functions::lazy::datetime, 10))?;
|
|
657
669
|
class.define_singleton_method("lit", function!(functions::lazy::lit, 3))?;
|
|
658
670
|
class.define_singleton_method("int_range", function!(functions::range::int_range, 4))?;
|
|
659
671
|
class.define_singleton_method("int_ranges", function!(functions::range::int_ranges, 4))?;
|
|
@@ -666,13 +678,13 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
666
678
|
class.define_singleton_method("sql_expr", function!(functions::lazy::sql_expr, 1))?;
|
|
667
679
|
class.define_singleton_method("cov", function!(functions::lazy::cov, 3))?;
|
|
668
680
|
class.define_singleton_method("arctan2", function!(functions::lazy::arctan2, 2))?;
|
|
669
|
-
class.define_singleton_method("arctan2d", function!(functions::lazy::arctan2d, 2))?;
|
|
670
681
|
class.define_singleton_method("rolling_corr", function!(functions::lazy::rolling_corr, 5))?;
|
|
671
682
|
class.define_singleton_method("rolling_cov", function!(functions::lazy::rolling_cov, 5))?;
|
|
672
683
|
class.define_singleton_method("arg_sort_by", function!(functions::lazy::arg_sort_by, 5))?;
|
|
673
684
|
class.define_singleton_method("when", function!(functions::whenthen::when, 1))?;
|
|
674
685
|
class.define_singleton_method("concat_str", function!(functions::lazy::concat_str, 3))?;
|
|
675
686
|
class.define_singleton_method("concat_list", function!(functions::lazy::concat_list, 1))?;
|
|
687
|
+
class.define_singleton_method("concat_arr", function!(functions::lazy::concat_arr, 1))?;
|
|
676
688
|
class.define_singleton_method(
|
|
677
689
|
"business_day_count",
|
|
678
690
|
function!(functions::business::business_day_count, 4),
|
|
@@ -731,13 +743,13 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
731
743
|
class.define_singleton_method("ipc_schema", function!(functions::io::read_ipc_schema, 1))?;
|
|
732
744
|
class.define_singleton_method(
|
|
733
745
|
"read_parquet_metadata",
|
|
734
|
-
function!(functions::io::read_parquet_metadata,
|
|
746
|
+
function!(functions::io::read_parquet_metadata, 4),
|
|
735
747
|
)?;
|
|
736
748
|
class.define_singleton_method(
|
|
737
749
|
"parquet_schema",
|
|
738
750
|
function!(functions::io::read_parquet_schema, 1),
|
|
739
751
|
)?;
|
|
740
|
-
class.define_singleton_method("collect_all", function!(functions::lazy::collect_all,
|
|
752
|
+
class.define_singleton_method("collect_all", function!(functions::lazy::collect_all, 3))?;
|
|
741
753
|
class.define_singleton_method("date_range", function!(functions::range::date_range, 4))?;
|
|
742
754
|
class.define_singleton_method("date_ranges", function!(functions::range::date_ranges, 4))?;
|
|
743
755
|
class.define_singleton_method(
|
|
@@ -750,6 +762,10 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
750
762
|
)?;
|
|
751
763
|
class.define_singleton_method("time_range", function!(functions::range::time_range, 4))?;
|
|
752
764
|
class.define_singleton_method("time_ranges", function!(functions::range::time_ranges, 4))?;
|
|
765
|
+
class.define_singleton_method(
|
|
766
|
+
"linear_spaces",
|
|
767
|
+
function!(functions::range::linear_spaces, 5),
|
|
768
|
+
)?;
|
|
753
769
|
class.define_singleton_method(
|
|
754
770
|
"dtype_str_repr",
|
|
755
771
|
function!(functions::misc::dtype_str_repr, 1),
|
|
@@ -819,6 +835,30 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
819
835
|
function!(functions::random::set_random_seed, 1),
|
|
820
836
|
)?;
|
|
821
837
|
class.define_singleton_method("re_escape", function!(re_escape, 1))?;
|
|
838
|
+
class.define_singleton_method(
|
|
839
|
+
"escape_regex",
|
|
840
|
+
function!(functions::strings::escape_regex, 1),
|
|
841
|
+
)?;
|
|
842
|
+
class.define_singleton_method(
|
|
843
|
+
"assert_dataframe_equal_rb",
|
|
844
|
+
function!(testing::assert_dataframe_equal_rb, 9),
|
|
845
|
+
)?;
|
|
846
|
+
class.define_singleton_method(
|
|
847
|
+
"assert_series_equal_rb",
|
|
848
|
+
function!(testing::assert_series_equal_rb, 9),
|
|
849
|
+
)?;
|
|
850
|
+
class.define_singleton_method(
|
|
851
|
+
"get_engine_affinity",
|
|
852
|
+
function!(functions::utils::rb_get_engine_affinity, 0),
|
|
853
|
+
)?;
|
|
854
|
+
class.define_singleton_method(
|
|
855
|
+
"polars_schema_to_rbcapsule",
|
|
856
|
+
function!(interop::arrow::to_rb::polars_schema_to_rbcapsule, 1),
|
|
857
|
+
)?;
|
|
858
|
+
class.define_singleton_method(
|
|
859
|
+
"init_polars_schema_from_arrow_c_schema",
|
|
860
|
+
function!(interop::arrow::init_polars_schema_from_arrow_c_schema, 2),
|
|
861
|
+
)?;
|
|
822
862
|
|
|
823
863
|
let class = module.define_class("RbLazyFrame", ruby.class_object())?;
|
|
824
864
|
#[cfg(feature = "serialize_binary")]
|
|
@@ -826,6 +866,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
826
866
|
"serialize_binary",
|
|
827
867
|
method!(RbLazyFrame::serialize_binary, 1),
|
|
828
868
|
)?;
|
|
869
|
+
class.define_method("serialize_json", method!(RbLazyFrame::serialize_json, 1))?;
|
|
829
870
|
#[cfg(feature = "serialize_binary")]
|
|
830
871
|
class.define_singleton_method(
|
|
831
872
|
"deserialize_binary",
|
|
@@ -837,7 +878,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
837
878
|
)?;
|
|
838
879
|
class.define_singleton_method(
|
|
839
880
|
"new_from_ndjson",
|
|
840
|
-
function!(RbLazyFrame::new_from_ndjson,
|
|
881
|
+
function!(RbLazyFrame::new_from_ndjson, -1),
|
|
841
882
|
)?;
|
|
842
883
|
class.define_singleton_method("new_from_csv", function!(RbLazyFrame::new_from_csv, -1))?;
|
|
843
884
|
class.define_singleton_method(
|
|
@@ -845,26 +886,39 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
845
886
|
function!(RbLazyFrame::new_from_parquet, 6),
|
|
846
887
|
)?;
|
|
847
888
|
class.define_singleton_method("new_from_ipc", function!(RbLazyFrame::new_from_ipc, 3))?;
|
|
848
|
-
class.define_method("write_json", method!(RbLazyFrame::write_json, 1))?;
|
|
849
889
|
class.define_method("describe_plan", method!(RbLazyFrame::describe_plan, 0))?;
|
|
850
890
|
class.define_method(
|
|
851
891
|
"describe_optimized_plan",
|
|
852
892
|
method!(RbLazyFrame::describe_optimized_plan, 0),
|
|
853
893
|
)?;
|
|
854
894
|
class.define_method(
|
|
855
|
-
"
|
|
856
|
-
method!(RbLazyFrame::
|
|
895
|
+
"describe_plan_tree",
|
|
896
|
+
method!(RbLazyFrame::describe_plan_tree, 0),
|
|
897
|
+
)?;
|
|
898
|
+
class.define_method(
|
|
899
|
+
"describe_optimized_plan_tree",
|
|
900
|
+
method!(RbLazyFrame::describe_optimized_plan_tree, 0),
|
|
901
|
+
)?;
|
|
902
|
+
class.define_method("to_dot", method!(RbLazyFrame::to_dot, 1))?;
|
|
903
|
+
class.define_method(
|
|
904
|
+
"to_dot_streaming_phys",
|
|
905
|
+
method!(RbLazyFrame::to_dot_streaming_phys, 1),
|
|
857
906
|
)?;
|
|
858
907
|
class.define_method("sort", method!(RbLazyFrame::sort, 5))?;
|
|
859
908
|
class.define_method("sort_by_exprs", method!(RbLazyFrame::sort_by_exprs, 5))?;
|
|
860
909
|
class.define_method("top_k", method!(RbLazyFrame::top_k, 3))?;
|
|
861
910
|
class.define_method("bottom_k", method!(RbLazyFrame::bottom_k, 3))?;
|
|
862
911
|
class.define_method("cache", method!(RbLazyFrame::cache, 0))?;
|
|
863
|
-
class.define_method(
|
|
864
|
-
|
|
865
|
-
|
|
912
|
+
class.define_method(
|
|
913
|
+
"with_optimizations",
|
|
914
|
+
method!(RbLazyFrame::with_optimizations, 1),
|
|
915
|
+
)?;
|
|
916
|
+
class.define_method("profile", method!(RbLazyFrame::profile, 0))?;
|
|
917
|
+
class.define_method("collect", method!(RbLazyFrame::collect, 1))?;
|
|
918
|
+
class.define_method("sink_parquet", method!(RbLazyFrame::sink_parquet, 12))?;
|
|
919
|
+
class.define_method("sink_ipc", method!(RbLazyFrame::sink_ipc, 7))?;
|
|
866
920
|
class.define_method("sink_csv", method!(RbLazyFrame::sink_csv, -1))?;
|
|
867
|
-
class.define_method("sink_json", method!(RbLazyFrame::sink_json,
|
|
921
|
+
class.define_method("sink_json", method!(RbLazyFrame::sink_json, 5))?;
|
|
868
922
|
class.define_method("filter", method!(RbLazyFrame::filter, 1))?;
|
|
869
923
|
class.define_method("remove", method!(RbLazyFrame::remove, 1))?;
|
|
870
924
|
class.define_method("select", method!(RbLazyFrame::select, 1))?;
|
|
@@ -875,7 +929,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
875
929
|
"group_by_dynamic",
|
|
876
930
|
method!(RbLazyFrame::group_by_dynamic, 9),
|
|
877
931
|
)?;
|
|
878
|
-
class.define_method("with_context", method!(RbLazyFrame::with_context, 1))?;
|
|
879
932
|
class.define_method("join_asof", method!(RbLazyFrame::join_asof, 14))?;
|
|
880
933
|
class.define_method("join", method!(RbLazyFrame::join, 11))?;
|
|
881
934
|
class.define_method("join_where", method!(RbLazyFrame::join_where, 3))?;
|
|
@@ -914,6 +967,19 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
914
967
|
class.define_method("unnest", method!(RbLazyFrame::unnest, 2))?;
|
|
915
968
|
class.define_method("count", method!(RbLazyFrame::count, 0))?;
|
|
916
969
|
class.define_method("merge_sorted", method!(RbLazyFrame::merge_sorted, 2))?;
|
|
970
|
+
class.define_method("hint_sorted", method!(RbLazyFrame::hint_sorted, 3))?;
|
|
971
|
+
class.define_method(
|
|
972
|
+
"collect_concurrently",
|
|
973
|
+
method!(RbLazyFrame::collect_concurrently, 0),
|
|
974
|
+
)?;
|
|
975
|
+
|
|
976
|
+
let class = module.define_class("RbInProcessQuery", ruby.class_object())?;
|
|
977
|
+
class.define_method("cancel", method!(RbInProcessQuery::cancel, 0))?;
|
|
978
|
+
class.define_method("fetch", method!(RbInProcessQuery::fetch, 0))?;
|
|
979
|
+
class.define_method(
|
|
980
|
+
"fetch_blocking",
|
|
981
|
+
method!(RbInProcessQuery::fetch_blocking, 0),
|
|
982
|
+
)?;
|
|
917
983
|
|
|
918
984
|
let class = module.define_class("RbLazyGroupBy", ruby.class_object())?;
|
|
919
985
|
class.define_method("agg", method!(RbLazyGroupBy::agg, 1))?;
|
|
@@ -949,7 +1015,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
949
1015
|
class.define_singleton_method("new_series_list", function!(RbSeries::new_series_list, 3))?;
|
|
950
1016
|
class.define_singleton_method("new_array", function!(RbSeries::new_array, 5))?;
|
|
951
1017
|
class.define_singleton_method("new_decimal", function!(RbSeries::new_decimal, 3))?;
|
|
952
|
-
class.define_singleton_method("repeat", function!(RbSeries::repeat, 4))?;
|
|
953
1018
|
class.define_singleton_method(
|
|
954
1019
|
"from_arrow_c_stream",
|
|
955
1020
|
function!(RbSeries::from_arrow_c_stream, 1),
|
|
@@ -975,6 +1040,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
975
1040
|
class.define_method("cat_is_local", method!(RbSeries::cat_is_local, 0))?;
|
|
976
1041
|
class.define_method("cat_to_local", method!(RbSeries::cat_to_local, 0))?;
|
|
977
1042
|
class.define_method("estimated_size", method!(RbSeries::estimated_size, 0))?;
|
|
1043
|
+
class.define_method("reshape", method!(RbSeries::reshape, 1))?;
|
|
978
1044
|
class.define_method("get_fmt", method!(RbSeries::get_fmt, 2))?;
|
|
979
1045
|
class.define_method("rechunk", method!(RbSeries::rechunk, 1))?;
|
|
980
1046
|
class.define_method("get_index", method!(RbSeries::get_index, 1))?;
|
|
@@ -986,7 +1052,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
986
1052
|
class.define_method("name", method!(RbSeries::name, 0))?;
|
|
987
1053
|
class.define_method("rename", method!(RbSeries::rename, 1))?;
|
|
988
1054
|
class.define_method("dtype", method!(RbSeries::dtype, 0))?;
|
|
989
|
-
class.define_method("inner_dtype", method!(RbSeries::inner_dtype, 0))?;
|
|
990
1055
|
class.define_method("set_sorted", method!(RbSeries::set_sorted_flag, 1))?;
|
|
991
1056
|
class.define_method("mean", method!(RbSeries::mean, 0))?;
|
|
992
1057
|
class.define_method("max", method!(RbSeries::max, 0))?;
|
|
@@ -1015,11 +1080,12 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1015
1080
|
class.define_method("all", method!(RbSeries::all, 1))?;
|
|
1016
1081
|
class.define_method("arg_min", method!(RbSeries::arg_min, 0))?;
|
|
1017
1082
|
class.define_method("arg_max", method!(RbSeries::arg_max, 0))?;
|
|
1018
|
-
class.define_method(
|
|
1083
|
+
class.define_method(
|
|
1084
|
+
"gather_with_series",
|
|
1085
|
+
method!(RbSeries::gather_with_series, 1),
|
|
1086
|
+
)?;
|
|
1019
1087
|
class.define_method("null_count", method!(RbSeries::null_count, 0))?;
|
|
1020
1088
|
class.define_method("has_nulls", method!(RbSeries::has_nulls, 0))?;
|
|
1021
|
-
class.define_method("sample_n", method!(RbSeries::sample_n, 4))?;
|
|
1022
|
-
class.define_method("sample_frac", method!(RbSeries::sample_frac, 4))?;
|
|
1023
1089
|
class.define_method("equals", method!(RbSeries::equals, 4))?;
|
|
1024
1090
|
class.define_method("eq", method!(RbSeries::eq, 1))?;
|
|
1025
1091
|
class.define_method("neq", method!(RbSeries::neq, 1))?;
|
|
@@ -1034,7 +1100,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1034
1100
|
method!(RbSeries::str_to_decimal_infer, 1),
|
|
1035
1101
|
)?;
|
|
1036
1102
|
class.define_method("str_json_decode", method!(RbSeries::str_json_decode, 1))?;
|
|
1037
|
-
class.define_method("to_s", method!(RbSeries::
|
|
1103
|
+
class.define_method("to_s", method!(RbSeries::as_str, 0))?;
|
|
1038
1104
|
class.define_method("len", method!(RbSeries::len, 0))?;
|
|
1039
1105
|
class.define_method("to_a", method!(RbSeries::to_a, 0))?;
|
|
1040
1106
|
class.define_method("median", method!(RbSeries::median, 0))?;
|
|
@@ -1049,11 +1115,12 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1049
1115
|
class.define_method("dot", method!(RbSeries::dot, 1))?;
|
|
1050
1116
|
class.define_method("skew", method!(RbSeries::skew, 1))?;
|
|
1051
1117
|
class.define_method("kurtosis", method!(RbSeries::kurtosis, 2))?;
|
|
1052
|
-
class.define_method("cast", method!(RbSeries::cast,
|
|
1118
|
+
class.define_method("cast", method!(RbSeries::cast, 3))?;
|
|
1053
1119
|
class.define_method("get_chunks", method!(RbSeries::get_chunks, 0))?;
|
|
1054
1120
|
class.define_method("is_sorted", method!(RbSeries::is_sorted, 2))?;
|
|
1055
1121
|
class.define_method("clear", method!(RbSeries::clear, 0))?;
|
|
1056
|
-
class.define_method("
|
|
1122
|
+
class.define_method("head", method!(RbSeries::head, 1))?;
|
|
1123
|
+
class.define_method("tail", method!(RbSeries::tail, 1))?;
|
|
1057
1124
|
class.define_method("scatter", method!(RbSeries::scatter, 2))?;
|
|
1058
1125
|
|
|
1059
1126
|
// set
|
|
@@ -1138,6 +1205,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1138
1205
|
class.define_method("eq_i16", method!(RbSeries::eq_i16, 1))?;
|
|
1139
1206
|
class.define_method("eq_i32", method!(RbSeries::eq_i32, 1))?;
|
|
1140
1207
|
class.define_method("eq_i64", method!(RbSeries::eq_i64, 1))?;
|
|
1208
|
+
class.define_method("eq_i128", method!(RbSeries::eq_i128, 1))?;
|
|
1141
1209
|
class.define_method("eq_f32", method!(RbSeries::eq_f32, 1))?;
|
|
1142
1210
|
class.define_method("eq_f64", method!(RbSeries::eq_f64, 1))?;
|
|
1143
1211
|
|
|
@@ -1150,6 +1218,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1150
1218
|
class.define_method("neq_i16", method!(RbSeries::neq_i16, 1))?;
|
|
1151
1219
|
class.define_method("neq_i32", method!(RbSeries::neq_i32, 1))?;
|
|
1152
1220
|
class.define_method("neq_i64", method!(RbSeries::neq_i64, 1))?;
|
|
1221
|
+
class.define_method("neq_i128", method!(RbSeries::neq_i128, 1))?;
|
|
1153
1222
|
class.define_method("neq_f32", method!(RbSeries::neq_f32, 1))?;
|
|
1154
1223
|
class.define_method("neq_f64", method!(RbSeries::neq_f64, 1))?;
|
|
1155
1224
|
|
|
@@ -1162,6 +1231,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1162
1231
|
class.define_method("gt_i16", method!(RbSeries::gt_i16, 1))?;
|
|
1163
1232
|
class.define_method("gt_i32", method!(RbSeries::gt_i32, 1))?;
|
|
1164
1233
|
class.define_method("gt_i64", method!(RbSeries::gt_i64, 1))?;
|
|
1234
|
+
class.define_method("gt_i128", method!(RbSeries::gt_i128, 1))?;
|
|
1165
1235
|
class.define_method("gt_f32", method!(RbSeries::gt_f32, 1))?;
|
|
1166
1236
|
class.define_method("gt_f64", method!(RbSeries::gt_f64, 1))?;
|
|
1167
1237
|
|
|
@@ -1174,6 +1244,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1174
1244
|
class.define_method("gt_eq_i16", method!(RbSeries::gt_eq_i16, 1))?;
|
|
1175
1245
|
class.define_method("gt_eq_i32", method!(RbSeries::gt_eq_i32, 1))?;
|
|
1176
1246
|
class.define_method("gt_eq_i64", method!(RbSeries::gt_eq_i64, 1))?;
|
|
1247
|
+
class.define_method("gt_eq_i128", method!(RbSeries::gt_eq_i128, 1))?;
|
|
1177
1248
|
class.define_method("gt_eq_f32", method!(RbSeries::gt_eq_f32, 1))?;
|
|
1178
1249
|
class.define_method("gt_eq_f64", method!(RbSeries::gt_eq_f64, 1))?;
|
|
1179
1250
|
|
|
@@ -1186,6 +1257,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1186
1257
|
class.define_method("lt_i16", method!(RbSeries::lt_i16, 1))?;
|
|
1187
1258
|
class.define_method("lt_i32", method!(RbSeries::lt_i32, 1))?;
|
|
1188
1259
|
class.define_method("lt_i64", method!(RbSeries::lt_i64, 1))?;
|
|
1260
|
+
class.define_method("lt_i128", method!(RbSeries::lt_i128, 1))?;
|
|
1189
1261
|
class.define_method("lt_f32", method!(RbSeries::lt_f32, 1))?;
|
|
1190
1262
|
class.define_method("lt_f64", method!(RbSeries::lt_f64, 1))?;
|
|
1191
1263
|
|
|
@@ -1198,6 +1270,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1198
1270
|
class.define_method("lt_eq_i16", method!(RbSeries::lt_eq_i16, 1))?;
|
|
1199
1271
|
class.define_method("lt_eq_i32", method!(RbSeries::lt_eq_i32, 1))?;
|
|
1200
1272
|
class.define_method("lt_eq_i64", method!(RbSeries::lt_eq_i64, 1))?;
|
|
1273
|
+
class.define_method("lt_eq_i128", method!(RbSeries::lt_eq_i128, 1))?;
|
|
1201
1274
|
class.define_method("lt_eq_f32", method!(RbSeries::lt_eq_f32, 1))?;
|
|
1202
1275
|
class.define_method("lt_eq_f64", method!(RbSeries::lt_eq_f64, 1))?;
|
|
1203
1276
|
|
|
@@ -1212,9 +1285,6 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1212
1285
|
// npy
|
|
1213
1286
|
class.define_method("to_numo", method!(RbSeries::to_numo, 0))?;
|
|
1214
1287
|
|
|
1215
|
-
// extra
|
|
1216
|
-
class.define_method("extend_constant", method!(RbSeries::extend_constant, 2))?;
|
|
1217
|
-
|
|
1218
1288
|
// when then
|
|
1219
1289
|
let class = module.define_class("RbWhen", ruby.class_object())?;
|
|
1220
1290
|
class.define_method("then", method!(RbWhen::then, 1))?;
|
|
@@ -1246,6 +1316,10 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1246
1316
|
let class = module.define_class("ArrowArrayStream", ruby.class_object())?;
|
|
1247
1317
|
class.define_method("to_i", method!(RbArrowArrayStream::to_i, 0))?;
|
|
1248
1318
|
|
|
1319
|
+
// arrow schema
|
|
1320
|
+
let class = module.define_class("ArrowSchema", ruby.class_object())?;
|
|
1321
|
+
class.define_method("to_i", method!(RbArrowSchema::to_i, 0))?;
|
|
1322
|
+
|
|
1249
1323
|
// catalog
|
|
1250
1324
|
let class = module.define_class("RbCatalogClient", ruby.class_object())?;
|
|
1251
1325
|
class.define_singleton_method("new", function!(RbCatalogClient::new, 2))?;
|
|
@@ -1336,92 +1410,83 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1336
1410
|
class.define_singleton_method("default", function!(RbOptFlags::default, 0))?;
|
|
1337
1411
|
class.define_method("no_optimizations", method!(RbOptFlags::no_optimizations, 0))?;
|
|
1338
1412
|
class.define_method("copy", method!(RbOptFlags::copy, 0))?;
|
|
1413
|
+
class.define_method("type_coercion", method!(RbOptFlags::get_type_coercion, 0))?;
|
|
1414
|
+
class.define_method("type_coercion=", method!(RbOptFlags::set_type_coercion, 1))?;
|
|
1415
|
+
class.define_method("type_check", method!(RbOptFlags::get_type_check, 0))?;
|
|
1416
|
+
class.define_method("type_check=", method!(RbOptFlags::set_type_check, 1))?;
|
|
1339
1417
|
class.define_method(
|
|
1340
|
-
"
|
|
1341
|
-
method!(RbOptFlags::get_type_coercion, 0),
|
|
1342
|
-
)?;
|
|
1343
|
-
class.define_method(
|
|
1344
|
-
"set_type_coercion",
|
|
1345
|
-
method!(RbOptFlags::set_type_coercion, 1),
|
|
1346
|
-
)?;
|
|
1347
|
-
class.define_method("get_type_check", method!(RbOptFlags::get_type_check, 0))?;
|
|
1348
|
-
class.define_method("set_type_check", method!(RbOptFlags::set_type_check, 1))?;
|
|
1349
|
-
class.define_method(
|
|
1350
|
-
"get_projection_pushdown",
|
|
1418
|
+
"projection_pushdown",
|
|
1351
1419
|
method!(RbOptFlags::get_projection_pushdown, 0),
|
|
1352
1420
|
)?;
|
|
1353
1421
|
class.define_method(
|
|
1354
|
-
"
|
|
1422
|
+
"projection_pushdown=",
|
|
1355
1423
|
method!(RbOptFlags::set_projection_pushdown, 1),
|
|
1356
1424
|
)?;
|
|
1357
1425
|
class.define_method(
|
|
1358
|
-
"
|
|
1426
|
+
"predicate_pushdown",
|
|
1359
1427
|
method!(RbOptFlags::get_predicate_pushdown, 0),
|
|
1360
1428
|
)?;
|
|
1361
1429
|
class.define_method(
|
|
1362
|
-
"
|
|
1430
|
+
"predicate_pushdown=",
|
|
1363
1431
|
method!(RbOptFlags::set_predicate_pushdown, 1),
|
|
1364
1432
|
)?;
|
|
1365
1433
|
class.define_method(
|
|
1366
|
-
"
|
|
1434
|
+
"cluster_with_columns",
|
|
1367
1435
|
method!(RbOptFlags::get_cluster_with_columns, 0),
|
|
1368
1436
|
)?;
|
|
1369
1437
|
class.define_method(
|
|
1370
|
-
"
|
|
1438
|
+
"cluster_with_columns=",
|
|
1371
1439
|
method!(RbOptFlags::set_cluster_with_columns, 1),
|
|
1372
1440
|
)?;
|
|
1373
1441
|
class.define_method(
|
|
1374
|
-
"
|
|
1442
|
+
"simplify_expression",
|
|
1375
1443
|
method!(RbOptFlags::get_simplify_expression, 0),
|
|
1376
1444
|
)?;
|
|
1377
1445
|
class.define_method(
|
|
1378
|
-
"
|
|
1446
|
+
"simplify_expression=",
|
|
1379
1447
|
method!(RbOptFlags::set_simplify_expression, 1),
|
|
1380
1448
|
)?;
|
|
1449
|
+
class.define_method("slice_pushdown", method!(RbOptFlags::get_slice_pushdown, 0))?;
|
|
1381
1450
|
class.define_method(
|
|
1382
|
-
"
|
|
1383
|
-
method!(RbOptFlags::get_slice_pushdown, 0),
|
|
1384
|
-
)?;
|
|
1385
|
-
class.define_method(
|
|
1386
|
-
"set_slice_pushdown",
|
|
1451
|
+
"slice_pushdown=",
|
|
1387
1452
|
method!(RbOptFlags::set_slice_pushdown, 1),
|
|
1388
1453
|
)?;
|
|
1389
1454
|
class.define_method(
|
|
1390
|
-
"
|
|
1455
|
+
"comm_subplan_elim",
|
|
1391
1456
|
method!(RbOptFlags::get_comm_subplan_elim, 0),
|
|
1392
1457
|
)?;
|
|
1393
1458
|
class.define_method(
|
|
1394
|
-
"
|
|
1459
|
+
"comm_subplan_elim=",
|
|
1395
1460
|
method!(RbOptFlags::set_comm_subplan_elim, 1),
|
|
1396
1461
|
)?;
|
|
1397
1462
|
class.define_method(
|
|
1398
|
-
"
|
|
1463
|
+
"comm_subexpr_elim",
|
|
1399
1464
|
method!(RbOptFlags::get_comm_subexpr_elim, 0),
|
|
1400
1465
|
)?;
|
|
1401
1466
|
class.define_method(
|
|
1402
|
-
"
|
|
1467
|
+
"comm_subexpr_elim=",
|
|
1403
1468
|
method!(RbOptFlags::set_comm_subexpr_elim, 1),
|
|
1404
1469
|
)?;
|
|
1405
1470
|
class.define_method(
|
|
1406
|
-
"
|
|
1471
|
+
"check_order_observe",
|
|
1407
1472
|
method!(RbOptFlags::get_check_order_observe, 0),
|
|
1408
1473
|
)?;
|
|
1409
1474
|
class.define_method(
|
|
1410
|
-
"
|
|
1475
|
+
"check_order_observe=",
|
|
1411
1476
|
method!(RbOptFlags::set_check_order_observe, 1),
|
|
1412
1477
|
)?;
|
|
1413
1478
|
class.define_method(
|
|
1414
|
-
"
|
|
1479
|
+
"fast_projection",
|
|
1415
1480
|
method!(RbOptFlags::get_fast_projection, 0),
|
|
1416
1481
|
)?;
|
|
1417
1482
|
class.define_method(
|
|
1418
|
-
"
|
|
1483
|
+
"fast_projection=",
|
|
1419
1484
|
method!(RbOptFlags::set_fast_projection, 1),
|
|
1420
1485
|
)?;
|
|
1421
|
-
class.define_method("
|
|
1422
|
-
class.define_method("
|
|
1423
|
-
class.define_method("
|
|
1424
|
-
class.define_method("
|
|
1486
|
+
class.define_method("eager", method!(RbOptFlags::get_eager, 0))?;
|
|
1487
|
+
class.define_method("eager=", method!(RbOptFlags::set_eager, 1))?;
|
|
1488
|
+
class.define_method("streaming", method!(RbOptFlags::get_streaming, 0))?;
|
|
1489
|
+
class.define_method("streaming=", method!(RbOptFlags::set_streaming, 1))?;
|
|
1425
1490
|
|
|
1426
1491
|
Ok(())
|
|
1427
1492
|
}
|
|
@@ -80,19 +80,19 @@ pub fn apply_lambda_unknown<'a>(
|
|
|
80
80
|
.as_value(),
|
|
81
81
|
false,
|
|
82
82
|
));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
} else if out.is_kind_of(ruby.class_string()) {
|
|
84
|
+
let first_value = String::try_convert(out).ok();
|
|
85
|
+
return Ok((
|
|
86
|
+
ruby.obj_wrap(RbSeries::new(
|
|
87
|
+
apply_lambda_with_utf8_out_type(df, lambda, null_count, first_value.as_deref())
|
|
88
|
+
.into_series(),
|
|
89
|
+
))
|
|
90
|
+
.as_value(),
|
|
91
|
+
false,
|
|
92
|
+
));
|
|
93
93
|
} else if out.respond_to("_s", true)? {
|
|
94
94
|
let rb_rbseries: Obj<RbSeries> = out.funcall("_s", ()).unwrap();
|
|
95
|
-
let series = rb_rbseries.series.
|
|
95
|
+
let series = rb_rbseries.series.read();
|
|
96
96
|
let dt = series.dtype();
|
|
97
97
|
return Ok((
|
|
98
98
|
ruby.obj_wrap(RbSeries::new(
|
|
@@ -245,7 +245,7 @@ pub fn apply_lambda_with_list_out_type(
|
|
|
245
245
|
Ok(val) => match val.funcall::<_, _, Value>("_s", ()) {
|
|
246
246
|
Ok(val) => Obj::<RbSeries>::try_convert(val)
|
|
247
247
|
.ok()
|
|
248
|
-
.map(|ps| ps.series.
|
|
248
|
+
.map(|ps| ps.series.read().clone()),
|
|
249
249
|
Err(_) => {
|
|
250
250
|
if val.is_nil() {
|
|
251
251
|
None
|