langcog/childesr

R CMD check failure with dev of dbplyr

Closed this issue · 6 comments

What can I do to help?

Package: childesr
Check: re-building of vignette outputs
New result: WARNING
  Error(s) in re-building vignettes:
    ...
  --- re-building ‘access_childes_db.Rmd’ using rmarkdown
  Quitting from lines 113-115 (access_childes_db.Rmd) 
  Error: processing vignette 'access_childes_db.Rmd' failed with diagnostics:
  could not run statement: Operand should contain 1 column(s)
  --- failed re-building ‘access_childes_db.Rmd’

  SUMMARY: processing the following file failed:
    ‘access_childes_db.Rmd’

  Error: Vignette re-building failed.
  Execution halted

Package: dplyr.teradata
Check: tests
New result: ERROR
    Running ‘testthat.R’ [1s/1s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(dplyr.teradata)
    Loading required package: dplyr

    Attaching package: 'dplyr'

    The following object is masked from 'package:testthat':

        matches

    The following objects are masked from 'package:stats':

        filter, lag

    The following objects are masked from 'package:base':

        intersect, setdiff, setequal, union

    Loading required package: dbplyr

    Attaching package: 'dbplyr'

    The following objects are masked from 'package:dplyr':

        ident, sql

    > 
    > test_check("dplyr.teradata")
    ── 1. Error: custom scalar translated correctly (@test-translate-teradata.R#9)  
    no applicable method for 'sql_translate_env' applied to an object of class "NULL"
    1: expect_equal(trans(case_when(x == 1L ~ 1L, x == 2L ~ 2L, TRUE ~ 3L)), sql("CASE WHEN \"x\" = 1 THEN 1 WHEN \"x\" = 2 THEN 2 ELSE 3 END")) at testthat/test-translate-teradata.R:9
    2: quasi_label(enquo(object), label, arg = "object")
    3: eval_bare(get_expr(quo), get_env(quo))
    4: trans(case_when(x == 1L ~ 1L, x == 2L ~ 2L, TRUE ~ 3L))
    5: translate_sql(!!enquo(x), con = simulate_teradata()) at testthat/test-translate-teradata.R:6
    6: translate_sql_(quos(...), con = con, vars_group = vars_group, vars_order = vars_order, 
           vars_frame = vars_frame, window = window)
    7: lapply(dots, function(x) {
           if (is_null(get_expr(x))) {
               NULL
           }
           else if (is_atomic(get_expr(x))) {
               escape(get_expr(x), con = con)
           }
           else {
               overscope <- sql_overscope(x, variant, con = con, window = window)
               on.exit(overscope_clean(overscope))
               escape(overscope_eval_next(overscope, x), con = con)
           }
       })
    8: FUN(X[[i]], ...)
    9: escape(overscope_eval_next(overscope, x), con = con)
    10: overscope_eval_next(overscope, x)
    11: case_when(x == 1L ~ 1L, x == 2L ~ 2L, TRUE ~ 3L)
    12: translate_sql_(list(f[[2]]))
    13: sql_translate_env(con)

    ══ testthat results  ═══════════════════════════════════════════════════════════
    OK: 0 SKIPPED: 0 WARNINGS: 0 FAILED: 1
    1. Error: custom scalar translated correctly (@test-translate-teradata.R#9) 

    Error: testthat unit tests failed
    Execution halted

Hi, just wanted to say that I'm having what I think is the same error

Error in .local(conn, statement, ...): could not run statement: Operand should contain 1 column(s)

when trying get_tokens and get_contexts, but not get_transcripts. I usually host the db myself so I have the package connect to mine but I get this even when I'm using the hosted version. I have version 0.1.1 so I think it should be up to date.

Also I saw this is happening in your tutorial (http://childes-db.stanford.edu/api.html) in get_contexts.

get_contexts(target_child = "Shem", token = "dog")
#> Using current database version: '2018.1'.
#> Getting data from 1 child in 1 corpus ...
#> Error in .local(conn, statement, ...): could not run statement: Operand should contain 1 column(s)

Hey Sammy, thanks for pointing this out! I fixed the bug in get_contexts(), and am not having an issue running get_tokens(). Is everything working for you now?

I think I figured out why it's breaking- specifying the age. It breaks both get_contexts and get_tokens. What I'll do is just run it on all ages and exclude from there

I did make sure to download the master childesr folder from here and I'm making sure to set that as source (and I checked the get_contexts function that its using and it's the updated one for sure)

gotcha, age filters should be fixed now

amazing! works great thanks so much mika!

great! thanks for the bug reports.

for posterity, these issues were both due to the arguments to filter() calls – for whatever reason, with the new version of dbplyr, calls like filter(column >= x) work fine if x is a variable but not if it's another expression (e.g. ages[1])