-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Allow MetricsControl to aggregate on a column with an expression #5021
Allow MetricsControl to aggregate on a column with an expression #5021
Conversation
@michellethomas do we need to do something like this for druid as well? |
I'm not totally sure if you can use a dimension spec (column expression) within a postagg in druid. When I looked through the druid metrics code I didn't see anywhere we were using DruidColumn expression or dimension_spec properties, so it doesn't look like we are doing this now. But I'm not totally sure. Maybe John or Max know? |
Codecov Report
@@ Coverage Diff @@
## master #5021 +/- ##
=========================================
+ Coverage 77.35% 77.46% +0.1%
=========================================
Files 44 44
Lines 8677 8683 +6
=========================================
+ Hits 6712 6726 +14
+ Misses 1965 1957 -8
Continue to review full report at Codecov.
|
I'm not 100% but I'm pretty sure Druid postaggs have to be made out of metrics. Your PR LGTM, I'd be great to have a unit test that was failing before and succeeding now. For example we could have a new expression in the "births" dataset that would be called |
@mistercrunch I didn't see a lot of tests for this section of the code. Did you have thoughts on where to add tests for this? It looks like I could fit it into viz_tests.TableVizTestCase. |
All examples get executed as integration test, so if you add a new example chart that cover this use case it should fail before your PR, succeed after |
79c2155
to
f1db6f9
Compare
@mistercrunch added tests, thanks for the suggestion! |
LGTM |
Note I believe this only supports one level of indirection, i.e., I'm not certain whether one can create another dimension which leverages |
@mistercrunch what are your thoughts about having metrics reference other metrics, or should metric expressions be valid SQL? |
Valid SQL was always the assumption, for simplicity and clarity. |
…che#5021) * Allow MetricsControl to aggregate on a column with an expression * Adding test case for metrics based on columns
…che#5021) * Allow MetricsControl to aggregate on a column with an expression * Adding test case for metrics based on columns
…che#5021) * Allow MetricsControl to aggregate on a column with an expression * Adding test case for metrics based on columns
In the new MetricsControl, selecting a column with an expression would fail because it's just using the column name which doesn't exist in the underlying table (only in our metadata). This would add the expression (if there is one) inside the aggregation.
@john-bodley @GabeLoins @mistercrunch