Repository navigation
feat(advanced analysis): support MultiIndex column in post processing stage - #19116
Conversation
9d36bfb to
04fad0e
Compare
Codecov Report
@@ Coverage Diff @@
## master #19116 +/- ##
==========================================
- Coverage 66.65% 66.64% -0.01%
==========================================
Files 1672 1674 +2
Lines 64611 64602 -9
Branches 6505 6498 -7
==========================================
- Hits 43066 43057 -9
Misses 19862 19862
Partials 1683 1683
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
04fad0e to
f218b89
Compare
74e592d to
8479dc8
Compare
villebro
left a comment
There was a problem hiding this comment.
Really nice refactor! Code LGTM and makes the AA/post processing functionality more uniform. My main concern is the assumption that before we've run the pivot operation, the data is not indexed, but after the pivot operation the df is indexed. This could be slightly confusing for viz developers, as they need to be aware of this. But we can keep iterating on this later (maybe do a big breaking change on the post processing API on 3.0)
There was a problem hiding this comment.
Just a thought (doesn't need to be done here): Should we introduce a separate operation index that sets the index without needing to do a full pivot along with aggregations on the metrics? Then we could perhaps call them set_index and flatten_index or something that clearly communicates that we're specifically changing the index.
There was a problem hiding this comment.
It seems like stack and unstack function in Pandas. I will add those in future.
|
/testenv up |
|
@jinghua-qa Ephemeral environment spinning up at http://18.237.75.154:8080. Credentials are |
jinghua-qa
left a comment
There was a problem hiding this comment.
Thank you for the detail test steps~ LGTM
8479dc8 to
b7bc340
Compare
I'm thinking that the |
|
Ephemeral environment shutdown and build artifacts deleted. |
Summary
Superset uses Pandas Dataframe for query results processing. Now, these Dataframe between different Operators only support 1-dimensional Dataframe. This has caused confusion in some calculations. This PR introduces MultiIndex Dataframe for Operators. This is useful for simplifying calculations.
Current PostProcessing
Typical PostProcessing Operators are used in time-series charts for getting queries. e.g.:
We face these challenges for existing designs:
rollingWindowOperatorshould beforetimeCompareOperator.resample.py. We need to "flat" multidimensional Dataframe to adapt this one.After Changed
The new operators support calculate on multidimensional Dataframe. So, operators in
QueryObjectcan change its position at will. eg:For example, The
compare()operator supports the Dataframe shape like the following:adding new operator
flat.py, this new operator will transform the multidimensional dataframe to flatten dataframe.The full examples:
TESTING INSTRUCTIONS
Let's use a new dataset to test.
DailyDelhiClimateTrain.csvto your local.DailyDelhiClimateTraininto Superseta) click
upload CSV to databaseon top blue plus sign of Supersetb) fill in
DailyDelhiClimateTrainontable namec) select
DailyDelhiClimateTrain.csvd) fill in
dateinParse Dateslinee) click Save
DailyDelhiClimateTraindatasetLine Chart, notice that you should pick up echart versiondateinX-Axismeantempinmetricsand selectmaxfor aggregatedayas time grainularity1 year agoandactual valuesrolling windowand validate dataDaily PCT with cumsum

Monthly comparison with quarter sum rolling

ADDITIONAL INFORMATION