refactor: get_SDA_property(method="weighted average")
#432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request significantly refactors the SQL query generation logic in the
.property_weighted_average_CTEfunction withinR/get_SDA_property.R. Reduces repetition and total number of steps which were carried over from the old temporary table approach.Closes #431 which noted a regression in ability to query larger numbers of specific mapunits via
mukeysargument. On deeper investigation, this seemed to be primarily related to repetition of complex WHERE clause constraints where IN statements contained many thousants of values, but there were several other opportunities for improvement.With these changes we can comparatively efficiently query larger sets. Of course extremely large numbers of MUKEY will still be an issue and trigger "invalid query" response from server (as shown below), it should be quite a bit more rare.
Example (10000 mapunits, 3 properties):