-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Supports percentile_ranks aggregation #132430
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
061f71a
[Lens] Supports percentile_ranks aggregation
stratoula ea28b8c
Fix type
stratoula 4ccdccb
Fix some types and the filter by problem
stratoula 23b9daa
Merge branch 'main' into lens-percentile-rank
stratoula 24b49bd
Enable navigation from TSVB to Lens
stratoula 466a631
Add unit tests, fix terms with filter
stratoula edae37c
Merge branch 'main' into lens-percentile-rank
stratoula 215026a
Merge branch 'main' into lens-percentile-rank
stratoula 0f1592f
Merge branch 'main' into lens-percentile-rank
stratoula 58e7867
Merge branch 'main' into lens-percentile-rank
stratoula 95f0a45
Change the implementation to use singleRercentileRank agg config
stratoula 363c14f
Not allows sorting by column for non integer values
stratoula b53a1da
Remove console.log
stratoula 5c4edee
Fix jest test
stratoula 3801f2c
Merge branch 'main' into lens-percentile-rank
stratoula a4514c9
Merge branch 'main' into lens-percentile-rank
stratoula beccdf9
Remove leftover comment
stratoula ae72f81
Apply PR comment
stratoula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/plugins/data/common/search/aggs/metrics/percentiles_get_value.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import { getPercentileValue } from './percentiles_get_value'; | ||
import type { IResponseAggConfig } from './lib/get_response_agg_config_class'; | ||
|
||
describe('getPercentileValue', () => { | ||
test('should return the correct value for an IResponseAggConfig', () => { | ||
const agg = { | ||
id: '0.400', | ||
key: 400, | ||
parentId: '0', | ||
} as IResponseAggConfig; | ||
const bucket = { | ||
'0': { | ||
values: [ | ||
{ | ||
key: 400, | ||
value: 24.21909648206358, | ||
}, | ||
], | ||
}, | ||
doc_count: 2356, | ||
}; | ||
const value = getPercentileValue(agg, bucket); | ||
expect(value).toEqual(24.21909648206358); | ||
}); | ||
|
||
test('should return the correct value for an TAggConfig', () => { | ||
const agg = { | ||
id: '0-metric', | ||
enabled: true, | ||
type: 'percentile_ranks', | ||
params: { | ||
field: 'AvgTicketPrice', | ||
values: [400], | ||
}, | ||
schema: 'metric', | ||
} as unknown as IResponseAggConfig; | ||
const bucket = { | ||
doc_count: 290, | ||
'0-metric': { | ||
values: [ | ||
{ | ||
key: 400, | ||
value: 25.84782692356769, | ||
}, | ||
], | ||
}, | ||
}; | ||
const value = getPercentileValue(agg, bucket); | ||
expect(value).toEqual(25.84782692356769); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
ℹ️ This test is testing the scenario that a metric agg is not supported in Lens. As we support now the
percentile_rank
I changed it tostd_deviation
that is not supported