Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: bump rust-polars to 0.30.0 #289

Merged
merged 31 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f53626b
feat!: bump rust-polars to 0.30.0 and update deps by `Cargo update`
eitsupi Jul 2, 2023
c65668e
chore: bump rust toolchain version
eitsupi Jul 2, 2023
6c8e58b
fix: fix for StrptimeOptions
eitsupi Jul 2, 2023
1875083
fix: rename concat_lst to concat_list
eitsupi Jul 2, 2023
98f3913
fix: rename arr() to list()
eitsupi Jul 2, 2023
8744515
fix: fix for Schema
eitsupi Jul 2, 2023
3a2a5fc
fix: remove the name argument from date_range
eitsupi Jul 2, 2023
1043750
chore: update R files
eitsupi Jul 2, 2023
8e5b6d5
refactor: auto formatting
eitsupi Jul 2, 2023
200d787
test: should ignore NA
eitsupi Jul 2, 2023
24adc95
test: shoud sorted before join_asof
eitsupi Jul 2, 2023
5790324
fix: remove unused argument
eitsupi Jul 2, 2023
50048e8
fix: remove unused arguments and update error message
eitsupi Jul 2, 2023
340fe39
test: shoud sorted before join_asof
eitsupi Jul 2, 2023
414d957
feat!: str_explode (old behavior of explode)
eitsupi Jul 2, 2023
ffa78c7
test: should ignore NA
eitsupi Jul 2, 2023
29ea182
feat!: date_range's default to lazy = TRUE
eitsupi Jul 2, 2023
4242de1
add explode to restore old behaviour for now
sorhawell Jul 3, 2023
dd7853f
fix unit test assuming eager
sorhawell Jul 3, 2023
2155cda
add context to unwrap
sorhawell Jul 3, 2023
28c1b7e
fix subtle typo bug
sorhawell Jul 3, 2023
71472e8
fix pl$date_range use in examples
sorhawell Jul 3, 2023
5431dad
add news
sorhawell Jul 3, 2023
a0e55f8
fix examples errors
sorhawell Jul 3, 2023
1bd77c4
Merge branch 'main' into rust-polars-0.30
eitsupi Jul 4, 2023
ba91908
docs(news): update news
eitsupi Jul 4, 2023
ee43da4
docs: update files
eitsupi Jul 4, 2023
2601b36
test: remove trailing comma
eitsupi Jul 4, 2023
970c0f1
docs: we have not renamed arr to list in R side yet
eitsupi Jul 4, 2023
249fb68
fix: fix the date_range error in the docs
eitsupi Jul 4, 2023
749e1f2
Update NEWS.md
eitsupi Jul 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SHELL := /bin/bash
VENV := .venv

RUST_TOOLCHAIN_VERSION := nightly-2023-04-11
RUST_TOOLCHAIN_VERSION := nightly-2023-05-07

MANIFEST_PATH := src/rust/Cargo.toml

Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

