-
Notifications
You must be signed in to change notification settings - Fork 913
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
[Vis Builder] Add metric to metric, bucket to bucket aggregation persistence #3495
[Vis Builder] Add metric to metric, bucket to bucket aggregation persistence #3495
Conversation
d239f2d
to
2fdfbdf
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #3495 +/- ##
==========================================
- Coverage 66.45% 66.45% -0.01%
==========================================
Files 3205 3206 +1
Lines 61562 61596 +34
Branches 9497 9503 +6
==========================================
+ Hits 40914 40936 +22
- Misses 18377 18387 +10
- Partials 2271 2273 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
src/plugins/vis_builder/public/application/components/right_nav.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/state_management/visualization_slice.ts
Outdated
Show resolved
Hide resolved
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.
Love how surgical and clean the implementation is.
src/plugins/vis_builder/public/application/utils/state_management/shared_actions.ts
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/components/right_nav.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.ts
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.ts
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.ts
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.ts
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.ts
Outdated
Show resolved
Hide resolved
a0a3e6b
to
67feda9
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.
These tests are in the right direction but not exactly what i was looking for. The reason i wanted the unit tests was to ensure that the logic you described in the parent issue works as expected, and if that changes, these tests should catch it. I dont see a test here that validates that logic. There are just 3 tests here that i am really looking for:
- A test for
usePersistedAggParams
that given a list of appParams, an old and new vis type can successfully map the params to the new type. - A test to show how the hook would drop values if it did not find a way to map the params successfully. e.g. goes over the max count
- Any edge cases that we need to cover. e.g. no schema
The rest of the functions dont really need tests since they are helper functions that help the hook function as expected.
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/vis_builder/public/application/utils/use/use_persisted_agg_params.test.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
42a7684
to
1d32f58
Compare
@ashwin-pc Rewrote the unit test to test the parent function as a whole under different scenarios. |
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.
Love the new tests and the feature!
}; | ||
}); | ||
|
||
test('return the correct metric-to-metric, bucket-to-bucket mapping and correct persisted aggregations', () => { |
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.
Nice test!
`); | ||
}); | ||
|
||
test('aggregations with undefined schema remain undefined; schema will be set to undefined if aggregations that exceeds the max amount', () => { |
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.
Nice combining two tests in one
…istence (#3495) * Add metric to metric, bucket to bucket aggregation persistance Signed-off-by: abbyhu2000 <[email protected]> * Add logics to avoid exceeding the max count for each schema field Signed-off-by: abbyhu2000 <[email protected]> * Add changelog entry Signed-off-by: abbyhu2000 <[email protected]> * addressing comments Signed-off-by: abbyhu2000 <[email protected]> * Add unit tests for functions in use_persisted_agg_params Signed-off-by: abbyhu2000 <[email protected]> * rewrite unit tests to test the entire functionality Signed-off-by: abbyhu2000 <[email protected]> --------- Signed-off-by: abbyhu2000 <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> (cherry picked from commit 525b033) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…istence (opensearch-project#3495) * Add metric to metric, bucket to bucket aggregation persistance Signed-off-by: abbyhu2000 <[email protected]> * Add logics to avoid exceeding the max count for each schema field Signed-off-by: abbyhu2000 <[email protected]> * Add changelog entry Signed-off-by: abbyhu2000 <[email protected]> * addressing comments Signed-off-by: abbyhu2000 <[email protected]> * Add unit tests for functions in use_persisted_agg_params Signed-off-by: abbyhu2000 <[email protected]> * rewrite unit tests to test the entire functionality Signed-off-by: abbyhu2000 <[email protected]> --------- Signed-off-by: abbyhu2000 <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Signed-off-by: David Sinclair <[email protected]>
…istence (opensearch-project#3495) * Add metric to metric, bucket to bucket aggregation persistance Signed-off-by: abbyhu2000 <[email protected]> * Add logics to avoid exceeding the max count for each schema field Signed-off-by: abbyhu2000 <[email protected]> * Add changelog entry Signed-off-by: abbyhu2000 <[email protected]> * addressing comments Signed-off-by: abbyhu2000 <[email protected]> * Add unit tests for functions in use_persisted_agg_params Signed-off-by: abbyhu2000 <[email protected]> * rewrite unit tests to test the entire functionality Signed-off-by: abbyhu2000 <[email protected]> --------- Signed-off-by: abbyhu2000 <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Signed-off-by: David Sinclair <[email protected]>
Description
This PR implements the aggregation persistence feature in Vis Builder when switching vis type.
Detailed research doc can be found here: #2900
The proposal, mapping rules and examples can be found here: #3482
Issues Resolved
#3482
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr