Skip to content

Commit

Permalink
Merge branch 'main' into unnest-lazyframe
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Sep 26, 2023
2 parents bd3f12b + 0bf921e commit 978083e
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 21 deletions.
22 changes: 18 additions & 4 deletions R/datatype.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ DataType_constructors = list(
},

# doc below pl_List
List = function(datatype) {
List = function(datatype = "unknown") {
if (is.character(datatype) && length(datatype) == 1) {
datatype = .pr$DataType$new(datatype)
}
Expand All @@ -185,7 +185,7 @@ DataType_constructors = list(
Struct = function(...) {
result({
largs = list2(...)
if (is.list(largs[[1]])) {
if (length(largs) >= 1 && is.list(largs[[1]])) {
largs = largs[[1]]
element_name = "list element"
} else {
Expand Down Expand Up @@ -239,13 +239,27 @@ NULL
#'
#' # Find any DataType via pl$dtypes
#' print(pl$dtypes)
#'
#' # check if an element is any kind of Struct()
#' test = pl$Struct(pl$UInt64)
#' pl$same_outer_dt(test, pl$Struct())
#'
#' # `test` is a type of Struct, but it doesn't mean it is equal to an empty Struct
#' test == pl$Struct()
NULL

#' Create List DataType
#' @keywords pl
#' @name pl_List
#' @param datatype an inner DataType
#' @param datatype an inner DataType, default is "Unknown" (placeholder for when inner DataType
#' does not matter, e.g. as used in example)
#' @return a list DataType with an inner DataType
#' @format function
#' @examples pl$List(pl$List(pl$Boolean))
#' @examples
#' # some nested List
#' pl$List(pl$List(pl$Boolean))
#'
#' # check if some maybe_list is a List DataType
#' maybe_List = pl$List(pl$UInt64)
#' pl$same_outer_dt(maybe_List, pl$List())
NULL
34 changes: 23 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,34 +107,46 @@ install.packages(
)
```

#### Windows
#### Windows (x86_64)
```r
install.packages(
"https://github.com/pola-rs/r-polars/releases/latest/download/polars.zip",
repos = NULL
)
```

#### macOS(x86_64)
#### macOS (x86_64)
```r
install.packages(
"https://github.com/pola-rs/r-polars/releases/latest/download/polars__x86_64-apple-darwin20.tgz",
repos = NULL
)
```
````{comment}
#### macOS(aarch64 / arm64)
This release is a little different from above, notice `type = "source"`. To install Make + Xcode is
required but not rustc / cargo. The release is actually a source release bundled with a pre-
cross-compiled object file `./inst/libr_polars.a`. The final linking / building of any R packages
must be done on the native OS/architecture, but that should take only ~20 seconds.

#### Linux (aarch64) / macOS (aarch64)

GitHub releases also provide pre-compiled packages for arm64 (aarch64) platforms.

These are a little different from above. To install, requiring make (and Xcode for macOS)
but not rustc / cargo. They are actually source releases bundled with a pre-compiled object file
`./inst/libr_polars.a`. The final linking / building of any R packages
must be done on the native OS/architecture, but that should take only ~20 seconds.

```r
# Linux
install.packages(
"https://github.com/pola-rs/r-polars/releases/download/cross_test10/polars_cross_aarch64-apple-darwin.tar.gz",
repos = NULL, type = "source"
"https://github.com/pola-rs/r-polars/releases/latest/download/polars_cross_aarch64-unknown-linux-gnu.tar.gz",
repos = NULL
)
```

```r
# macOS
install.packages(
"https://github.com/pola-rs/r-polars/releases/latest/download/polars_cross_aarch64-apple-darwin.tar.gz",
repos = NULL
)
```
````

### Build from source

Expand Down
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ install.packages(
)
```

#### Windows
#### Windows (x86_64)

``` r
install.packages(
Expand All @@ -97,7 +97,7 @@ install.packages(
)
```

#### macOS(x86_64)
#### macOS (x86_64)

``` r
install.packages(
Expand All @@ -106,6 +106,33 @@ install.packages(
)
```

#### Linux (aarch64) / macOS (aarch64)

GitHub releases also provide pre-compiled packages for arm64 (aarch64)
platforms.

These are a little different from above. To install, requiring make (and
Xcode for macOS) but not rustc / cargo. They are actually source
releases bundled with a pre-compiled object file `./inst/libr_polars.a`.
The final linking / building of any R packages must be done on the
native OS/architecture, but that should take only ~20 seconds.

``` r
# Linux
install.packages(
"https://github.com/pola-rs/r-polars/releases/latest/download/polars_cross_aarch64-unknown-linux-gnu.tar.gz",
repos = NULL
)
```

``` r
# macOS
install.packages(
"https://github.com/pola-rs/r-polars/releases/latest/download/polars_cross_aarch64-apple-darwin.tar.gz",
repos = NULL
)
```

### Build from source

For source installation, the Rust toolchain (Rust 1.70 or later) must be
Expand Down Expand Up @@ -359,9 +386,9 @@ check_polars() #assumes rust target at `paste0(getwd(),"/src/rust")`

If you experience unexpected sluggish performance, when using polars in
a given IDE, we’d like to hear about it. You can try to activate
`pl$set_options(debug_polars = TRUE)` to profile what methods are
being touched (not necessarily run) and how fast. Below is an example of
good behavior.
`pl$set_options(debug_polars = TRUE)` to profile what methods are being
touched (not necessarily run) and how fast. Below is an example of good
behavior.

``` r
#run e.g. an eager query after setting debug_polars = TRUE
Expand Down
8 changes: 7 additions & 1 deletion man/pl_List.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions man/pl_Struct_datatype.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 978083e

Please sign in to comment.