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

Issue with covertToCyclopsData - ORDER By is Ignored in sub queries #52

Closed
azimov opened this issue Jul 14, 2021 · 3 comments
Closed

Issue with covertToCyclopsData - ORDER By is Ignored in sub queries #52

azimov opened this issue Jul 14, 2021 · 3 comments
Assignees

Comments

@azimov
Copy link

azimov commented Jul 14, 2021

In CohortMethod when calling fitOutcomeModel the following warning is thrown:

ORDER BY is ignored in subqueries without LIMIT
ℹ Do you need to move arrange() later in the pipeline or use window_order() instead?
Backtrace:
  1. CohortMethod::runCmAnalyses(...) test-eunomia.R:116:2
  2. ParallelLogger::clusterApply(cluster, modelsToFit, doFitOutcomeModelPlus) /Users/jamie/PycharmProjects/CohortMethod/R/RunAnalyses.R:426:6
  3. base::lapply(x, fun, ...)
  4. CohortMethod:::FUN(X[[i]], ...)
  6. CohortMethod::fitOutcomeModel(...)
  8. Cyclops:::convertToCyclopsData.tbl_dbi(...)
  9. Andromeda::batchApply(covariates, loadCovariates, batchSize = 1e+05)
 11. dbplyr:::sql_render.tbl_lazy(tbl, connection)
 13. dbplyr:::sql_render.op(query$ops, con = con, ..., subquery = subquery)
 15. dbplyr:::sql_render.select_query(qry, con = con, ..., subquery = subquery)
 24. dbplyr:::sql_render.join_query(query$from, con, ..., subquery = TRUE)
 33. dbplyr:::sql_render.tbl_lazy(query$y, con, ..., subquery = TRUE)
 35. dbplyr:::sql_render.op(query$ops, con = con, ..., subquery = subquery)
 37. dbplyr:::sql_render.select_query(qry, con = con, ..., subquery = subquery)
 38. dbplyr:::dbplyr_query_select(...)
 39. dbplyr:::dbplyr_fallback(con, "sql_select", ...)
 41. dbplyr:::sql_select.DBIConnection(con, ...)
 43. dbplyr:::sql_query_select.DBIConnection(...)
 45. dbplyr:::sql_clause_order_by(con, order_by, subquery, limit)
 46. dbplyr:::warn_drop_order_by()

This appears to be a problem with how cyclops is calling Andromeda. Reproducible in the unit tests found here

@msuchard
Copy link
Member

@schuemie and I were just discussing this here: OHDSI/Andromeda#25

  1. this warning behavior is relatively new (i.e., I have not seen this warning before today, although I have not looked in several months)
  2. am not sure if this really is an issue or not
  3. i could definitely use some help in tracking down the issue

@schuemie
Copy link
Member

Found it. Under specific conditions outcomes is being sorted here, and then joined to covariates here, at which time the sorting is lost (in the join, not in the outcomes object). This has no effect on the final result, but the warning is annoying. It can be fixed by joining before applying the sort on outcomes.

@msuchard
Copy link
Member

Great work, @schuemie !

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

No branches or pull requests

3 participants