You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2026/01/08 06:09:31 UTC

[PR] feat(r): Add transmute() implementation [sedona-db]

paleolimbot opened a new pull request, #499:
URL: https://github.com/apache/sedona-db/pull/499

   This needs some extensive testing but is very cool! The overhead here is very low (we can execute x + 1 just as fast as native R data frames!).
   
   ``` r
   library(sedonadb)
   
   df <- data.frame(x = 1:1e6)
   
   df |> sedonadb:::sd_transmute(y = x + 1)
   #> ┌─────────┐
   #> │    y    │
   #> │ float64 │
   #> ╞═════════╡
   #> │     2.0 │
   #> ├╌╌╌╌╌╌╌╌╌┤
   #> │     3.0 │
   #> ├╌╌╌╌╌╌╌╌╌┤
   #> │     4.0 │
   #> ├╌╌╌╌╌╌╌╌╌┤
   #> │     5.0 │
   #> ├╌╌╌╌╌╌╌╌╌┤
   #> │     6.0 │
   #> ├╌╌╌╌╌╌╌╌╌┤
   #> │     7.0 │
   #> └─────────┘
   #> Preview of up to 6 row(s)
   df |> sedonadb:::sd_transmute(y = sum(x))
   #> ┌──────────────┐
   #> │       y      │
   #> │     int64    │
   #> ╞══════════════╡
   #> │ 500000500000 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500000500000 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500000500000 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500000500000 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500000500000 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500000500000 │
   #> └──────────────┘
   #> Preview of up to 6 row(s)
   df |> sedonadb:::sd_transmute(y = sum(x + 1) + x)
   #> ┌────────────────┐
   #> │        y       │
   #> │     float64    │
   #> ╞════════════════╡
   #> │ 500001500001.0 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500001500002.0 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500001500003.0 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500001500004.0 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500001500005.0 │
   #> ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │ 500001500006.0 │
   #> └────────────────┘
   #> Preview of up to 6 row(s)
   
   bench::mark(
     sd = df |> 
       sedonadb:::sd_transmute(y = sum(x + 1)) |> 
       sd_collect(),
     arrow = df |> 
       arrow::as_arrow_table() |> 
       dplyr::transmute(y = x + 1) |> 
       dplyr::collect(),
     duckdb = df |> 
       arrow::as_arrow_table() |> 
       dplyr::transmute(y = x + 1) |> 
       dplyr::collect(),
     dplyr = df |> dplyr::transmute(y = x + 1),
     check = FALSE
   )
   #> # A tibble: 4 × 6
   #>   expression      min   median `itr/sec` mem_alloc `gc/sec`
   #>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
   #> 1 sd           1.25ms   2.77ms      334.     7.7MB     84.5
   #> 2 arrow        9.09ms    9.8ms      100.   38.01MB     17.1
   #> 3 duckdb       9.19ms   9.64ms      103.  145.85KB     16.4
   #> 4 dplyr        1.27ms   1.37ms      697.    8.89MB    161.
   ```
   
   <sup>Created on 2026-01-08 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r/sedonadb): Add basic DataFrame API with `sd_select()`, `sd_transmute()`, and `sd_filter()` [sedona-db]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #499:
URL: https://github.com/apache/sedona-db/pull/499#issuecomment-3791384562

   why do we need `sd_` prefix if we already have `sedonadb:::`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r/sedonadb): Add basic DataFrame API with `sd_select()`, `sd_transmute()`, and `sd_filter()` [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #499:
URL: https://github.com/apache/sedona-db/pull/499


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r/sedonadb): Add basic DataFrame API with `sd_select()`, `sd_transmute()`, and `sd_filter()` [sedona-db]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #499:
URL: https://github.com/apache/sedona-db/pull/499#discussion_r2722197295


##########
r/sedonadb/src/rust/src/expression.rs:
##########
@@ -17,7 +17,7 @@
 
 use std::sync::Arc;
 
-use datafusion_common::{Column, ScalarValue};
+use datafusion_common::{Column, Result, ScalarValue};

Review Comment:
   The import of 'Result' from datafusion_common appears unused in this file. The only Result type used is from savvy::Result.
   ```suggestion
   use datafusion_common::{Column, ScalarValue};
   ```



##########
r/sedonadb/src/rust/src/dataframe.rs:
##########
@@ -311,4 +313,21 @@ impl InternalDataFrame {
         let inner = self.inner.clone().select(exprs)?;
         Ok(new_data_frame(inner, self.runtime.clone()))
     }
+
+    fn select(&self, exprs_sexp: savvy::Sexp) -> savvy::Result<InternalDataFrame> {

Review Comment:
   The method name 'select' conflicts with the existing public method 'select_indices' at line 313. Consider renaming this method to 'select_exprs' to clearly distinguish it from the index-based selection method.
   ```suggestion
       fn select_exprs(&self, exprs_sexp: savvy::Sexp) -> savvy::Result<InternalDataFrame> {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(r/sedonadb): Add basic DataFrame API with `sd_select()`, `sd_transmute()`, and `sd_filter()` [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #499:
URL: https://github.com/apache/sedona-db/pull/499#issuecomment-3791418906

   > why do we need sd_ prefix if we already have sedonadb:::?
   
   Autocomplete!
   <img width="677" height="168" alt="Screenshot 2026-01-23 at 11 32 01 AM" src="https://github.com/user-attachments/assets/2b7cf5d8-28e2-4a16-a8e8-262bb6e19a0b" />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org