Aggregate funcions namely agg-sum/agg-avg/agg-min/agg-max/agg-global-avg/agg-local-avg
are not meant to be used as part of AQL queries. Minor modification to ensure this.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@585 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 6f5a95f..e95cb6f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -429,7 +429,7 @@
// and then, Asterix builtin functions
add(ANY_COLLECTION_MEMBER, NonTaggedCollectionMemberResultType.INSTANCE);
- add(AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addPrivateFunction(AVG, OptionalADoubleTypeComputer.INSTANCE);
add(BOOLEAN_CONSTRUCTOR, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
add(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
add(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE);
@@ -451,7 +451,7 @@
}
});
add(CONTAINS, ABooleanTypeComputer.INSTANCE);
- add(COUNT, AInt32TypeComputer.INSTANCE);
+ addPrivateFunction(COUNT, AInt32TypeComputer.INSTANCE);
add(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
add(COUNTHASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
add(CREATE_CIRCLE, ACircleTypeComputer.INSTANCE);
@@ -486,7 +486,7 @@
add(GET_HANDLE, null); // TODO
add(GET_ITEM, NonTaggedGetItemResultType.INSTANCE);
add(GET_DATA, null); // TODO
- add(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
+ addPrivateFunction(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
add(GRAM_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE);
add(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
add(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
@@ -507,11 +507,11 @@
add(LIKE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE);
add(LINE_CONSTRUCTOR, OptionalALineTypeComputer.INSTANCE);
add(LISTIFY, OrderedListConstructorResultType.INSTANCE);
- add(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
+ addPrivateFunction(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
add(MAKE_FIELD_INDEX_HANDLE, null); // TODO
add(MAKE_FIELD_NAME_HANDLE, null); // TODO
- add(MAX, NonTaggedSumTypeComputer.INSTANCE);
- add(MIN, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(MAX, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(MIN, NonTaggedSumTypeComputer.INSTANCE);
add(NON_EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
add(NULL_CONSTRUCTOR, ANullTypeComputer.INSTANCE);
add(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE);
@@ -617,7 +617,7 @@
}
});
add(SUBSTRING, SubstringTypeComputer.INSTANCE);
- add(SUM, NonTaggedSumTypeComputer.INSTANCE);
+ addPrivateFunction(SUM, NonTaggedSumTypeComputer.INSTANCE);
add(SWITCH_CASE, NonTaggedSwitchCaseComputer.INSTANCE);
add(REG_EXP, ABooleanTypeComputer.INSTANCE);
add(INJECT_FAILURE, InjectFailureTypeComputer.INSTANCE);
@@ -816,6 +816,13 @@
asterixFunctionIdToInfo.put(fi, functionInfo);
}
+ private static IFunctionInfo addPrivateFunction(FunctionIdentifier fi, IResultTypeComputer typeComputer) {
+ IFunctionInfo functionInfo = getAsterixFunctionInfo(fi);
+ builtinFunctionsSet.put(functionInfo, functionInfo);
+ funTypeComputer.put(functionInfo, typeComputer);
+ return functionInfo;
+ }
+
private static void addAgg(FunctionIdentifier fi) {
builtinAggregateFunctions.add(getAsterixFunctionInfo(fi));
}