mirror of
https://github.com/apache/superset.git
synced 2026-04-21 09:04:38 +00:00
feat(advanced analysis): support MultiIndex column in post processing stage (#19116)
This commit is contained in:
@@ -18,11 +18,14 @@
|
||||
*/
|
||||
import {
|
||||
buildQueryContext,
|
||||
DTTM_ALIAS,
|
||||
PostProcessingResample,
|
||||
QueryFormData,
|
||||
} from '@superset-ui/core';
|
||||
import { rollingWindowOperator } from '@superset-ui/chart-controls';
|
||||
import {
|
||||
flattenOperator,
|
||||
rollingWindowOperator,
|
||||
sortOperator,
|
||||
} from '@superset-ui/chart-controls';
|
||||
|
||||
const TIME_GRAIN_MAP: Record<string, string> = {
|
||||
PT1S: 'S',
|
||||
@@ -47,12 +50,10 @@ const TIME_GRAIN_MAP: Record<string, string> = {
|
||||
|
||||
export default function buildQuery(formData: QueryFormData) {
|
||||
return buildQueryContext(formData, baseQueryObject => {
|
||||
// todo: move into full advanced analysis section here
|
||||
const rollingProc = rollingWindowOperator(formData, baseQueryObject);
|
||||
if (rollingProc) {
|
||||
rollingProc.options = { ...rollingProc.options, is_pivot_df: false };
|
||||
}
|
||||
const { time_grain_sqla } = formData;
|
||||
let resampleProc: PostProcessingResample | undefined;
|
||||
let resampleProc: PostProcessingResample;
|
||||
if (rollingProc && time_grain_sqla) {
|
||||
const rule = TIME_GRAIN_MAP[time_grain_sqla];
|
||||
if (rule) {
|
||||
@@ -62,7 +63,6 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
method: 'asfreq',
|
||||
rule,
|
||||
fill_value: null,
|
||||
time_column: DTTM_ALIAS,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -72,16 +72,10 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
...baseQueryObject,
|
||||
is_timeseries: true,
|
||||
post_processing: [
|
||||
{
|
||||
operation: 'sort',
|
||||
options: {
|
||||
columns: {
|
||||
[DTTM_ALIAS]: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
sortOperator(formData, baseQueryObject),
|
||||
resampleProc,
|
||||
rollingProc,
|
||||
flattenOperator(formData, baseQueryObject),
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user