Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Remove previous lookup table on write #101

@reinholdsson

Description

@reinholdsson

When we overwrite an old variable, we need to make sure that there's no lookup table left over, for example when going from character to integer. We could remove the variable completely (clean), however, we need to figure out what to do when one only tries to replace one out of many dimensions (since the other dimensions still needs the lookup table). If we can't figure out any solution - we should probably not allow lookup tables for integer variables (which was implemented in #89).

library(Coldbir)
a_tmp <- tempfile()

N <- 1000
fun <- function(x) paste(sample(LETTERS, 10), collapse = "")
x <- sapply(1:N, fun)

a <- cdb(a_tmp)

# Write
a["x"] <- x

# Read
head(a["x"])
#1: UIQZDWPXVN
#2: NCDAOGRZVU
#3: FLJUSKEGQZ
#4: ICGHYQJPES
#5: BVAWNUEYOM
#6: OIYHZCBDUT

x <- sample(1:1000, N, replace = T)
# Write
a["x"] <- x

# Read
head(a["x"])
#1: CAMNKYOZWS
#2: ANZBRTDGSM
#3: QBKODRSJHG
#4: QERBLKIOTV
#5: HRFUQMIEWT
#6: NXATGZSIOU

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions