added a fix for issue 511
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
index 95aba92..8599913 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
@@ -85,6 +85,17 @@
throw new AlgebricksException("Unexpected type " + typeTag + " in aggregation input stream. Expected type "
+ aggType + ".");
} else {
+
+ // If a system_null is encountered locally, it would be an error; otherwise if it is seen
+ // by a global aggregator, it is simple ignored.
+ if (typeTag == ATypeTag.SYSTEM_NULL) {
+ if (isLocalAgg) {
+ throw new AlgebricksException("Type SYSTEM_NULL encountered in local aggregate.");
+ } else {
+ return;
+ }
+ }
+
if (ATypeHierarchy.canPromote(aggType, typeTag)) {
tpc = ATypeHierarchy.getTypePromoteComputer(aggType, typeTag);
aggType = typeTag;
@@ -93,8 +104,8 @@
if (tpc != null) {
tempValForCasting.reset();
try {
- tpc.promote(outputVal.getByteArray(), outputVal.getStartOffset() + 1, outputVal.getLength() - 1,
- tempValForCasting);
+ tpc.promote(outputVal.getByteArray(), outputVal.getStartOffset() + 1,
+ outputVal.getLength() - 1, tempValForCasting);
} catch (IOException e) {
throw new AlgebricksException(e);
}