# Define how to compute the custom time bucketsTIME_GRAIN_ADDON_EXPRESSIONS= {
'postgresql': {
'PT6H': "date_trunc('day', {col}) + date_trunc('hour', {col})::int / 6 * interval '6 h'",
'PT15M': "date_trunc('hour', {col}) + date_part('minute', {col})::int / 15 * interval '15 min'",
},
}
# Register these custom time grainTIME_GRAIN_ADDONS= {
"PT6H": "6 hours",
"PT15M": "15 minutes",
}
My custom time grains are then sorted after the default time grains:
Expected results
I would expect all time grains to be sorted by increasing duration. In the example above:
[…]
minute
15 minutes
hour
6 hours
day
[…]
Actual results
My custom time grains are sorted after any default ones. Their relative order is defined by the by TIME_GRAIN_ADDON_EXPRESSIONS keys' order, and not TIME_GRAIN_ADDONS's ones.
How to reproduce the bug
Define custom time grain in superset_config.py, as above,
Go to Explore / {any Time Series chart}
Click on the Time Grain dropdown menu.
Environment
superset version: superset 1.1.0
Checklist
I have checked the superset logs for python stacktraces and included it here as text if there are any.
I have reproduced the issue with at least the latest released version of superset.
I have checked the issue tracker for the same issue and I haven't found one similar.
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
I have been able to define custom time grains (e.g. 15-minute time buckets — cf. #15037), as per the
config.pyinstructions:My custom time grains are then sorted after the default time grains:
Expected results
I would expect all time grains to be sorted by increasing duration. In the example above:
[…]
[…]
Actual results
My custom time grains are sorted after any default ones. Their relative order is defined by the by
TIME_GRAIN_ADDON_EXPRESSIONSkeys' order, and notTIME_GRAIN_ADDONS's ones.How to reproduce the bug
superset_config.py, as above,Environment
superset 1.1.0Checklist
The text was updated successfully, but these errors were encountered: