-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify date histogram meta and apply interval scaling to all levels
- Loading branch information
Showing
23 changed files
with
143 additions
and
284 deletions.
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
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
35 changes: 35 additions & 0 deletions
35
src/plugins/data/common/search/aggs/utils/get_date_histogram_meta.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,35 @@ | ||
/* | ||
* 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 { DatatableColumn } from 'src/plugins/expressions/common'; | ||
import { TimeRange } from '../../../types'; | ||
import type { AggParamsDateHistogram } from '../buckets'; | ||
import { BUCKET_TYPES } from '../buckets/bucket_agg_types'; | ||
|
||
/** | ||
* Helper function returning the used interval for data table column created by the histogramm agg type. | ||
* "auto" will get expanded to the actually used interval. | ||
* If the column is not a column created by a histogram aggregation of the esaggs data source, | ||
* this function will return undefined. | ||
*/ | ||
export const getDateHistogramMetaDataByDatatableColumn = (column: DatatableColumn) => { | ||
if (column.meta.source !== 'esaggs') return; | ||
if (column.meta.sourceParams?.type !== BUCKET_TYPES.DATE_HISTOGRAM) return; | ||
const params = (column.meta.sourceParams.params as unknown) as AggParamsDateHistogram; | ||
|
||
let interval: string | undefined; | ||
if (params.used_interval && params.used_interval !== 'auto') { | ||
interval = params.used_interval; | ||
} | ||
|
||
return { | ||
interval, | ||
timeZone: params.used_time_zone, | ||
timeRange: column.meta.sourceParams.appliedTimeRange as TimeRange | undefined, | ||
}; | ||
}; |
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
147 changes: 0 additions & 147 deletions
147
src/plugins/data/common/search/aggs/utils/time_column_meta.test.ts
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
src/plugins/data/common/search/aggs/utils/time_column_meta.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.