Closed
Conversation
Contributor
Author
|
Superseded by #89457 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Quick and dirty exploration of the Lens formula concept
Parts of this PR:
managedReference(should beselfManagedReferencemaybe). It behaves similar to afullReferencein the sense it specifies a list of referenced columns which are tied to it, but it doesn't specify meta data for accepted reference types because it doesn't use the global logic for matching operations and references (as the user specifies them manually and there's no automatic switching). It's a mixture of the existing "none" and "fullReference" operation typessubtract), and recurse into the argsfieldbased operation, create a new column, add it to a global column list, and use the first argument of this function node to look up the field from the index pattern. Then, replace the node in the ast with the name of the column (will be turned into a variable lookup later on)fullReferencebased operation, create a new column, add it to the global column list, then walk the first argument of the function node as a new root. Once it returns, replace the argument node with the name of the created columnExample
The following string
derivative(sum(bytes) + 50) - min(bytes)is turned into the following operations:col:formula, references:col1col1:math, tinymath:subtract(col2,col3)references:col2,col3col2:derivative, references:col4col3:min, field:bytescol4:math, tinymath:add(col5,50)references:col5col5:sum, field:bytesTo turn these columns into an expression, the following is done:
esaggscallThings to look into:
Count- field should be implicitmoving_average(sum(bytes))Notes
The math function is a little annoying because it throws on null . As we need to handle empty buckets all the time I think we need to tweak the behavior a bit to just let the null bubble up
I think we need a new type of operation - I called it "managedReference". It sometimes behaves like a "fullReference" operation, sometimes like a "none" operation
The validation we have already kicks in, but it's a little confusing because it references "hidden" dimensions. I think we can change the validation logic to follow references to the top level metric and report errors on that
Not sure what to do about suggestions - just treat the formula as one existing dimension and everything else just works as it does now? One thing we could do is to split out parts of the formula as separate series (like an xy chart with max(bytes) - min(bytes) suggests an xy chart with two series, max(bytes) and min(bytes) ). We can also do that later
[skip ci]