Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Mar 17, 2022
1 parent aa391bf commit 6e357c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/aggregation/agg_req.rs
Expand Up @@ -61,12 +61,12 @@ pub type Aggregations = HashMap<String, Aggregation>;

/// Like Aggregations, but optimized to work with the aggregation result
#[derive(Clone, Debug)]
pub(crate) struct CollectorAggregations {
pub(crate) struct AggregationsInternal {
pub(crate) metrics: VecWithNames<MetricAggregation>,
pub(crate) buckets: VecWithNames<CollectorBucketAggregation>,
}

impl From<Aggregations> for CollectorAggregations {
impl From<Aggregations> for AggregationsInternal {
fn from(aggs: Aggregations) -> Self {
let mut metrics = vec![];
let mut buckets = vec![];
Expand Down Expand Up @@ -95,7 +95,7 @@ pub(crate) struct CollectorBucketAggregation {
pub bucket_agg: BucketAggregationType,
/// The sub_aggregations in the buckets. Each bucket will aggregate on the document set in the
/// bucket.
pub sub_aggregation: CollectorAggregations,
pub sub_aggregation: AggregationsInternal,
}

impl CollectorBucketAggregation {
Expand Down
8 changes: 4 additions & 4 deletions src/aggregation/agg_result.rs
Expand Up @@ -10,7 +10,7 @@ use std::collections::HashMap;
use itertools::Itertools;
use serde::{Deserialize, Serialize};

use super::agg_req::{Aggregations, CollectorAggregations, CollectorBucketAggregation};
use super::agg_req::{Aggregations, AggregationsInternal, CollectorBucketAggregation};
use super::bucket::intermediate_buckets_to_final_buckets;
use super::intermediate_agg_result::{
IntermediateAggregationResults, IntermediateBucketResult, IntermediateHistogramBucketEntry,
Expand All @@ -37,7 +37,7 @@ impl AggregationResults {
/// for internal processing
fn from_intermediate_and_req_internal(
results: IntermediateAggregationResults,
req: &CollectorAggregations,
req: &AggregationsInternal,
) -> Self {
let mut result = HashMap::default();

Expand Down Expand Up @@ -217,7 +217,7 @@ pub struct BucketEntry {
impl BucketEntry {
pub(crate) fn from_intermediate_and_req(
entry: IntermediateHistogramBucketEntry,
req: &CollectorAggregations,
req: &AggregationsInternal,
) -> Self {
BucketEntry {
key: Key::F64(entry.key),
Expand Down Expand Up @@ -280,7 +280,7 @@ pub struct RangeBucketEntry {
impl RangeBucketEntry {
fn from_intermediate_and_req(
entry: IntermediateRangeBucketEntry,
req: &CollectorAggregations,
req: &AggregationsInternal,
) -> Self {
RangeBucketEntry {
key: entry.key,
Expand Down
6 changes: 3 additions & 3 deletions src/aggregation/bucket/histogram/histogram.rs
Expand Up @@ -4,7 +4,7 @@ use std::fmt::Display;
use itertools::Itertools;
use serde::{Deserialize, Serialize};

use crate::aggregation::agg_req::CollectorAggregations;
use crate::aggregation::agg_req::AggregationsInternal;
use crate::aggregation::agg_req_with_accessor::{
AggregationsWithAccessor, BucketAggregationWithAccessor,
};
Expand Down Expand Up @@ -389,7 +389,7 @@ fn get_bucket_val(val: f64, interval: f64, offset: f64) -> f64 {
fn intermediate_buckets_to_final_buckets_fill_gaps(
buckets: Vec<IntermediateHistogramBucketEntry>,
histogram_req: &HistogramAggregation,
sub_aggregation: &CollectorAggregations,
sub_aggregation: &AggregationsInternal,
) -> Vec<BucketEntry> {
// Generate the the full list of buckets without gaps.
//
Expand Down Expand Up @@ -440,7 +440,7 @@ fn intermediate_buckets_to_final_buckets_fill_gaps(
pub(crate) fn intermediate_buckets_to_final_buckets(
buckets: Vec<IntermediateHistogramBucketEntry>,
histogram_req: &HistogramAggregation,
sub_aggregation: &CollectorAggregations,
sub_aggregation: &AggregationsInternal,
) -> Vec<BucketEntry> {
if histogram_req.min_doc_count() == 0 {
// With min_doc_count != 0, we may need to add buckets, so that there are no
Expand Down
4 changes: 2 additions & 2 deletions src/aggregation/intermediate_agg_result.rs
Expand Up @@ -8,7 +8,7 @@ use fnv::FnvHashMap;
use itertools::Itertools;
use serde::{Deserialize, Serialize};

use super::agg_req::{BucketAggregationType, CollectorAggregations, MetricAggregation};
use super::agg_req::{AggregationsInternal, BucketAggregationType, MetricAggregation};
use super::metric::{IntermediateAverage, IntermediateStats};
use super::segment_agg_result::{
SegmentAggregationResultsCollector, SegmentBucketResultCollector, SegmentHistogramBucketEntry,
Expand All @@ -34,7 +34,7 @@ impl From<SegmentAggregationResultsCollector> for IntermediateAggregationResults
}

impl IntermediateAggregationResults {
pub(crate) fn empty_from_req(req: &CollectorAggregations) -> Self {
pub(crate) fn empty_from_req(req: &AggregationsInternal) -> Self {
let metrics = if req.metrics.is_empty() {
None
} else {
Expand Down

0 comments on commit 6e357c8

Please sign in to comment.