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

work around some dbplyr::translate_sql limitations in hof_* #2514

Closed
yitao-li opened this issue May 19, 2020 · 2 comments · Fixed by #2526
Closed

work around some dbplyr::translate_sql limitations in hof_* #2514

yitao-li opened this issue May 19, 2020 · 2 comments · Fixed by #2526
Assignees

Comments

@yitao-li
Copy link
Contributor

would be interesting to see if there is any workaround for the issue in #2513 with accessing struct fields from lambda body (aside from the mutate(dest_col = sql(...)) workaround)

@yitao-li yitao-li self-assigned this May 19, 2020
@mattpollock
Copy link
Contributor

Since periods are allowed in R variable names, why not make it a little more R-specific using the $ operator? In sparklyr.nested I was a bit hand-wavy and allowed x.value or x$value to be used interchangeably in sdf_select.

Something like:

new_frame <- test_frame %>%
   group_by(patients) %>%
   summarise(analyteDates = collect_list(analyteDate),
             valuesList = collect_list(struct(value))) %>%
   hof_transform(dest_col = value, expr = valuesList, x %->% (x$value))

@yitao-li
Copy link
Contributor Author

yitao-li commented May 21, 2020

Update: actually no work around needed -- dbplyr::translate_sql already translates a$b in R to a.b in SQL

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 a pull request may close this issue.

2 participants