• Home
  • About
    • Anirban photo
    • About Me
    • Email
  • Blog Posts
    • Writings
    • Tags
  • Skill Set

data.table work diary: Oct 28 - Nov 1

  • Oct 28, ‘24:

1) Tested mutants for fread.c cases and tried to create tests. (7 hours)

// original:
while (ch < eof && thisLine++ < jumpLines) {
// mutant:
while (ch < eof && thisLine-- < jumpLines) {
result <- fread("a,b\n1,2\n3,4\n5,6\n", skip = 2)
stopifnot(nrow(result) == 1, result$a[1] == 5)
// original:
double sd = sqrt((sumLenSq - (sumLen * sumLen) / sampleLines) / (sampleLines - 1));
// mutant:
double sd = sqrt((sumLenSq - (sumLen * sumLen) / sampleLines) / (sampleLines - (1 - 1)));
result <- fread("a\n10\n20\n30\n")$a) - 10)
stopifnot(abs(sd(result$a) - 10) < 1e-5)
// original:
if (*ch != dec && *ch != 'e' && *ch != 'E') goto fail;
// mutant:
if (*ch != dec && *ch != 'e' && *ch <= 'E') goto fail;
result <- fread("col\n1.23e4\n")
stopifnot(ncol(result) == 1, is.numeric(result$col), result$col[1] == 12300)
// original:
while (*ch != '\n' && *ch != '\r' && (*ch != '\0' || ch < eof)) ch++;
// mutant:
while (!(*ch != '\n' && *ch != '\r' && (*ch != '\0' || ch < eof))) ch++;
stopifnot(nrow(fread("a,b\n1,2\r3,4\n5,6\r\n7,8")) == 4)
  • Oct 29, ‘24:

1) Tested mutants for frolladaptive.c and ijoin.c, trying to create tests. (3 hours)

// original:
bool truehasna = hasna > 0;
// mutant:
bool truehasna = hasna > 1;
data <- data.table(x = c(NA, 2, 3, NA, 5))
result <- frollmean(data$x, n = 3, adaptive = TRUE, na.rm = FALSE)
stopifnot(is.na(result[1]), !is.na(result[3]))
// original:
if (k == to[i]) {
// mutant:
if (k > to[i]) {
dt1 <- data.table(id = 1:5)
dt2 <- data.table(id = c(1, 3, 5), value = c("a", "b", "c"))
result <- dt1[dt2, on = .(id)]
stopifnot(nrow(result) == 5, all(result$id %in% 1:5))

2) Sent Uwe a note regarding the updates (as he mentioned collecting features) and pushed the latest version of data.table.threads to CRAN. (2 hours)

  • Oct 30, ‘24:

1) Tried to reproduce the reported issue with branch names not being fully qualified, and made a potential fix. (7 hours) This should work, but I need to test with another GitHub account if the issue even exists first:

- name: Retrieve branch references
  run: |
    if [ -n "${GITHUB_HEAD_REF}" ]; then
      git fetch origin "${GITHUB_HEAD_REF}:${GITHUB_HEAD_REF}" || echo "Failed to fetch branch ${GITHUB_HEAD_REF}"
      git switch "${GITHUB_HEAD_REF}"
    else
      echo "Using default branch as fallback"
      git switch "${GITHUB_BASE_REF}"
    fi
  shell: bash
  • Nov 1, ‘24:

1) Fixed an issue with libgit2 installation (debugged through rounds of trial and error, iteratively made changes to my action, tested on my data.table fork, created an issue and sent a PR). (11 hours)