-
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
[adhoc-filters] Adding adhoc-filters to all viz types #5206
[adhoc-filters] Adding adhoc-filters to all viz types #5206
Conversation
a086903
to
1561cfb
Compare
@@ -881,4 +881,3 @@ def split_adhoc_filters_into_base_filters(fd): | |||
fd['having'] = ' AND '.join(['({})'.format(sql) for sql in sql_having_filters]) | |||
fd['having_filters'] = simple_having_filters | |||
fd['filters'] = simple_where_filters | |||
del fd['adhoc_filters'] |
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.
Note we can no longer remove the adhoc_filters
field as we need to ensure that ad-hoc filters persist. Currently (for right or wrong) by deleting this field the ad-hoc filters actually get rebuilt on the frontend by merging the legacy and ad-hoc filters.
181805b
to
99e2832
Compare
5879d10
to
1a54eb4
Compare
1a54eb4
to
c288ed0
Compare
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.
Looks good from my end! Thank you john for making this improvement!
@@ -1683,18 +1683,6 @@ | |||
"renderTrigger": true, | |||
"default": "" | |||
}, | |||
"where": { |
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 haven't touched this file before- what is it doing exactly?
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.
That represents the old TextControl where people would write their WHERE clause. Did we even run a db migration to convert the old filters (where & having) to new ones?
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.
Oh I see it's in this PR !
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.
@mistercrunch I'm hoping to clean up the backend later this week so we can remove all references to the old where, having clauses entirely.
@@ -68,49 +59,6 @@ describe('AdhocFilterControl', () => { | |||
expect(wrapper.find(OnPasteSelect)).to.have.lengthOf(1); | |||
}); | |||
|
|||
it('will translate legacy filters into adhoc filters if no adhoc filters are present', () => { |
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.
bye specs!
@@ -56,13 +60,15 @@ export default class AlteredSliceTag extends React.Component { | |||
return 'N/A'; | |||
} else if (value === null) { | |||
return 'null'; | |||
} else if (controls[key] && controls[key].type === 'FilterControl') { | |||
} else if (controls[key] && controls[key].type === 'AdhocFilterControl') { |
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.
was this line necessary before? Should I have already made this change or was it only necessary once we removed the legacy filters?
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.
@GabeLoins I don't believe ad-hoc filters show up in the altered view. It merely worked if you did Run Query
then these filters would be converted to the historical filters, clauses etc. and thus show in the the Altered slice view.
With this change the Altered slice view correctly represents the current UI state.
This reverts commit d483ed1.
#5253) * Revert "[sqllab] Fix sql lab resolution link (#5216)" This reverts commit 93cdf60. * Revert "Pin botocore version (#5184)" This reverts commit 70679d4. * Revert "Describe the use of custom OAuth2 authorization servers (#5220)" This reverts commit a84f430. * Revert "[bubble-chart] Fixing issue w/ metric names (#5237)" This reverts commit 5c106b9. * Revert "[adhoc-filters] Adding adhoc-filters to all viz types (#5206)" This reverts commit d483ed1. * Revert "[perf] add webpack 4 + SplitChunks + lazy load visualizations (#5240)" This reverts commit 1fc4ee0.
apache#5253) * Revert "[sqllab] Fix sql lab resolution link (apache#5216)" This reverts commit 93cdf60. * Revert "Pin botocore version (apache#5184)" This reverts commit 70679d4. * Revert "Describe the use of custom OAuth2 authorization servers (apache#5220)" This reverts commit a84f430. * Revert "[bubble-chart] Fixing issue w/ metric names (apache#5237)" This reverts commit 5c106b9. * Revert "[adhoc-filters] Adding adhoc-filters to all viz types (apache#5206)" This reverts commit d483ed1. * Revert "[perf] add webpack 4 + SplitChunks + lazy load visualizations (apache#5240)" This reverts commit 1fc4ee0. (cherry picked from commit 62427c8)
apache#5253) * Revert "[sqllab] Fix sql lab resolution link (apache#5216)" This reverts commit 93cdf60. * Revert "Pin botocore version (apache#5184)" This reverts commit 70679d4. * Revert "Describe the use of custom OAuth2 authorization servers (apache#5220)" This reverts commit a84f430. * Revert "[bubble-chart] Fixing issue w/ metric names (apache#5237)" This reverts commit 5c106b9. * Revert "[adhoc-filters] Adding adhoc-filters to all viz types (apache#5206)" This reverts commit d483ed1. * Revert "[perf] add webpack 4 + SplitChunks + lazy load visualizations (apache#5240)" This reverts commit 1fc4ee0.
(cherry picked from commit d483ed1)
apache#5253) * Revert "[sqllab] Fix sql lab resolution link (apache#5216)" This reverts commit 93cdf60. * Revert "Pin botocore version (apache#5184)" This reverts commit 70679d4. * Revert "Describe the use of custom OAuth2 authorization servers (apache#5220)" This reverts commit a84f430. * Revert "[bubble-chart] Fixing issue w/ metric names (apache#5237)" This reverts commit 5c106b9. * Revert "[adhoc-filters] Adding adhoc-filters to all viz types (apache#5206)" This reverts commit d483ed1. * Revert "[perf] add webpack 4 + SplitChunks + lazy load visualizations (apache#5240)" This reverts commit 1fc4ee0.
So this PR came about because I was working on another feature which required a database migration to update SQL filters when I realized that I needed to update multiple form-data fields, specifically the following fields exist around filters:
Hence the purpose of this PR is to condense the number of form-data fields and simplify filter logic by rolling out ad-hoc filters for all visualization types.
Note I sense it's worthwhile to first outline how the current situation works. On the front-end the ad-hoc filters take the legacy
filters
,having
,having_filters
, andwhere
fields which are then merged withadhoc_filters
. Theadhoc_filters
persist in the URL form-data (and when the slice is saved) though are transformed (and removed) back into the legacy filters in the backend. This means that all five filters types can actually persist in the form-data.This PR is the first of a two-phase change (to help minimize code change). This change is mostly a front-end change, i.e., it applies ad-hoc filters to all visualization types and performs a database migration to upgrade the filters (as opposed to doing this in the frontend). Note the backend still transforms the ad-hoc filters to legacy filters (though the
adhhoc_filters
field persists). Although this represents a duplication of data the ad-hoc filters are the source of truth throughout, i.e., the legacy filters are always derived from the ad-hoc filters. Note this change ensures that old URLs with legacy filters will still work.For phase II the plan is to clean up the backend and deprecate the legacy filters. It will ensure URLs with legacy filters will continue to work.
Finally the ad-hoc filters include a unique ID which is required for the frontend which gets persisted to the database. There may be merit in removing this in the future.
Closes #5172.
to: @betodealmeida @GabeLoins @michellethomas @mistercrunch @williaster