Feature/custom layer operation support #41
Closed
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.
Hi, thanks for nice library, it is really useful!
Although it probably wasn't original purpose of this library, we needed in our project to calculate and check asymptotic complexity of queries.
This can be done by multiplying instead of adding complexities on each level in query tree.
So field that has complexity of n can be set estimator like this:
-> So if childComplexity is also n, asymptotic complexity is n^2
Problem is that there is addition inside of
addComplexities
function-> Fields on same level are added up.
So to solve this, I added
layerTransformation: LayerTransformation
optional option togetComplexity
function to customize this behavior.To calculate asymptotic complexity you can just pass your own transformation function:
And to calculate asymptotic complexity on each query: