summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-14 11:15:12 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-14 11:15:12 +0200
commit7b134d8ef30cc3bd6e0867ba3f47452d78d4fce0 (patch)
tree96ef67d3c9998c0f51c289d1e8cfb298b26f0e2f /container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
parent216feb84a135cbcd3e20cdb3240a63fdb53439e3 (diff)
Fix Select and grouping bugs
- Deep copy the grouping structure on query copy. It is mutable but we have neglected doing this right until now. - Fix a bug in the previous commit where the last constructed Query.Model was shared between all instances. - Fix a bug in the previous commit where the query string instead of the query tree was reset when a new select expression is set. - Don't use deprecated method. - Clean up Javadoc and formatting.
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java44
1 files changed, 43 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java b/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
index 1a7074a2c6e..2d830fd214e 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
@@ -1,11 +1,16 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* This is a grouping operation that processes each element of the input list separately, as opposed to {@link
* AllOperation} which processes that list as a whole.
*
* @author Simon Thoresen Hult
+ * @author bratseth
*/
public class EachOperation extends GroupingOperation {
@@ -13,7 +18,44 @@ public class EachOperation extends GroupingOperation {
* Constructs a new instance of this class.
*/
public EachOperation() {
- super("each");
+ super("each", null);
+ }
+
+ private EachOperation(GroupingOperation parentOfCopy,
+ String image,
+ String label,
+ List<GroupingExpression> orderBy,
+ List<GroupingExpression> outputs,
+ List<GroupingOperation> children,
+ Map<String, GroupingExpression> aliases,
+ Set<String> hints,
+ GroupingExpression groupBy,
+ String where,
+ boolean forceSinglePass,
+ double accuracy,
+ int precision,
+ int level,
+ int max) {
+ super(parentOfCopy, image, label, orderBy, outputs, children, aliases, hints, groupBy, where, forceSinglePass, accuracy, precision, level, max);
+ }
+
+ @Override
+ public EachOperation copy(GroupingOperation parentOfCopy) {
+ return new EachOperation(parentOfCopy,
+ getImage(),
+ getLabel(),
+ getOrderBy(),
+ getOutputs(),
+ getChildren(),
+ getAliases(),
+ getHints(),
+ getGroupBy(),
+ getWhere(),
+ getForceSinglePass(),
+ getAccuracy(),
+ getPrecision(),
+ getLevel(),
+ getMax());
}
@Override