Repository: incubator-unomi Updated Branches: refs/heads/feature-optimized-aggregate-query b6c9c7839 -> b2d410ffc
UNOMI-185 use the optimized aggregation when possible Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b2d410ff Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b2d410ff Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b2d410ff Branch: refs/heads/feature-optimized-aggregate-query Commit: b2d410ffcbb18bf15bc3c20647f84db09ab13b1e Parents: b6c9c78 Author: dgaillard <[email protected]> Authored: Wed Jun 27 18:47:12 2018 +0200 Committer: dgaillard <[email protected]> Committed: Wed Jun 27 18:47:12 2018 +0200 ---------------------------------------------------------------------- .../org/apache/unomi/privacy/internal/PrivacyServiceImpl.java | 2 +- .../baseplugin/conditions/PastEventConditionESQueryBuilder.java | 2 +- .../org/apache/unomi/services/services/EventServiceImpl.java | 2 +- .../org/apache/unomi/services/services/GoalsServiceImpl.java | 4 ++-- .../org/apache/unomi/services/services/SegmentServiceImpl.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b2d410ff/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java ---------------------------------------------------------------------- diff --git a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java index d4aad1f..247a7f4 100644 --- a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java +++ b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java @@ -68,7 +68,7 @@ public class PrivacyServiceImpl implements PrivacyService { serverInfo.setServerVersion(bundleContext.getBundle().getVersion().toString()); // let's retrieve all the event types the server has seen. - Map<String, Long> eventTypeCounts = persistenceService.aggregateQuery(null, new TermsAggregate("eventType"), Event.ITEM_TYPE); + Map<String, Long> eventTypeCounts = persistenceService.aggregateWithOptimizedQuery(null, new TermsAggregate("eventType"), Event.ITEM_TYPE); List<EventInfo> eventTypes = new ArrayList<EventInfo>(); for (Map.Entry<String, Long> eventTypeEntry : eventTypeCounts.entrySet()) { EventInfo eventInfo = new EventInfo(); http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b2d410ff/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java ---------------------------------------------------------------------- diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java index 7c6217b..e51aaa8 100644 --- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java +++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PastEventConditionESQueryBuilder.java @@ -75,7 +75,7 @@ public class PastEventConditionESQueryBuilder implements ConditionESQueryBuilder Integer minimumEventCount = condition.getParameter("minimumEventCount") == null ? 0 : (Integer) condition.getParameter("minimumEventCount"); Integer maximumEventCount = condition.getParameter("maximumEventCount") == null ? Integer.MAX_VALUE : (Integer) condition.getParameter("maximumEventCount"); - Map<String, Long> eventCountByProfile = persistenceService.aggregateQuery(andCondition, new TermsAggregate("profileId"), Event.ITEM_TYPE); + Map<String, Long> eventCountByProfile = persistenceService.aggregateWithOptimizedQuery(andCondition, new TermsAggregate("profileId"), Event.ITEM_TYPE); if (eventCountByProfile != null) { for (Map.Entry<String, Long> entry : eventCountByProfile.entrySet()) { if (!entry.getKey().startsWith("_")) { http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b2d410ff/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java ---------------------------------------------------------------------- diff --git a/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java index 54b85e4..5e1ed66 100644 --- a/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java +++ b/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java @@ -195,7 +195,7 @@ public class EventServiceImpl implements EventService { } public Set<String> getEventTypeIds() { - Map<String, Long> dynamicEventTypeIds = persistenceService.aggregateQuery(null, new TermsAggregate("eventType"), Event.ITEM_TYPE); + Map<String, Long> dynamicEventTypeIds = persistenceService.aggregateWithOptimizedQuery(null, new TermsAggregate("eventType"), Event.ITEM_TYPE); Set<String> eventTypeIds = new LinkedHashSet<String>(predefinedEventTypeIds); eventTypeIds.addAll(dynamicEventTypeIds.keySet()); return eventTypeIds; http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b2d410ff/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java ---------------------------------------------------------------------- diff --git a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java index bd7fce5..771e21f 100644 --- a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java +++ b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java @@ -491,11 +491,11 @@ public class GoalsServiceImpl implements GoalsService, SynchronousBundleListener if (aggregate != null) { list.add(goalStartCondition); - all = persistenceService.aggregateQuery(condition, aggregate, Session.ITEM_TYPE); + all = persistenceService.aggregateWithOptimizedQuery(condition, aggregate, Session.ITEM_TYPE); list.remove(goalStartCondition); list.add(goalTargetCondition); - match = persistenceService.aggregateQuery(condition, aggregate, Session.ITEM_TYPE); + match = persistenceService.aggregateWithOptimizedQuery(condition, aggregate, Session.ITEM_TYPE); } else { list.add(goalStartCondition); all = new HashMap<String, Long>(); http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b2d410ff/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java ---------------------------------------------------------------------- diff --git a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java index a3dc984..3d1067b 100644 --- a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java +++ b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java @@ -768,7 +768,7 @@ public class SegmentServiceImpl extends AbstractServiceImpl implements SegmentSe l.add(numberOfDaysCondition); } String propertyKey = (String) parentCondition.getParameter("generatedPropertyKey"); - Map<String, Long> eventCountByProfile = persistenceService.aggregateQuery(andCondition, new TermsAggregate("profileId"), Event.ITEM_TYPE); + Map<String, Long> eventCountByProfile = persistenceService.aggregateWithOptimizedQuery(andCondition, new TermsAggregate("profileId"), Event.ITEM_TYPE); for (Map.Entry<String, Long> entry : eventCountByProfile.entrySet()) { String profileId = entry.getKey(); if (!profileId.startsWith("_")) {
