Skip to content

Additional time-travel support#197

Merged
eddelbuettel merged 4 commits intomasterfrom
de/open_at
Dec 31, 2020
Merged

Additional time-travel support#197
eddelbuettel merged 4 commits intomasterfrom
de/open_at

Conversation

@eddelbuettel
Copy link
Contributor

This PR adds high-level support for timestamps at the tiledb_array level. A simple illustration is included as well (and the basis of added unit tests): we open an array, write three rows at a recording timestamp, sleep a little and write three more rows. The expected reads before first, after first, before second and after second time stamp are the expected 0, 3, 3, and 6 rows.

$ Rscript inst/examples/quickstart_sparse_timetravel.R
Array already exists, removing to create new one.
Writing first record at 2020-12-28 17:35:05.074403 
(...sleeping 1s ...)
Writing second record at 2020-12-28 17:35:06.104814 

Reading everything:
  rows cols  a
1    1    1  1
2    2    3  3
3    2    4  2
4    6    7 22
5    8    5 11
6    9    8 33

Opening / reading 0.5s before first tstamp
[1] rows cols a   
<0 rows> (or 0-length row.names)
Opening / reading 0.5s after first tstamp
  rows cols a
1    1    1 1
2    2    3 3
3    2    4 2
Opening / reading 0.5s before second tstamp
  rows cols a
1    1    1 1
2    2    3 3
3    2    4 2
Opening / reading 0.5s after second tstamp
  rows cols  a
1    1    1  1
2    2    3  3
3    2    4  2
4    6    7 22
5    8    5 11
6    9    8 33
$ 

Copy link
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments but LGTM!

R/TileDBArray.R Outdated
#' @slot query_layout An optional character value
#' @slot datetimes_as_int64 A logical value
#' @slot encryption_key A character value
#' @slot timestamp A POSIXct datimetime variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: datimetime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we all sing now :"dah dah dah dahdatime".

Nice catch -- fixed.

R/TileDBArray.R Outdated
#' \code{POSIXct} or \code{nanotime} objects.
#' @param encryption_key optional A character value with an AES-256 encryption key
#' in case the array was written with encryption.
#' @param timestamp optional A Datetime value determining where in time the array is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention it must be POSIXct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done too -- both fixes in b714f92

@eddelbuettel eddelbuettel merged commit 1a33b6c into master Dec 31, 2020
@eddelbuettel eddelbuettel deleted the de/open_at branch December 31, 2020 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants