Add the filesize parameter to estimate a better partition number for ExternalHashGroupby
Change-Id: I3aadec904af64cc2b7b03e6dff399a2288c21a7b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/451
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
index bfd1a70..1ba5702 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
@@ -21,9 +21,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
-
import org.apache.asterix.algebra.operators.physical.BTreeSearchPOperator;
import org.apache.asterix.algebra.operators.physical.InvertedIndexPOperator;
import org.apache.asterix.algebra.operators.physical.RTreeSearchPOperator;
@@ -33,6 +30,8 @@
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.optimizer.rules.am.AccessMethodJobGenParams;
import org.apache.asterix.optimizer.rules.am.BTreeJobGenParams;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -148,7 +147,9 @@
ExternalGroupByPOperator externalGby = new ExternalGroupByPOperator(
gby.getGroupByList(),
physicalOptimizationConfig.getMaxFramesExternalGroupBy(),
- physicalOptimizationConfig.getExternalGroupByTableSize());
+ physicalOptimizationConfig.getExternalGroupByTableSize(),
+ (long) physicalOptimizationConfig.getMaxFramesExternalGroupBy()
+ * physicalOptimizationConfig.getFrameSize());
generateMergeAggregationExpressions(gby, context);
op.setPhysicalOperator(externalGby);
setToExternalGby = true;
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java b/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
index 438617f..79dd63c 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/base/ARecord.java
@@ -88,13 +88,15 @@
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ARecord: { ");
- for (int i = 0; i < fields.length; i++) {
- if (i > 0) {
- sb.append(", ");
+ if (fields != null) {
+ for (int i = 0; i < fields.length; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(type.getFieldNames()[i]);
+ sb.append(": ");
+ sb.append(fields[i]);
}
- sb.append(type.getFieldNames()[i]);
- sb.append(": ");
- sb.append(fields[i]);
}
sb.append(" }");
return sb.toString();