- Replace the argument `reverse` by `descending` in all sorting functions. This
is for consistency with the upstream Polars (#291, #293).
- Bump rust-polars from 2023-04-20 unreleased version to version 0.30.0 released in 2023-05-30 (#289).
- Rename `concat_lst` to `concat_list`.
<!-- TODO: - Rename `arr` to `list`. -->
- Rename `$str$explode` to `$str$str_explode`.
- Remove `tz_aware` and `utc` arguments from `str_parse`.
- in `$date_range`'s the `lazy` argument is now `TRUE` by default.

## What's changed

Expand Down
133 changes: 99 additions & 34 deletions R/expr__datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' @examples
#' t1 = as.POSIXct("3040-01-01", tz = "GMT")
#' t2 = t1 + as.difftime(25, units = "secs")
#' s = pl$date_range(t1, t2, interval = "2s", time_unit = "ms")
#' s = pl$date_range(t1, t2, interval = "2s", time_unit = "ms", lazy = FALSE)
#'
#' # use a dt namespace function
#' df = pl$DataFrame(datetime = s)$with_columns(
Expand Down Expand Up @@ -78,7 +78,7 @@ ExprDT_truncate = function(
#' @examples
#' t1 = as.POSIXct("3040-01-01", tz = "GMT")
#' t2 = t1 + as.difftime(25, units = "secs")
#' s = pl$date_range(t1, t2, interval = "2s", time_unit = "ms")
#' s = pl$date_range(t1, t2, interval = "2s", time_unit = "ms", lazy = FALSE)
#'
#' # use a dt namespace function
#' df = pl$DataFrame(datetime = s)$with_columns(
Expand Down Expand Up @@ -173,7 +173,8 @@ ExprDT_strftime = function(fmt) {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand Down Expand Up @@ -203,7 +204,8 @@ ExprDT_year = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand Down Expand Up @@ -231,7 +233,8 @@ ExprDT_iso_year = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -258,7 +261,8 @@ ExprDT_quarter = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand Down Expand Up @@ -286,7 +290,8 @@ ExprDT_month = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -312,7 +317,8 @@ ExprDT_week = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand Down Expand Up @@ -340,7 +346,8 @@ ExprDT_weekday = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -367,7 +374,8 @@ ExprDT_day = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -394,7 +402,8 @@ ExprDT_ordinal_day = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -420,7 +429,8 @@ ExprDT_hour = function() {
#' as.Date("2020-12-25"),
#' as.Date("2021-1-05"),
#' interval = "1d",
#' time_zone = "GMT"
#' time_zone = "GMT",
#' lazy = FALSE
#' )
#' )
#' df$with_columns(
Expand All @@ -447,7 +457,8 @@ ExprDT_minute = function() {
#' as.numeric(as.POSIXct("2001-1-1")) * 1E6 + 456789, # manually convert to us
#' as.numeric(as.POSIXct("2001-1-1 00:00:6")) * 1E6,
#' interval = "2s654321us",
#' time_unit = "us" # instruct polars input is us, and store as us
#' time_unit = "us", # instruct polars input is us, and store as us
#' lazy = FALSE
#' ))$with_columns(
#' pl$col("date")$dt$second()$alias("second"),
#' pl$col("date")$dt$second(fractional = TRUE)$alias("second_frac")
Expand Down Expand Up @@ -475,7 +486,8 @@ ExprDT_second = function(fractional = FALSE) {
#' as.numeric(as.POSIXct("2001-1-1")) * 1E6 + 456789, # manually convert to us
#' as.numeric(as.POSIXct("2001-1-1 00:00:6")) * 1E6,
#' interval = "2s654321us",
#' time_unit = "us" # instruct polars input is us, and store as us
#' time_unit = "us", # instruct polars input is us, and store as us
#' lazy = FALSE
#' ))$with_columns(
#' pl$col("date")$cast(pl$Int64)$alias("datetime int64"),
#' pl$col("date")$dt$millisecond()$alias("millisecond")
Expand All @@ -494,12 +506,15 @@ ExprDT_millisecond = function() {
#' @format function
#' @aliases (Expr)$dt$microsecond
#' @examples
#' pl$DataFrame(date = pl$date_range(
#' as.numeric(as.POSIXct("2001-1-1")) * 1E6 + 456789, # manually convert to us
#' as.numeric(as.POSIXct("2001-1-1 00:00:6")) * 1E6,
#' interval = "2s654321us",
#' time_unit = "us" # instruct polars input is us, and store as us
#' ))$with_columns(
#' pl$DataFrame(
#' date = pl$date_range(
#' as.numeric(as.POSIXct("2001-1-1")) * 1E6 + 456789, # manually convert to us
#' as.numeric(as.POSIXct("2001-1-1 00:00:6")) * 1E6,
#' interval = "2s654321us",
#' time_unit = "us", # instruct polars input is us, and store as us
#' lazy = FALSE
#' )
#' )$with_columns(
#' pl$col("date")$cast(pl$Int64)$alias("datetime int64"),
#' pl$col("date")$dt$microsecond()$alias("microsecond")
#' )
Expand All @@ -526,7 +541,8 @@ ExprDT_microsecond = function() {
#' as.numeric(as.POSIXct("2001-1-1")) * 1E9 + 123456789, # manually convert to us
#' as.numeric(as.POSIXct("2001-1-1 00:00:6")) * 1E9,
#' interval = "1s987654321ns",
#' time_unit = "ns" # instruct polars input is us, and store as us
#' time_unit = "ns", # instruct polars input is us, and store as us
#' lazy = FALSE
#' ))$with_columns(
#' pl$col("date")$cast(pl$Int64)$alias("datetime int64"),
#' pl$col("date")$dt$nanosecond()$alias("nanosecond")
Expand Down Expand Up @@ -583,7 +599,12 @@ ExprDT_epoch = function(tu = c("us", "ns", "ms", "s", "d")) {
#' @aliases (Expr)$dt$timestamp
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2001-1-1"), high = as.Date("2001-1-3"), interval = "1d")
#' date = pl$date_range(
#' low = as.Date("2001-1-1"),
#' high = as.Date("2001-1-3"),
#' interval = "1d",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -609,7 +630,12 @@ ExprDT_timestamp = function(tu = c("ns", "us", "ms")) {
#' @aliases (Expr)$dt$with_time_unit
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2001-1-1"), high = as.Date("2001-1-3"), interval = "1d")
#' date = pl$date_range(
#' low = as.Date("2001-1-1"),
#' high = as.Date("2001-1-3"),
#' interval = "1d",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -636,7 +662,12 @@ ExprDT_with_time_unit = function(tu = c("ns", "us", "ms")) {
#' @aliases (Expr)$dt$cast_time_unit
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2001-1-1"), high = as.Date("2001-1-3"), interval = "1d")
#' date = pl$date_range(
#' low = as.Date("2001-1-1"),
#' high = as.Date("2001-1-3"),
#' interval = "1d",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -661,7 +692,12 @@ ExprDT_cast_time_unit = function(tu = c("ns", "us", "ms")) {
#' @aliases (Expr)$dt$convert_time_zone
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2001-3-1"), high = as.Date("2001-5-1"), interval = "1mo")
#' date = pl$date_range(
#' low = as.Date("2001-3-1"),
#' high = as.Date("2001-5-1"),
#' interval = "1mo",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand Down Expand Up @@ -740,7 +776,12 @@ ExprDT_replace_time_zone = function(tz, use_earliest = NULL) {
#' @aliases (Expr)$dt$tz_localize
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2001-3-1"), high = as.Date("2001-7-1"), interval = "1mo")
#' date = pl$date_range(
#' low = as.Date("2001-3-1"),
#' high = as.Date("2001-7-1"),
#' interval = "1mo",
#' lazy = FALSE
#' )
#' )
#' df = df$with_columns(
#' pl$col("date")
Expand Down Expand Up @@ -781,7 +822,12 @@ ExprDT_tz_localize = function(tz) {
#' @aliases (Expr)$dt$days
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2020-3-1"), high = as.Date("2020-5-1"), interval = "1mo")
#' date = pl$date_range(
#' low = as.Date("2020-3-1"),
#' high = as.Date("2020-5-1"),
#' interval = "1mo",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -800,7 +846,12 @@ ExprDT_days = function() {
#' @aliases (Expr)$dt$hours
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2020-1-1"), high = as.Date("2020-1-4"), interval = "1d")
#' date = pl$date_range(
#' low = as.Date("2020-1-1"),
#' high = as.Date("2020-1-4"),
#' interval = "1d",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -819,7 +870,12 @@ ExprDT_hours = function() {
#' @aliases (Expr)$dt$minutes
#' @examples
#' df = pl$DataFrame(
#' date = pl$date_range(low = as.Date("2020-1-1"), high = as.Date("2020-1-4"), interval = "1d")
#' date = pl$date_range(
#' low = as.Date("2020-1-1"),
#' high = as.Date("2020-1-4"),
#' interval = "1d",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("date"),
Expand All @@ -841,7 +897,8 @@ ExprDT_minutes = function() {
#' df = pl$DataFrame(date = pl$date_range(
#' low = as.POSIXct("2020-1-1", tz = "GMT"),
#' high = as.POSIXct("2020-1-1 00:04:00", tz = "GMT"),
#' interval = "1m"
#' interval = "1m",
#' lazy = FALSE
#' ))
#' df$select(
#' pl$col("date"),
Expand All @@ -862,7 +919,8 @@ ExprDT_seconds = function() {
#' df = pl$DataFrame(date = pl$date_range(
#' low = as.POSIXct("2020-1-1", tz = "GMT"),
#' high = as.POSIXct("2020-1-1 00:00:01", tz = "GMT"),
#' interval = "1ms"
#' interval = "1ms",
#' lazy = FALSE
#' ))
#' df$select(
#' pl$col("date"),
Expand All @@ -883,7 +941,8 @@ ExprDT_milliseconds = function() {
#' df = pl$DataFrame(date = pl$date_range(
#' low = as.POSIXct("2020-1-1", tz = "GMT"),
#' high = as.POSIXct("2020-1-1 00:00:01", tz = "GMT"),
#' interval = "1ms"
#' interval = "1ms",
#' lazy = FALSE
#' ))
#' df$select(
#' pl$col("date"),
Expand All @@ -904,7 +963,8 @@ ExprDT_microseconds = function() {
#' df = pl$DataFrame(date = pl$date_range(
#' low = as.POSIXct("2020-1-1", tz = "GMT"),
#' high = as.POSIXct("2020-1-1 00:00:01", tz = "GMT"),
#' interval = "1ms"
#' interval = "1ms",
#' lazy = FALSE
#' ))
#' df$select(
#' pl$col("date"),
Expand Down Expand Up @@ -948,7 +1008,12 @@ ExprDT_nanoseconds = function() {
#' @aliases (Expr)$dt$offset_by
#' @examples
#' df = pl$DataFrame(
#' dates = pl$date_range(as.Date("2000-1-1"), as.Date("2005-1-1"), "1y")
#' dates = pl$date_range(
#' as.Date("2000-1-1"),
#' as.Date("2005-1-1"),
#' "1y",
#' lazy = FALSE
#' )
#' )
#' df$select(
#' pl$col("dates")$dt$offset_by("1y")$alias("date_plus_1y"),
Expand Down
Loading