-
Notifications
You must be signed in to change notification settings - Fork 22
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
Feature/subquery #794
Feature/subquery #794
Conversation
Will be used for subqueries that can pipe in async chan of solution
(format-value [fmt db iri-cache context compact fuel-tracker error-ch solution] | ||
"Formats a where search solution (map of pattern matches) by extracting and displaying relevant pattern matches.")) | ||
"Async format a search solution (map of pattern matches) by extracting relevant match.") | ||
(solution-value [fmt error-ch solution] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should be in a new subquery specific protocol because the solution-value method doesn't apply in all the cases where ValueSelector should be defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started this change, but both format-value
and solution-value
are tied to implicit-grouping?
. So either solution-value
needs to rely on the other protocol. At that point it seems they should be part of the same protocol.
Do you still want them separated out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I have had reservations about the addition of implicit-grouping?
as a protocol method, and especially as a method on this protocol since it was introduced because whether or not something is grouped implicitly is outside the scope of selecting values.
I think the best thing would be to go back to the way it was before and just add the other aggregate selector types to that function as necessary. That would eliminate problems like this and result in more flexibility.
I think that's probably beyond the scope of this particular pr so I might just make that change along with the changes I suggested here in a separate cleanup branch at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't plan to resolve this here - I don't think it is specific to the subquery functionality and can sit as a separate change. We are also still doing some query work, so opinions on ideal solution might change.
# Conflicts: # src/clj/fluree/db/query/fql/parse.cljc # src/clj/fluree/db/query/fql/syntax.cljc # src/clj/fluree/db/validation.cljc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌞
Adds new subquery capability. Supports multiple parallel subqueries, or nested subqueries.
A new
solution-value
interface is for select statements to pass formatted solutions for :select clauses instead of final projections as a normal select clause does.e.g. in EDN - this has a subquery that calculates the average of all favNums, then in the parent query filters to only include users who have a favNum > than the average:
Tests/examples in:
fluree.db.query.subquery-test