diff --git a/ext/polars/src/lib.rs b/ext/polars/src/lib.rs index 774e0738c8..b6eda39807 100644 --- a/ext/polars/src/lib.rs +++ b/ext/polars/src/lib.rs @@ -48,25 +48,7 @@ type RbResult = Result; #[magnus::init] fn init(ruby: &Ruby) -> RbResult<()> { let module = define_module("Polars")?; - module.define_singleton_method( - "_concat_lf_diagonal", - function!(functions::lazy::concat_lf_diagonal, 4), - )?; module.define_singleton_method("_rb_duration", function!(functions::lazy::duration, 9))?; - module.define_singleton_method("_concat_df", function!(functions::eager::concat_df, 1))?; - module.define_singleton_method("_concat_lf", function!(functions::lazy::concat_lf, 4))?; - module.define_singleton_method( - "_concat_df_diagonal", - function!(functions::eager::concat_df_diagonal, 1), - )?; - module.define_singleton_method( - "_concat_df_horizontal", - function!(functions::eager::concat_df_horizontal, 1), - )?; - module.define_singleton_method( - "_concat_series", - function!(functions::eager::concat_series, 1), - )?; module.define_singleton_method("_ipc_schema", function!(functions::io::read_ipc_schema, 1))?; module.define_singleton_method( "_parquet_schema", @@ -643,6 +625,24 @@ fn init(ruby: &Ruby) -> RbResult<()> { class.define_singleton_method("as_struct", function!(functions::lazy::as_struct, 1))?; class.define_singleton_method("coalesce_exprs", function!(functions::lazy::coalesce, 1))?; class.define_singleton_method("arg_where", function!(functions::lazy::arg_where, 1))?; + class.define_singleton_method( + "concat_lf_diagonal", + function!(functions::lazy::concat_lf_diagonal, 4), + )?; + class.define_singleton_method("concat_df", function!(functions::eager::concat_df, 1))?; + class.define_singleton_method("concat_lf", function!(functions::lazy::concat_lf, 4))?; + class.define_singleton_method( + "concat_df_diagonal", + function!(functions::eager::concat_df_diagonal, 1), + )?; + class.define_singleton_method( + "concat_df_horizontal", + function!(functions::eager::concat_df_horizontal, 1), + )?; + class.define_singleton_method( + "concat_series", + function!(functions::eager::concat_series, 1), + )?; let class = module.define_class("RbLazyFrame", ruby.class_object())?; class.define_singleton_method("read_json", function!(RbLazyFrame::read_json, 1))?; diff --git a/lib/polars/functions.rb b/lib/polars/functions.rb index 522256495f..f8b4690a99 100644 --- a/lib/polars/functions.rb +++ b/lib/polars/functions.rb @@ -53,27 +53,27 @@ def concat(items, rechunk: true, how: "vertical", parallel: true) first = items[0] if first.is_a?(DataFrame) if how == "vertical" - out = Utils.wrap_df(_concat_df(items)) + out = Utils.wrap_df(Plr.concat_df(items)) elsif how == "diagonal" - out = Utils.wrap_df(_concat_df_diagonal(items)) + out = Utils.wrap_df(Plr.concat_df_diagonal(items)) elsif how == "horizontal" - out = Utils.wrap_df(_concat_df_horizontal(items)) + out = Utils.wrap_df(Plr.concat_df_horizontal(items)) else raise ArgumentError, "how must be one of {{'vertical', 'diagonal', 'horizontal'}}, got #{how}" end elsif first.is_a?(LazyFrame) if how == "vertical" - return Utils.wrap_ldf(_concat_lf(items, rechunk, parallel, false)) + return Utils.wrap_ldf(Plr.concat_lf(items, rechunk, parallel, false)) elsif how == "vertical_relaxed" - return Utils.wrap_ldf(_concat_lf(items, rechunk, parallel, true)) + return Utils.wrap_ldf(Plr.concat_lf(items, rechunk, parallel, true)) elsif how == "diagonal" - return Utils.wrap_ldf(_concat_lf_diagonal(items, rechunk, parallel, false)) + return Utils.wrap_ldf(Plr.concat_lf_diagonal(items, rechunk, parallel, false)) else raise ArgumentError, "Lazy only allows 'vertical', 'vertical_relaxed', and 'diagonal' concat strategy." end elsif first.is_a?(Series) # TODO - out = Utils.wrap_s(_concat_series(items)) + out = Utils.wrap_s(Plr.concat_series(items)) elsif first.is_a?(Expr) out = first items[1..-1].each do |e|