fix(generic-chart-axes): apply time filter on all target column types #22238
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.
SUMMARY
When the generic chart axes feature flag is enabled, temporal filters can only be applied on numeric target columns, causing problems for databases such as Druid which stores temporal values in
LONG
format. To fix this, we should short circuit thehandle_single_value
inner function in thefilter_values_handler
of theBaseDatasource
class and return the filter value as-is, as that should always be passed to theget_since_until_from_time_range
in it's original format here.As a follow-up, we should clean up these helper functions and add proper unit tests to them (adding unit tests in the current state of this code is fairly difficult).
AFTER
After this fix, the temporal adhoc filter applies cleanly to a non-temporal column, similarly to how id does when disabling the "GENERIC_CHART_AXES" feature flag:
BEFORE
Currently the chart is unable to render, returning a "Must specify a value for filters with comparison operators" error:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION