00001 /* 00002 * ParallelGroupAggregator.hpp 00003 * 00004 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_PARALLEL_GROUP_AGGREGATOR_HPP 00017 #define COH_PARALLEL_GROUP_AGGREGATOR_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/util/aggregator/GroupAggregator.hpp" 00022 #include "coherence/util/InvocableMap.hpp" 00023 00024 COH_OPEN_NAMESPACE3(coherence,util,aggregator) 00025 00026 00027 /** 00028 * The ParallelGroupAggregator provides an ability to split a subset of 00029 * entries in an InvocableMap into a collection of non-intersecting subsets 00030 * and then aggregate them separately and independently. The splitting 00031 * (grouping) is performed using the results of the underlying ValueExtractor 00032 * in such a way that two entries will belong to the same group if and only if 00033 * the result of the corresponding ValueExtractor#extract extract call 00034 * produces the same value or tuple (list of values). After the entries are 00035 * split into the groups, the underlying aggregator is applied separately to 00036 * each group. The result of the aggregation by the GroupAggregator is a Map 00037 * that has distinct values (or tuples) as keys and results of the individual 00038 * aggregation as values. Additionally, those results could be further reduced 00039 * using an optional Filter object. 00040 * 00041 * Informally speaking, this aggregator is analogous to the SQL "group by" and 00042 * "having" clauses. Note that the "having" Filter is applied independently on 00043 * each server against the partial aggregation results; this generally implies 00044 * that data affinity is required to ensure that all required data used to 00045 * generate a given result exists within a single cache partition. 00046 * In other words, the "group by" predicate should not span multiple 00047 * partitions if the "having" clause is used. 00048 * 00049 * The ParallelGroupAggregator is somewhat similar to the DistinctValues 00050 * aggregator, which returns back a list of distinct values (tuples) without 00051 * performing any additional aggregation work. 00052 * 00053 * Unlike many other concrete EntryAggregator implementations that are 00054 * constructed directly, instances of ParallelGroupAggregator should only be 00055 * created indirectly by using the factory method of GroupAggregator. 00056 * 00057 * @deprecated as of Coherence 12.2.1 00058 * 00059 * @author djl 2008.05.16 00060 */ 00061 00062 class COH_EXPORT ParallelGroupAggregator 00063 : public class_spec<ParallelGroupAggregator, 00064 extends<GroupAggregator>, 00065 implements<InvocableMap::ParallelAwareAggregator> > 00066 { 00067 friend class factory<ParallelGroupAggregator>; 00068 00069 // ----- constructors --------------------------------------------------- 00070 00071 protected: 00072 /** 00073 * Default constructor (necessary for the PortableObject 00074 * interface). 00075 */ 00076 ParallelGroupAggregator(); 00077 00078 /** 00079 * Create an instance of GroupAggregator based on a specified 00080 * extractor and anInvocableMap::EntryAggregator 00081 * and a result evaluation filter. 00082 * <br> 00083 * If the specified aggregator is an instance of 00084 * coherence::util::InvocableMap::ParallelAwareAggregator, then a 00085 * parallel-aware instance of the GroupAggregator will be created. 00086 * Otherwise, the resulting GroupAggregator will not be 00087 * parallel-aware and could be ill-suited for aggregations run 00088 * against large partitioned caches. 00089 * 00090 * @param vExtractor a ValueExtractor that will be used to 00091 * split a set of InvocableMap entries into 00092 * distinct 00093 * groups 00094 * @param hAggregator an underlying EntryAggregator 00095 * @param vFilter an optional Filter object used to filter 00096 * out results of individual group 00097 * aggregation results 00098 */ 00099 ParallelGroupAggregator(ValueExtractor::View vExtractor, 00100 InvocableMap::ParallelAwareAggregator::Handle hAggregator, 00101 Filter::View vFilter); 00102 00103 private: 00104 /** 00105 * Blocked copy constructor. 00106 */ 00107 ParallelGroupAggregator(const ParallelGroupAggregator&); 00108 00109 00110 // ----- InvocableMap::ParallelAwareAggregator interface ---------------- 00111 00112 public: 00113 /** 00114 * {@inheritDoc} 00115 */ 00116 virtual InvocableMap::EntryAggregator::Handle 00117 getParallelAggregator(); 00118 00119 /** 00120 * {@inheritDoc} 00121 */ 00122 virtual Object::Holder aggregateResults( 00123 Collection::View vCollResults); 00124 }; 00125 00126 COH_CLOSE_NAMESPACE3 00127 00128 #endif // COH_PARALLEL_GROUP_AGGREGATOR_HPP