You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/05/24 01:31:39 UTC
[21/22] incubator-asterixdb git commit: ASTERIXDB-1228: Add MISSING
into the data model.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
index 06776ed..305d1a9 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
@@ -34,7 +34,7 @@ import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.om.base.AFloat;
import org.apache.asterix.om.base.AInt32;
-import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.base.AMissing;
import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.base.IACollection;
import org.apache.asterix.om.base.IAObject;
@@ -142,7 +142,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
public boolean analyzeGetItemFuncExpr(AbstractFunctionCallExpression funcExpr,
List<AbstractLogicalOperator> assignsAndUnnests, AccessMethodAnalysisContext analysisCtx)
- throws AlgebricksException {
+ throws AlgebricksException {
if (funcExpr.getFunctionIdentifier() != AsterixBuiltinFunctions.GET_ITEM) {
return false;
}
@@ -812,7 +812,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
private void addFunctionSpecificArgs(IOptimizableFuncExpr optFuncExpr, InvertedIndexJobGenParams jobGenParams) {
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.STRING_CONTAINS) {
jobGenParams.setSearchModifierType(SearchModifierType.CONJUNCTIVE);
- jobGenParams.setSimilarityThreshold(new AsterixConstantValue(ANull.NULL));
+ jobGenParams.setSimilarityThreshold(new AsterixConstantValue(AMissing.MISSING));
}
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.SIMILARITY_JACCARD_CHECK) {
jobGenParams.setSearchModifierType(SearchModifierType.JACCARD);
@@ -836,7 +836,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
private void addKeyVarsAndExprs(IOptimizableFuncExpr optFuncExpr, ArrayList<LogicalVariable> keyVarList,
ArrayList<Mutable<ILogicalExpression>> keyExprList, IOptimizationContext context)
- throws AlgebricksException {
+ throws AlgebricksException {
// For now we are assuming a single secondary index key.
// Add a variable and its expr to the lists which will be passed into an assign op.
LogicalVariable keyVar = context.newVar();
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineSubplanInputForNestedTupleSourceRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineSubplanInputForNestedTupleSourceRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineSubplanInputForNestedTupleSourceRule.java
index c018e8e..1881461 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineSubplanInputForNestedTupleSourceRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineSubplanInputForNestedTupleSourceRule.java
@@ -431,8 +431,8 @@ public class InlineSubplanInputForNestedTupleSourceRule implements IAlgebraicRew
List<Mutable<ILogicalExpression>> args = new ArrayList<Mutable<ILogicalExpression>>();
args.add(filterVarExpr);
List<Mutable<ILogicalExpression>> argsForNotFunction = new ArrayList<Mutable<ILogicalExpression>>();
- argsForNotFunction.add(new MutableObject<ILogicalExpression>(
- new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.IS_NULL), args)));
+ argsForNotFunction.add(new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
+ FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.IS_MISSING), args)));
SelectOperator selectOp = new SelectOperator(
new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.NOT), argsForNotFunction)),
@@ -525,7 +525,7 @@ public class InlineSubplanInputForNestedTupleSourceRule implements IAlgebraicRew
args.add(filterVarExpr);
List<Mutable<ILogicalExpression>> argsForNotFunction = new ArrayList<Mutable<ILogicalExpression>>();
argsForNotFunction.add(new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
- FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.IS_NULL), args)));
+ FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.IS_MISSING), args)));
nullCheckExprRefs.add(new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.NOT), argsForNotFunction)));
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
index c553231..eaf9484 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
@@ -31,7 +31,7 @@ import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.constants.AsterixConstantValue;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
-import org.apache.asterix.om.typecomputer.base.TypeComputerUtilities;
+import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.AUnionType;
@@ -187,14 +187,15 @@ public class StaticTypeCastUtil {
*/
private static boolean rewriteRecordFuncExpr(AbstractFunctionCallExpression funcExpr,
ARecordType requiredRecordType, ARecordType inputRecordType, IVariableTypeEnvironment env)
- throws AlgebricksException {
+ throws AlgebricksException {
// if already rewritten, the required type is not null
- if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
+ if (TypeCastUtils.getRequiredType(funcExpr) != null) {
return false;
+ }
boolean casted = staticRecordTypeCast(funcExpr, requiredRecordType, inputRecordType, env);
if (casted) {
//enforce the required type if it is statically casted
- TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredRecordType, inputRecordType);
+ TypeCastUtils.setRequiredAndInputTypes(funcExpr, requiredRecordType, inputRecordType);
}
return casted;
}
@@ -213,11 +214,12 @@ public class StaticTypeCastUtil {
*/
private static boolean rewriteListFuncExpr(AbstractFunctionCallExpression funcExpr,
AbstractCollectionType requiredListType, AbstractCollectionType inputListType, IVariableTypeEnvironment env)
- throws AlgebricksException {
- if (TypeComputerUtilities.getRequiredType(funcExpr) != null)
+ throws AlgebricksException {
+ if (TypeCastUtils.getRequiredType(funcExpr) != null) {
return false;
+ }
- TypeComputerUtilities.setRequiredAndInputTypes(funcExpr, requiredListType, inputListType);
+ TypeCastUtils.setRequiredAndInputTypes(funcExpr, requiredListType, inputListType);
List<Mutable<ILogicalExpression>> args = funcExpr.getArguments();
IAType itemType = requiredListType.getItemType();
@@ -305,9 +307,9 @@ public class StaticTypeCastUtil {
// match the optional field
if (NonTaggedFormatUtil.isOptional(reqFieldType)) {
- IAType itemType = ((AUnionType) reqFieldType).getNullableType();
+ IAType itemType = ((AUnionType) reqFieldType).getActualType();
reqFieldType = itemType;
- if (fieldType.equals(BuiltinType.ANULL) || fieldType.equals(itemType)) {
+ if (fieldType.equals(BuiltinType.AMISSING) || fieldType.equals(itemType)) {
fieldPermutation[j] = i;
openFields[i] = false;
matched = true;
@@ -324,14 +326,14 @@ public class StaticTypeCastUtil {
// match the optional type input for a non-optional field
// delay that to runtime by calling the not-null function
if (NonTaggedFormatUtil.isOptional(fieldType)) {
- IAType itemType = ((AUnionType) fieldType).getNullableType();
+ IAType itemType = ((AUnionType) fieldType).getActualType();
if (reqFieldType.equals(itemType)) {
fieldPermutation[j] = i;
openFields[i] = false;
matched = true;
ScalarFunctionCallExpression notNullFunc = new ScalarFunctionCallExpression(
- FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.NOT_NULL));
+ FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.CHECK_UNKNOWN));
notNullFunc.getArguments().add(new MutableObject<ILogicalExpression>(arg));
//wrap the not null function to the original function
func.getArguments().get(2 * i + 1).setValue(notNullFunc);
@@ -365,8 +367,9 @@ public class StaticTypeCastUtil {
for (int j = 0; j < inputFieldNames.length; j++) {
String fieldName = inputFieldNames[j];
IAType fieldType = inputFieldTypes[j];
- if (!fieldName.equals(reqFieldName))
+ if (!fieldName.equals(reqFieldName)) {
continue;
+ }
// should check open field here
// because number of entries in fieldPermuations is the
// number of required schema fields
@@ -378,16 +381,18 @@ public class StaticTypeCastUtil {
}
// match the optional field
- if (NonTaggedFormatUtil.isOptional(reqFieldType)) {
- IAType itemType = ((AUnionType) reqFieldType).getNullableType();
- if (fieldType.equals(BuiltinType.ANULL) || fieldType.equals(itemType)) {
- matched = true;
- break;
- }
+ if (!NonTaggedFormatUtil.isOptional(reqFieldType)) {
+ continue;
+ }
+ IAType itemType = ((AUnionType) reqFieldType).getActualType();
+ if (fieldType.equals(BuiltinType.AMISSING) || fieldType.equals(itemType)) {
+ matched = true;
+ break;
}
}
- if (matched)
+ if (matched) {
continue;
+ }
if (NonTaggedFormatUtil.isOptional(reqFieldType)) {
// add a null field
@@ -470,19 +475,18 @@ public class StaticTypeCastUtil {
injectCastFunction(FunctionUtil.getFunctionInfo(fi), reqFieldType, inputFieldType, expRef, argExpr);
castInjected = true;
}
- if (argExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
- //recursively rewrite function arguments
- if (TypeComputerUtilities.getRequiredType((AbstractFunctionCallExpression) argExpr) == null
- && reqFieldType != null) {
- if (castInjected) {
- //rewrite the arg expression inside the dynamic cast
- ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) argExpr;
- rewriteFuncExpr(argFunc, inputFieldType, inputFieldType, env);
- } else {
- //rewrite arg
- ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) argExpr;
- rewriteFuncExpr(argFunc, reqFieldType, inputFieldType, env);
- }
+ //recursively rewrite function arguments
+ if (argExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL
+ && TypeCastUtils.getRequiredType((AbstractFunctionCallExpression) argExpr) == null
+ && reqFieldType != null) {
+ if (castInjected) {
+ //rewrite the arg expression inside the dynamic cast
+ ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) argExpr;
+ rewriteFuncExpr(argFunc, inputFieldType, inputFieldType, env);
+ } else {
+ //rewrite arg
+ ScalarFunctionCallExpression argFunc = (ScalarFunctionCallExpression) argExpr;
+ rewriteFuncExpr(argFunc, reqFieldType, inputFieldType, env);
}
}
}
@@ -508,7 +512,7 @@ public class StaticTypeCastUtil {
ScalarFunctionCallExpression cast = new ScalarFunctionCallExpression(funcInfo);
cast.getArguments().add(new MutableObject<ILogicalExpression>(argExpr));
exprRef.setValue(cast);
- TypeComputerUtilities.setRequiredAndInputTypes(cast, reqType, inputType);
+ TypeCastUtils.setRequiredAndInputTypes(cast, reqType, inputType);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
index 8a2d3a5..8ded10b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
@@ -29,6 +29,7 @@ import org.apache.asterix.om.base.ADouble;
import org.apache.asterix.om.base.AFloat;
import org.apache.asterix.om.base.AInt32;
import org.apache.asterix.om.base.AInt64;
+import org.apache.asterix.om.base.AMissing;
import org.apache.asterix.om.base.ANull;
import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.base.IAObject;
@@ -37,38 +38,31 @@ public final class ConstantHelper {
public static IAObject objectFromLiteral(Literal valLiteral) {
switch (valLiteral.getLiteralType()) {
- case DOUBLE: {
+ case DOUBLE:
DoubleLiteral d = (DoubleLiteral) valLiteral;
return new ADouble(d.getValue());
- }
- case FALSE: {
+ case FALSE:
return ABoolean.FALSE;
- }
- case FLOAT: {
+ case FLOAT:
FloatLiteral fl = (FloatLiteral) valLiteral;
return new AFloat(fl.getValue());
- }
- case INTEGER: {
+ case INTEGER:
IntegerLiteral il = (IntegerLiteral) valLiteral;
return new AInt32(il.getValue());
- }
- case LONG: {
- LongIntegerLiteral il = (LongIntegerLiteral) valLiteral;
- return new AInt64(il.getValue());
- }
- case NULL: {
+ case LONG:
+ LongIntegerLiteral ll = (LongIntegerLiteral) valLiteral;
+ return new AInt64(ll.getValue());
+ case MISSING:
+ return AMissing.MISSING;
+ case NULL:
return ANull.NULL;
- }
- case STRING: {
+ case STRING:
StringLiteral sl = (StringLiteral) valLiteral;
return new AString(sl.getValue());
- }
- case TRUE: {
+ case TRUE:
return ABoolean.TRUE;
- }
- default: {
+ default:
throw new IllegalStateException();
- }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 551fa85..bfa29ec 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -1363,6 +1363,7 @@ class LangExpressionToPlanTranslator
List<Mutable<ILogicalExpression>> argRefs = new ArrayList<>();
argRefs.add(new MutableObject<ILogicalExpression>(expr));
switch (expr.getExpressionTag()) {
+ case CONSTANT:
case VARIABLE: {
return new UnnestingFunctionCallExpression(
FunctionUtil.getFunctionInfo(AsterixBuiltinFunctions.SCAN_COLLECTION), argRefs);
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
index 2d405f7..d2dfd30 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
@@ -60,7 +60,7 @@ public class TypeTranslator {
public static Map<TypeSignature, IAType> computeTypes(MetadataTransactionContext mdTxnCtx, TypeExpression typeExpr,
String typeName, String typeDataverse, Map<TypeSignature, IAType> typeMap)
- throws AlgebricksException, MetadataException {
+ throws AlgebricksException, MetadataException {
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes = new HashMap<String, Map<ARecordType, List<Integer>>>();
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes = new HashMap<TypeSignature, List<AbstractCollectionType>>();
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences = new HashMap<TypeSignature, List<TypeSignature>>();
@@ -69,9 +69,11 @@ public class TypeTranslator {
secondPass(mdTxnCtx, typeMap, incompleteFieldTypes, incompleteItemTypes, incompleteTopLevelTypeReferences,
typeDataverse);
- for (IAType type : typeMap.values())
- if (type.getTypeTag().isDerivedType())
+ for (IAType type : typeMap.values()) {
+ if (type.getTypeTag().isDerivedType()) {
((AbstractComplexType) type).generateNestedDerivedTypeNames();
+ }
+ }
return typeMap;
}
@@ -81,7 +83,7 @@ public class TypeTranslator {
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences, String typeDataverse)
- throws AlgebricksException {
+ throws AlgebricksException {
if (builtinTypeMap.get(typeName) != null) {
throw new AlgebricksException("Cannot redefine builtin type " + typeName + " .");
@@ -134,7 +136,7 @@ public class TypeTranslator {
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences, String typeDataverse)
- throws AlgebricksException, MetadataException {
+ throws AlgebricksException, MetadataException {
// solve remaining top level references
for (TypeSignature typeSignature : incompleteTopLevelTypeReferences.keySet()) {
@@ -143,8 +145,9 @@ public class TypeTranslator {
typeSignature.getName());
if (dt == null) {
throw new AlgebricksException("Could not resolve type " + typeSignature);
- } else
+ } else {
t = dt.getDatatype();
+ }
for (TypeSignature sign : incompleteTopLevelTypeReferences.get(typeSignature)) {
typeMap.put(sign, t);
}
@@ -155,8 +158,9 @@ public class TypeTranslator {
Datatype dt = MetadataManager.INSTANCE.getDatatype(mdTxnCtx, typeDataverse, trefName);
if (dt == null) {
throw new AlgebricksException("Could not resolve type " + trefName);
- } else
+ } else {
t = dt.getDatatype();
+ }
Map<ARecordType, List<Integer>> fieldsToFix = incompleteFieldTypes.get(trefName);
for (ARecordType recType : fieldsToFix.keySet()) {
List<Integer> positions = fieldsToFix.get(recType);
@@ -166,7 +170,7 @@ public class TypeTranslator {
fldTypes[pos] = t;
} else { // nullable
AUnionType nullableUnion = (AUnionType) fldTypes[pos];
- nullableUnion.setTypeAtIndex(t, 1);
+ nullableUnion.setActualType(t);
}
}
}
@@ -195,7 +199,7 @@ public class TypeTranslator {
private static AOrderedListType computeOrderedListType(TypeSignature typeSignature, OrderedListTypeDefinition oltd,
Map<TypeSignature, IAType> typeMap, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaultDataverse)
- throws AsterixException {
+ throws AsterixException {
TypeExpression tExpr = oltd.getItemTypeExpression();
String typeName = typeSignature != null ? typeSignature.getName() : null;
AOrderedListType aolt = new AOrderedListType(null, typeName);
@@ -207,7 +211,7 @@ public class TypeTranslator {
UnorderedListTypeDefinition ultd, Map<TypeSignature, IAType> typeMap,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaulDataverse)
- throws AsterixException {
+ throws AsterixException {
TypeExpression tExpr = ultd.getItemTypeExpression();
String typeName = typeSignature != null ? typeSignature.getName() : null;
AUnorderedListType ault = new AUnorderedListType(null, typeName);
@@ -312,7 +316,7 @@ public class TypeTranslator {
private static ARecordType computeRecordType(TypeSignature typeSignature, RecordTypeDefinition rtd,
Map<TypeSignature, IAType> typeMap, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, String defaultDataverse)
- throws AsterixException {
+ throws AsterixException {
List<String> names = rtd.getFieldNames();
int n = names.size();
String[] fldNames = new String[n];
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
index c575476..820d935 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
@@ -93,6 +93,12 @@ import org.apache.asterix.runtime.evaluators.accessors.TemporalMinuteAccessor;
import org.apache.asterix.runtime.evaluators.accessors.TemporalMonthAccessor;
import org.apache.asterix.runtime.evaluators.accessors.TemporalSecondAccessor;
import org.apache.asterix.runtime.evaluators.accessors.TemporalYearAccessor;
+import org.apache.asterix.runtime.evaluators.comparisons.EqualsDescriptor;
+import org.apache.asterix.runtime.evaluators.comparisons.GreaterThanDescriptor;
+import org.apache.asterix.runtime.evaluators.comparisons.GreaterThanOrEqualsDescriptor;
+import org.apache.asterix.runtime.evaluators.comparisons.LessThanDescriptor;
+import org.apache.asterix.runtime.evaluators.comparisons.LessThanOrEqualsDescriptor;
+import org.apache.asterix.runtime.evaluators.comparisons.NotEqualsDescriptor;
import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringConstructorDescriptor;
import org.apache.asterix.runtime.evaluators.constructors.ABinaryHexStringConstructorDescriptor;
import org.apache.asterix.runtime.evaluators.constructors.ABooleanConstructorDescriptor;
@@ -127,6 +133,7 @@ import org.apache.asterix.runtime.evaluators.functions.AndDescriptor;
import org.apache.asterix.runtime.evaluators.functions.AnyCollectionMemberDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CastListDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CastRecordDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CheckUnknownDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CodePointToStringDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CountHashedGramTokensDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CountHashedWordTokensDescriptor;
@@ -142,21 +149,19 @@ import org.apache.asterix.runtime.evaluators.functions.DeepEqualityDescriptor;
import org.apache.asterix.runtime.evaluators.functions.EditDistanceCheckDescriptor;
import org.apache.asterix.runtime.evaluators.functions.EditDistanceContainsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.EditDistanceDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.EditDistanceListIsFilterable;
-import org.apache.asterix.runtime.evaluators.functions.EditDistanceStringIsFilterable;
-import org.apache.asterix.runtime.evaluators.functions.EmbedTypeDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.FlowRecordDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.FuzzyEqDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceListIsFilterableDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceStringIsFilterableDescriptor;
import org.apache.asterix.runtime.evaluators.functions.GetItemDescriptor;
import org.apache.asterix.runtime.evaluators.functions.GramTokensDescriptor;
import org.apache.asterix.runtime.evaluators.functions.HashedGramTokensDescriptor;
import org.apache.asterix.runtime.evaluators.functions.HashedWordTokensDescriptor;
import org.apache.asterix.runtime.evaluators.functions.InjectFailureDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsMissingDescriptor;
import org.apache.asterix.runtime.evaluators.functions.IsNullDescriptor;
import org.apache.asterix.runtime.evaluators.functions.IsSystemNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsUnknownDescriptor;
import org.apache.asterix.runtime.evaluators.functions.LenDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NotDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.NotNullDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NumericAbsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NumericAddDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NumericCaretDescriptor;
@@ -235,7 +240,8 @@ import org.apache.asterix.runtime.evaluators.functions.temporal.DatetimeFromDate
import org.apache.asterix.runtime.evaluators.functions.temporal.DatetimeFromUnixTimeInMsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.DatetimeFromUnixTimeInSecsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.DayOfWeekDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.temporal.DayTimeDurationComparatorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.temporal.DayTimeDurationGreaterThanComparatorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.temporal.DayTimeDurationLessThanComparatorDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.DurationEqualDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.DurationFromIntervalDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.DurationFromMillisecondsDescriptor;
@@ -249,7 +255,7 @@ import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalBinDescr
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalCoveredByDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalCoversDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalEndedByDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalEndsDecriptor;
+import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalEndsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalMeetsDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalMetByDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.IntervalOverlappedByDescriptor;
@@ -268,7 +274,8 @@ import org.apache.asterix.runtime.evaluators.functions.temporal.PrintDateTimeDes
import org.apache.asterix.runtime.evaluators.functions.temporal.PrintTimeDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.TimeFromDatetimeDescriptor;
import org.apache.asterix.runtime.evaluators.functions.temporal.TimeFromUnixTimeInMsDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.temporal.YearMonthDurationComparatorDecriptor;
+import org.apache.asterix.runtime.evaluators.functions.temporal.YearMonthDurationGreaterThanComparatorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.temporal.YearMonthDurationLessThanComparatorDescriptor;
import org.apache.asterix.runtime.evaluators.staticcodegen.CodeGenUtil;
import org.apache.asterix.runtime.runningaggregates.std.TidRunningAggregateDescriptor;
import org.apache.asterix.runtime.unnestingfunctions.std.RangeDescriptor;
@@ -281,85 +288,16 @@ import org.apache.asterix.runtime.unnestingfunctions.std.SubsetCollectionDescrip
public class FunctionCollection {
private static final String FACTORY = "FACTORY";
- private static final List<IFunctionDescriptorFactory> temp = new ArrayList<IFunctionDescriptorFactory>();
+ private static final List<IFunctionDescriptorFactory> temp = new ArrayList<>();
static {
- // format-independent
+ // unnesting function
temp.add(TidRunningAggregateDescriptor.FACTORY);
-
- // format-dependent
- temp.add(AndDescriptor.FACTORY);
- temp.add(OrDescriptor.FACTORY);
- temp.add(StringLikeDescriptor.FACTORY);
temp.add(ScanCollectionDescriptor.FACTORY);
- temp.add(AnyCollectionMemberDescriptor.FACTORY);
- temp.add(ClosedRecordConstructorDescriptor.FACTORY);
- temp.add(FieldAccessByIndexDescriptor.FACTORY);
- temp.add(FieldAccessByNameDescriptor.FACTORY);
- temp.add(FieldAccessNestedDescriptor.FACTORY);
- temp.add(GetRecordFieldsDescriptor.FACTORY);
- temp.add(GetRecordFieldValueDescriptor.FACTORY);
- temp.add(FieldAccessByNameDescriptor.FACTORY);
- temp.add(GetItemDescriptor.FACTORY);
- temp.add(NumericUnaryMinusDescriptor.FACTORY);
- temp.add(OpenRecordConstructorDescriptor.FACTORY);
- temp.add(OrderedListConstructorDescriptor.FACTORY);
- temp.add(UnorderedListConstructorDescriptor.FACTORY);
- temp.add(EmbedTypeDescriptor.FACTORY);
-
- temp.add(NumericAddDescriptor.FACTORY);
- temp.add(NumericDivideDescriptor.FACTORY);
- temp.add(NumericMultiplyDescriptor.FACTORY);
- temp.add(NumericSubDescriptor.FACTORY);
- temp.add(NumericModuloDescriptor.FACTORY);
- temp.add(NumericCaretDescriptor.FACTORY);
- temp.add(IsNullDescriptor.FACTORY);
- temp.add(IsSystemNullDescriptor.FACTORY);
- temp.add(NotDescriptor.FACTORY);
- temp.add(LenDescriptor.FACTORY);
- temp.add(EmptyStreamAggregateDescriptor.FACTORY);
- temp.add(NonEmptyStreamAggregateDescriptor.FACTORY);
temp.add(RangeDescriptor.FACTORY);
+ temp.add(SubsetCollectionDescriptor.FACTORY);
- temp.add(NumericAbsDescriptor.FACTORY);
- temp.add(getGeneratedFunctionDescriptorFactory(NumericCeilingDescriptor.class));
- temp.add(NumericFloorDescriptor.FACTORY);
- temp.add(NumericRoundDescriptor.FACTORY);
- temp.add(NumericRoundHalfToEvenDescriptor.FACTORY);
- temp.add(NumericRoundHalfToEven2Descriptor.FACTORY);
-
- // Binary functions
- temp.add(BinaryLengthDescriptor.FACTORY);
- temp.add(ParseBinaryDescriptor.FACTORY);
- temp.add(PrintBinaryDescriptor.FACTORY);
- temp.add(BinaryConcatDescriptor.FACTORY);
- temp.add(SubBinaryFromDescriptor.FACTORY);
- temp.add(SubBinaryFromToDescriptor.FACTORY);
- temp.add(FindBinaryDescriptor.FACTORY);
- temp.add(FindBinaryFromDescriptor.FACTORY);
-
- // String functions
- temp.add(StringContainsDescriptor.FACTORY);
- temp.add(StringEndsWithDescriptor.FACTORY);
- temp.add(StringStartsWithDescriptor.FACTORY);
- temp.add(getGeneratedFunctionDescriptorFactory(SubstringDescriptor.class));
- temp.add(StringEqualDescriptor.FACTORY);
- temp.add(StringMatchesDescriptor.FACTORY);
- temp.add(getGeneratedFunctionDescriptorFactory(StringLowerCaseDescriptor.class));
- temp.add(getGeneratedFunctionDescriptorFactory(StringUpperCaseDescriptor.class));
- temp.add(StringMatchesWithFlagDescriptor.FACTORY);
- temp.add(StringReplaceDescriptor.FACTORY);
- temp.add(StringReplaceWithFlagsDescriptor.FACTORY);
- temp.add(getGeneratedFunctionDescriptorFactory(StringLengthDescriptor.class));
- temp.add(getGeneratedFunctionDescriptorFactory(Substring2Descriptor.class));
- temp.add(SubstringBeforeDescriptor.FACTORY);
- temp.add(SubstringAfterDescriptor.FACTORY);
- temp.add(StringToCodePointDescriptor.FACTORY);
- temp.add(CodePointToStringDescriptor.FACTORY);
- temp.add(StringConcatDescriptor.FACTORY);
- temp.add(StringJoinDescriptor.FACTORY);
-
- // aggregates
+ // aggregate functions
temp.add(ListifyAggregateDescriptor.FACTORY);
temp.add(CountAggregateDescriptor.FACTORY);
temp.add(AvgAggregateDescriptor.FACTORY);
@@ -388,6 +326,8 @@ public class FunctionCollection {
temp.add(ScalarSumAggregateDescriptor.FACTORY);
temp.add(ScalarMaxAggregateDescriptor.FACTORY);
temp.add(ScalarMinAggregateDescriptor.FACTORY);
+ temp.add(EmptyStreamAggregateDescriptor.FACTORY);
+ temp.add(NonEmptyStreamAggregateDescriptor.FACTORY);
// SQL aggregates
temp.add(SqlCountAggregateDescriptor.FACTORY);
@@ -418,164 +358,258 @@ public class FunctionCollection {
temp.add(ScalarSqlMaxAggregateDescriptor.FACTORY);
temp.add(ScalarSqlMinAggregateDescriptor.FACTORY);
- // new functions - constructors
- temp.add(ABooleanConstructorDescriptor.FACTORY);
- temp.add(ANullConstructorDescriptor.FACTORY);
- temp.add(ABinaryHexStringConstructorDescriptor.FACTORY);
- temp.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
- temp.add(AStringConstructorDescriptor.FACTORY);
- temp.add(AInt8ConstructorDescriptor.FACTORY);
- temp.add(AInt16ConstructorDescriptor.FACTORY);
- temp.add(AInt32ConstructorDescriptor.FACTORY);
- temp.add(AInt64ConstructorDescriptor.FACTORY);
- temp.add(AFloatConstructorDescriptor.FACTORY);
- temp.add(ADoubleConstructorDescriptor.FACTORY);
- temp.add(APointConstructorDescriptor.FACTORY);
- temp.add(APoint3DConstructorDescriptor.FACTORY);
- temp.add(ALineConstructorDescriptor.FACTORY);
- temp.add(APolygonConstructorDescriptor.FACTORY);
- temp.add(ACircleConstructorDescriptor.FACTORY);
- temp.add(ARectangleConstructorDescriptor.FACTORY);
- temp.add(ATimeConstructorDescriptor.FACTORY);
- temp.add(ADateConstructorDescriptor.FACTORY);
- temp.add(ADateTimeConstructorDescriptor.FACTORY);
- temp.add(ADurationConstructorDescriptor.FACTORY);
- temp.add(AYearMonthDurationConstructorDescriptor.FACTORY);
- temp.add(ADayTimeDurationConstructorDescriptor.FACTORY);
- temp.add(AUUIDFromStringConstructorDescriptor.FACTORY);
-
- temp.add(DeepEqualityDescriptor.FACTORY);
+ // boolean functions
+ temp.add(AndDescriptor.FACTORY);
+ temp.add(OrDescriptor.FACTORY);
- temp.add(CreateUUIDDescriptor.FACTORY);
- temp.add(CreateQueryUIDDescriptor.FACTORY);
- // Spatial
- temp.add(CreatePointDescriptor.FACTORY);
- temp.add(CreateLineDescriptor.FACTORY);
- temp.add(CreatePolygonDescriptor.FACTORY);
- temp.add(CreateCircleDescriptor.FACTORY);
- temp.add(CreateRectangleDescriptor.FACTORY);
- temp.add(SpatialAreaDescriptor.FACTORY);
- temp.add(SpatialDistanceDescriptor.FACTORY);
- temp.add(SpatialIntersectDescriptor.FACTORY);
- temp.add(CreateMBRDescriptor.FACTORY);
- temp.add(SpatialCellDescriptor.FACTORY);
- temp.add(PointXCoordinateAccessor.FACTORY);
- temp.add(PointYCoordinateAccessor.FACTORY);
- temp.add(CircleRadiusAccessor.FACTORY);
- temp.add(CircleCenterAccessor.FACTORY);
- temp.add(LineRectanglePolygonAccessor.FACTORY);
+ // Record constructors
+ temp.add(ClosedRecordConstructorDescriptor.FACTORY);
+ temp.add(OpenRecordConstructorDescriptor.FACTORY);
- // fuzzyjoin function
- temp.add(FuzzyEqDescriptor.FACTORY);
- temp.add(SubsetCollectionDescriptor.FACTORY);
- temp.add(PrefixLenJaccardDescriptor.FACTORY);
-
- temp.add(WordTokensDescriptor.FACTORY);
- temp.add(HashedWordTokensDescriptor.FACTORY);
- temp.add(CountHashedWordTokensDescriptor.FACTORY);
-
- temp.add(GramTokensDescriptor.FACTORY);
- temp.add(HashedGramTokensDescriptor.FACTORY);
- temp.add(CountHashedGramTokensDescriptor.FACTORY);
-
- temp.add(EditDistanceDescriptor.FACTORY);
- temp.add(EditDistanceCheckDescriptor.FACTORY);
- temp.add(EditDistanceStringIsFilterable.FACTORY);
- temp.add(EditDistanceListIsFilterable.FACTORY);
- temp.add(EditDistanceContainsDescriptor.FACTORY);
-
- temp.add(SimilarityJaccardDescriptor.FACTORY);
- temp.add(SimilarityJaccardCheckDescriptor.FACTORY);
- temp.add(SimilarityJaccardSortedDescriptor.FACTORY);
- temp.add(SimilarityJaccardSortedCheckDescriptor.FACTORY);
- temp.add(SimilarityJaccardPrefixDescriptor.FACTORY);
- temp.add(SimilarityJaccardPrefixCheckDescriptor.FACTORY);
+ // List constructors
+ temp.add(OrderedListConstructorDescriptor.FACTORY);
+ temp.add(UnorderedListConstructorDescriptor.FACTORY);
- //Record functions
- temp.add(RecordMergeDescriptor.FACTORY);
- temp.add(RecordAddFieldsDescriptor.FACTORY);
- temp.add(RecordRemoveFieldsDescriptor.FACTORY);
- temp.add(SwitchCaseDescriptor.FACTORY);
- temp.add(RegExpDescriptor.FACTORY);
+ // Cast functions
temp.add(InjectFailureDescriptor.FACTORY);
temp.add(CastListDescriptor.FACTORY);
temp.add(CastRecordDescriptor.FACTORY);
- temp.add(FlowRecordDescriptor.FACTORY);
- temp.add(NotNullDescriptor.FACTORY);
- // Spatial and temporal type accessors
- temp.add(TemporalYearAccessor.FACTORY);
- temp.add(TemporalMonthAccessor.FACTORY);
- temp.add(TemporalDayAccessor.FACTORY);
- temp.add(TemporalHourAccessor.FACTORY);
- temp.add(TemporalMinuteAccessor.FACTORY);
- temp.add(TemporalSecondAccessor.FACTORY);
- temp.add(TemporalMillisecondAccessor.FACTORY);
- temp.add(TemporalIntervalStartAccessor.FACTORY);
- temp.add(TemporalIntervalEndAccessor.FACTORY);
- temp.add(TemporalIntervalStartDateAccessor.FACTORY);
- temp.add(TemporalIntervalEndDateAccessor.FACTORY);
- temp.add(TemporalIntervalStartTimeAccessor.FACTORY);
- temp.add(TemporalIntervalEndTimeAccessor.FACTORY);
- temp.add(TemporalIntervalStartDatetimeAccessor.FACTORY);
- temp.add(TemporalIntervalEndDatetimeAccessor.FACTORY);
+ // Switch case
+ temp.add(SwitchCaseDescriptor.FACTORY);
- // Temporal functions
- temp.add(DateFromUnixTimeInDaysDescriptor.FACTORY);
- temp.add(DateFromDatetimeDescriptor.FACTORY);
- temp.add(TimeFromUnixTimeInMsDescriptor.FACTORY);
- temp.add(TimeFromDatetimeDescriptor.FACTORY);
- temp.add(DatetimeFromUnixTimeInMsDescriptor.FACTORY);
- temp.add(DatetimeFromUnixTimeInSecsDescriptor.FACTORY);
- temp.add(DatetimeFromDateAndTimeDescriptor.FACTORY);
- temp.add(CalendarDurationFromDateTimeDescriptor.FACTORY);
- temp.add(CalendarDuartionFromDateDescriptor.FACTORY);
- temp.add(AdjustDateTimeForTimeZoneDescriptor.FACTORY);
- temp.add(AdjustTimeForTimeZoneDescriptor.FACTORY);
- temp.add(IntervalBeforeDescriptor.FACTORY);
- temp.add(IntervalAfterDescriptor.FACTORY);
- temp.add(IntervalMeetsDescriptor.FACTORY);
- temp.add(IntervalMetByDescriptor.FACTORY);
- temp.add(IntervalOverlapsDescriptor.FACTORY);
- temp.add(IntervalOverlappedByDescriptor.FACTORY);
- temp.add(OverlapDescriptor.FACTORY);
- temp.add(IntervalStartsDescriptor.FACTORY);
- temp.add(IntervalStartedByDescriptor.FACTORY);
- temp.add(IntervalCoversDescriptor.FACTORY);
- temp.add(IntervalCoveredByDescriptor.FACTORY);
- temp.add(IntervalEndsDecriptor.FACTORY);
- temp.add(IntervalEndedByDescriptor.FACTORY);
+ // null functions
+ temp.add(IsMissingDescriptor.FACTORY);
+ temp.add(IsNullDescriptor.FACTORY);
+ temp.add(IsUnknownDescriptor.FACTORY);
+ temp.add(IsSystemNullDescriptor.FACTORY);
+ temp.add(CheckUnknownDescriptor.FACTORY);
+
+ // uuid generators (zero independent functions)
+ temp.add(CreateUUIDDescriptor.FACTORY);
+ temp.add(CreateQueryUIDDescriptor.FACTORY);
temp.add(CurrentDateDescriptor.FACTORY);
temp.add(CurrentTimeDescriptor.FACTORY);
temp.add(CurrentDateTimeDescriptor.FACTORY);
- temp.add(DurationFromMillisecondsDescriptor.FACTORY);
- temp.add(DurationFromMonthsDescriptor.FACTORY);
- temp.add(YearMonthDurationComparatorDecriptor.GREATER_THAN_FACTORY);
- temp.add(YearMonthDurationComparatorDecriptor.LESS_THAN_FACTORY);
- temp.add(DayTimeDurationComparatorDescriptor.GREATER_THAN_FACTORY);
- temp.add(DayTimeDurationComparatorDescriptor.LESS_THAN_FACTORY);
- temp.add(MonthsFromYearMonthDurationDescriptor.FACTORY);
- temp.add(MillisecondsFromDayTimeDurationDescriptor.FACTORY);
- temp.add(DurationEqualDescriptor.FACTORY);
- temp.add(GetYearMonthDurationDescriptor.FACTORY);
- temp.add(GetDayTimeDurationDescriptor.FACTORY);
- temp.add(IntervalBinDescriptor.FACTORY);
- temp.add(OverlapBinsDescriptor.FACTORY);
- temp.add(DayOfWeekDescriptor.FACTORY);
- temp.add(ParseDateDescriptor.FACTORY);
- temp.add(ParseTimeDescriptor.FACTORY);
- temp.add(ParseDateTimeDescriptor.FACTORY);
- temp.add(PrintDateDescriptor.FACTORY);
- temp.add(PrintTimeDescriptor.FACTORY);
- temp.add(PrintDateTimeDescriptor.FACTORY);
- temp.add(GetOverlappingIntervalDescriptor.FACTORY);
- temp.add(DurationFromIntervalDescriptor.FACTORY);
-
- // Interval constructor
- temp.add(AIntervalConstructorDescriptor.FACTORY);
- temp.add(AIntervalStartFromDateConstructorDescriptor.FACTORY);
- temp.add(AIntervalStartFromDateTimeConstructorDescriptor.FACTORY);
- temp.add(AIntervalStartFromTimeConstructorDescriptor.FACTORY);
+
+ // TODO: decide how should we deal these two weird functions as
+ // the number of arguments of the function depend on the first few arguments.
+ temp.add(SimilarityJaccardPrefixDescriptor.FACTORY);
+ temp.add(SimilarityJaccardPrefixCheckDescriptor.FACTORY);
+
+ // functions that need generated class for null-handling.
+ List<IFunctionDescriptorFactory> functionsToInjectUnkownHandling = new ArrayList<>();
+
+ // Element accessors.
+ functionsToInjectUnkownHandling.add(FieldAccessByIndexDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(FieldAccessByNameDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(FieldAccessNestedDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AnyCollectionMemberDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GetItemDescriptor.FACTORY);
+
+ // Numeric functions
+ functionsToInjectUnkownHandling.add(NumericUnaryMinusDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericAddDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericDivideDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericMultiplyDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericSubDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericModuloDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericCaretDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NotDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(LenDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericAbsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericCeilingDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericFloorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericRoundDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericRoundHalfToEvenDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NumericRoundHalfToEven2Descriptor.FACTORY);
+
+ // Comparisons.
+ functionsToInjectUnkownHandling.add(EqualsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GreaterThanDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GreaterThanOrEqualsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(LessThanDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(LessThanOrEqualsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(NotEqualsDescriptor.FACTORY);
+
+ // Binary functions
+ functionsToInjectUnkownHandling.add(BinaryLengthDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ParseBinaryDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(PrintBinaryDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(BinaryConcatDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SubBinaryFromDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SubBinaryFromToDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(FindBinaryDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(FindBinaryFromDescriptor.FACTORY);
+
+ // String functions
+ functionsToInjectUnkownHandling.add(StringLikeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringContainsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringEndsWithDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringStartsWithDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SubstringDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringEqualDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringMatchesDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringLowerCaseDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringUpperCaseDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringMatchesWithFlagDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringReplaceDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringReplaceWithFlagsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringLengthDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(Substring2Descriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SubstringBeforeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SubstringAfterDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringToCodePointDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CodePointToStringDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringConcatDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(StringJoinDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(RegExpDescriptor.FACTORY);
+
+ // Constructors
+ functionsToInjectUnkownHandling.add(ABooleanConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ANullConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ABinaryHexStringConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AStringConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AInt8ConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AInt16ConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AInt32ConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AInt64ConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AFloatConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ADoubleConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(APointConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(APoint3DConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ALineConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(APolygonConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ACircleConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ARectangleConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ATimeConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ADateConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ADateTimeConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ADurationConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AYearMonthDurationConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AUUIDFromStringConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AIntervalConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AIntervalStartFromDateConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AIntervalStartFromDateTimeConstructorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AIntervalStartFromTimeConstructorDescriptor.FACTORY);
+
+ // Spatial
+ functionsToInjectUnkownHandling.add(CreatePointDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CreateLineDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CreatePolygonDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CreateCircleDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CreateRectangleDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SpatialAreaDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SpatialDistanceDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SpatialIntersectDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CreateMBRDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SpatialCellDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(PointXCoordinateAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(PointYCoordinateAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(CircleRadiusAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(CircleCenterAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(LineRectanglePolygonAccessor.FACTORY);
+
+ // fuzzyjoin function
+ functionsToInjectUnkownHandling.add(PrefixLenJaccardDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(WordTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(HashedWordTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CountHashedWordTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GramTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(HashedGramTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CountHashedGramTokensDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(EditDistanceDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(EditDistanceCheckDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(EditDistanceStringIsFilterableDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(EditDistanceListIsFilterableDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(EditDistanceContainsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SimilarityJaccardDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SimilarityJaccardCheckDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SimilarityJaccardSortedDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(SimilarityJaccardSortedCheckDescriptor.FACTORY);
+
+ // Record functions.
+ functionsToInjectUnkownHandling.add(GetRecordFieldsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GetRecordFieldValueDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(FieldAccessByNameDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DeepEqualityDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(RecordMergeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(RecordAddFieldsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(RecordRemoveFieldsDescriptor.FACTORY);
+
+ // Spatial and temporal type accessors
+ functionsToInjectUnkownHandling.add(TemporalYearAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalMonthAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalDayAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalHourAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalMinuteAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalSecondAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalMillisecondAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalStartAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalEndAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalStartDateAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalEndDateAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalStartTimeAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalEndTimeAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalStartDatetimeAccessor.FACTORY);
+ functionsToInjectUnkownHandling.add(TemporalIntervalEndDatetimeAccessor.FACTORY);
+
+ // Temporal functions
+ functionsToInjectUnkownHandling.add(DateFromUnixTimeInDaysDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DateFromDatetimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(TimeFromUnixTimeInMsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(TimeFromDatetimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DatetimeFromUnixTimeInMsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DatetimeFromUnixTimeInSecsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DatetimeFromDateAndTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CalendarDurationFromDateTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(CalendarDuartionFromDateDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AdjustDateTimeForTimeZoneDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(AdjustTimeForTimeZoneDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalBeforeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalAfterDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalMeetsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalMetByDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalOverlapsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalOverlappedByDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(OverlapDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalStartsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalStartedByDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalCoversDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalCoveredByDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalEndsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalEndedByDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DurationFromMillisecondsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DurationFromMonthsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(YearMonthDurationGreaterThanComparatorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(YearMonthDurationLessThanComparatorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DayTimeDurationGreaterThanComparatorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DayTimeDurationLessThanComparatorDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(MonthsFromYearMonthDurationDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(MillisecondsFromDayTimeDurationDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DurationEqualDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GetYearMonthDurationDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GetDayTimeDurationDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(IntervalBinDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(OverlapBinsDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DayOfWeekDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ParseDateDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ParseTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(ParseDateTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(PrintDateDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(PrintTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(PrintDateTimeDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(GetOverlappingIntervalDescriptor.FACTORY);
+ functionsToInjectUnkownHandling.add(DurationFromIntervalDescriptor.FACTORY);
+
+ List<IFunctionDescriptorFactory> generatedFactories = new ArrayList<>();
+ for (IFunctionDescriptorFactory factory : functionsToInjectUnkownHandling) {
+ generatedFactories
+ .add(getGeneratedFunctionDescriptorFactory(factory.createFunctionDescriptor().getClass()));
+ }
+ temp.addAll(generatedFactories);
}
public static List<IFunctionDescriptorFactory> getFunctionDescriptorFactories() {
@@ -592,7 +626,8 @@ public class FunctionCollection {
*/
private static IFunctionDescriptorFactory getGeneratedFunctionDescriptorFactory(Class<?> cl) {
try {
- String className = cl.getName() + CodeGenUtil.DEFAULT_SUFFIX_FOR_GENERATED_CLASS;
+ String className = CodeGenUtil.getGeneratedFunctionDescriptorClassName(cl.getName(),
+ CodeGenUtil.DEFAULT_SUFFIX_FOR_GENERATED_CLASS);
Class<?> generatedCl = cl.getClassLoader().loadClass(className);
Field factory = generatedCl.getDeclaredField(FACTORY);
return (IFunctionDescriptorFactory) factory.get(null);
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
index 03e3fe8..13153c2 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
@@ -160,14 +160,14 @@ public class ValidateUtil {
List<String> fieldName = keyFieldNames.get(pos);
if (fieldType == null) {
fieldType = keyFieldTypes.get(pos);
- if (keyFieldTypes.get(pos) == BuiltinType.ANULL) {
+ if (keyFieldTypes.get(pos) == BuiltinType.AMISSING) {
throw new AsterixException("A field with this name \"" + fieldName + "\" could not be found.");
}
} else if (openFieldCompositeIdx) {
throw new AsterixException("A closed field \"" + fieldName
+ "\" could be only in a prefix part of the composite index, containing opened field.");
}
- if (keyFieldTypes.get(pos) != BuiltinType.ANULL
+ if (keyFieldTypes.get(pos) != BuiltinType.AMISSING
&& fieldType.getTypeTag() != keyFieldTypes.get(pos).getTypeTag()) {
throw new AsterixException(
"A field \"" + fieldName + "\" is already defined with the type \"" + fieldType + "\"");
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
index 42b1cc3..5cd049d 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
@@ -34,7 +34,7 @@ import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.compiler.provider.ILangCompilationProvider;
import org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer;
import org.apache.asterix.dataflow.data.common.AqlMergeAggregationExpressionFactory;
-import org.apache.asterix.dataflow.data.common.AqlNullableTypeComputer;
+import org.apache.asterix.dataflow.data.common.AqlMissableTypeComputer;
import org.apache.asterix.dataflow.data.common.AqlPartialAggregationTypeComputer;
import org.apache.asterix.formats.base.IDataFormat;
import org.apache.asterix.jobgen.QueryLogicalExpressionJobGen;
@@ -64,7 +64,7 @@ import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-import org.apache.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IMissableTypeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.PlanPlotter;
@@ -160,10 +160,10 @@ public class APIFramework {
public IOptimizationContext createOptimizationContext(int varCounter,
IExpressionEvalSizeComputer expressionEvalSizeComputer,
IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
- IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
+ IExpressionTypeComputer expressionTypeComputer, IMissableTypeComputer missableTypeComputer,
PhysicalOptimizationConfig physicalOptimizationConfig, AlgebricksPartitionConstraint clusterLocations) {
return new AlgebricksOptimizationContext(varCounter, expressionEvalSizeComputer,
- mergeAggregationExpressionFactory, expressionTypeComputer, nullableTypeComputer,
+ mergeAggregationExpressionFactory, expressionTypeComputer, missableTypeComputer,
physicalOptimizationConfig, clusterLocations);
}
@@ -282,7 +282,7 @@ public class APIFramework {
builder.setIMergeAggregationExpressionFactory(new AqlMergeAggregationExpressionFactory());
builder.setPartialAggregationTypeComputer(new AqlPartialAggregationTypeComputer());
builder.setExpressionTypeComputer(AqlExpressionTypeComputer.INSTANCE);
- builder.setNullableTypeComputer(AqlNullableTypeComputer.INSTANCE);
+ builder.setMissableTypeComputer(AqlMissableTypeComputer.INSTANCE);
builder.setClusterLocations(queryMetadataProvider.getClusterLocations());
ICompiler compiler = compilerFactory.createCompiler(plan, queryMetadataProvider, t.getVarCounter());
@@ -330,7 +330,7 @@ public class APIFramework {
new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter(QueryLogicalExpressionJobGen.INSTANCE));
builder.setHashFunctionFactoryProvider(format.getBinaryHashFunctionFactoryProvider());
builder.setHashFunctionFamilyProvider(format.getBinaryHashFunctionFamilyProvider());
- builder.setNullWriterFactory(format.getNullWriterFactory());
+ builder.setMissingWriterFactory(format.getMissingWriterFactory());
builder.setPredicateEvaluatorFactoryProvider(format.getPredicateEvaluatorFactoryProvider());
switch (conf.fmt()) {
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
index 2f017e5..65afe3c 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
@@ -53,7 +53,7 @@ import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.util.AsterixAppContextInfo;
import org.apache.asterix.runtime.evaluators.functions.AndDescriptor;
import org.apache.asterix.runtime.evaluators.functions.CastRecordDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.IsNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsUnknownDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NotDescriptor;
import org.apache.asterix.runtime.job.listener.JobEventListenerFactory;
import org.apache.asterix.transaction.management.opcallbacks.PrimaryIndexInstantSearchOperationCallbackFactory;
@@ -436,11 +436,11 @@ public abstract class SecondaryIndexOperationsHelper {
RecordDescriptor secondaryRecDesc) throws AlgebricksException {
IScalarEvaluatorFactory[] andArgsEvalFactories = new IScalarEvaluatorFactory[numSecondaryKeyFields];
NotDescriptor notDesc = new NotDescriptor();
- IsNullDescriptor isNullDesc = new IsNullDescriptor();
+ IsUnknownDescriptor isUnknownDesc = new IsUnknownDescriptor();
for (int i = 0; i < numSecondaryKeyFields; i++) {
// Access column i, and apply 'is not null'.
ColumnAccessEvalFactory columnAccessEvalFactory = new ColumnAccessEvalFactory(i);
- IScalarEvaluatorFactory isNullEvalFactory = isNullDesc
+ IScalarEvaluatorFactory isNullEvalFactory = isUnknownDesc
.createEvaluatorFactory(new IScalarEvaluatorFactory[] { columnAccessEvalFactory });
IScalarEvaluatorFactory notEvalFactory = notDesc
.createEvaluatorFactory(new IScalarEvaluatorFactory[] { isNullEvalFactory });
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
new file mode 100644
index 0000000..d4b50a4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
@@ -0,0 +1,105 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime;
+
+import static org.mockito.Mockito.mock;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.translator.util.FunctionCollection;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NullMissingTest {
+
+ @Test
+ public void test() throws Exception {
+ List<IFunctionDescriptorFactory> functions = FunctionCollection.getFunctionDescriptorFactories();
+ for (IFunctionDescriptorFactory func : functions) {
+ String className = func.getClass().getName();
+ // We test all generated functions except
+ // record functions, which requires type settings (we test them in runtime tests);
+ if (className.contains("generated") && !className.contains("record")) {
+ testFunction(func);
+ }
+ }
+ }
+
+ private void testFunction(IFunctionDescriptorFactory funcFactory) throws Exception {
+ AbstractScalarFunctionDynamicDescriptor funcDesc = (AbstractScalarFunctionDynamicDescriptor) funcFactory
+ .createFunctionDescriptor();
+ int inputArity = funcDesc.getIdentifier().getArity();
+ Iterator<IScalarEvaluatorFactory[]> argEvalFactoryIterator = getArgCombinations(inputArity);
+ int index = 0;
+ while (argEvalFactoryIterator.hasNext()) {
+ IScalarEvaluatorFactory evalFactory = funcDesc.createEvaluatorFactory(argEvalFactoryIterator.next());
+ IHyracksTaskContext ctx = mock(IHyracksTaskContext.class);
+ IScalarEvaluator evaluator = evalFactory.createScalarEvaluator(ctx);
+ IPointable resultPointable = new VoidPointable();
+ evaluator.evaluate(null, resultPointable);
+ if (index != 0) {
+ Assert.assertTrue(resultPointable.getByteArray()[resultPointable
+ .getStartOffset()] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
+ } else {
+ Assert.assertTrue(resultPointable.getByteArray()[resultPointable
+ .getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+ }
+ ++index;
+ }
+ }
+
+ private Iterator<IScalarEvaluatorFactory[]> getArgCombinations(int argSize) {
+ final int numCombinations = 1 << argSize;
+ return new Iterator<IScalarEvaluatorFactory[]>() {
+ private int index = 0;
+
+ @Override
+ public boolean hasNext() {
+ return index < numCombinations;
+ }
+
+ @Override
+ public IScalarEvaluatorFactory[] next() {
+ IScalarEvaluatorFactory[] scalarEvaluatorFactories = new IScalarEvaluatorFactory[argSize];
+ for (int j = 0; j < argSize; ++j) {
+ byte serializedTypeTag = (index & (1 << j)) != 0 ? ATypeTag.SERIALIZED_MISSING_TYPE_TAG
+ : ATypeTag.SERIALIZED_NULL_TYPE_TAG;
+ scalarEvaluatorFactories[j] = new ConstantEvalFactory(new byte[] { serializedTypeTag });
+ }
+ ++index;
+ return scalarEvaluatorFactories;
+ }
+
+ };
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
index 4a303ad..157270f 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
@@ -49,6 +49,7 @@
{ "DataverseName": "Metadata", "DatatypeName": "int8", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "interval", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "line", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
+{ "DataverseName": "Metadata", "DatatypeName": "missing", "Derived": null, "Timestamp": "Mon Apr 25 14:46:17 PDT 2016" }
{ "DataverseName": "Metadata", "DatatypeName": "null", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "point", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "point3d", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
@@ -58,4 +59,4 @@
{ "DataverseName": "Metadata", "DatatypeName": "string", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "time", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
{ "DataverseName": "Metadata", "DatatypeName": "uuid", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
-{ "DataverseName": "Metadata", "DatatypeName": "year-month-duration", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
\ No newline at end of file
+{ "DataverseName": "Metadata", "DatatypeName": "year-month-duration", "Derived": null, "Timestamp": "Thu Dec 17 12:12:59 PST 2015" }
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries/semistructured/has-param1/has-param1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/semistructured/has-param1/has-param1.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/semistructured/has-param1/has-param1.3.query.aql
index a4240fb..62f7690 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/semistructured/has-param1/has-param1.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/semistructured/has-param1/has-param1.3.query.aql
@@ -20,6 +20,6 @@ use dataverse test;
set import-private-functions 'true';
for $o in dataset('Orders')
-where not(is-null($o.param1))
-order by $o.oid
+where not(is-missing($o.param1))
+order by $o.oid
return $o
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/array/array.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/array/array.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/array/array.1.query.sqlpp
new file mode 100644
index 0000000..dc01561
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/array/array.1.query.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+[1, null, missing];
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/boolean/boolean.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/boolean/boolean.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/boolean/boolean.1.query.sqlpp
new file mode 100644
index 0000000..ccb7d66
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/boolean/boolean.1.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+{
+ '1': null and missing,
+ '2': null or missing,
+ '3': null and true,
+ '4': null and false,
+ '5': missing and true,
+ '6': missing and false,
+ '7': null or true,
+ '8': null or false,
+ '9': missing or true,
+ '10': missing or false,
+ '11': null and null,
+ '12': null or null,
+ '13': missing and missing,
+ '14': missing or missing,
+ '15': true and false,
+ '16': true or false
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/ceil/ceil.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/ceil/ceil.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/ceil/ceil.1.query.sqlpp
new file mode 100644
index 0000000..4896197
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/ceil/ceil.1.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+{
+ 'null': CEIL(null),
+ 'missing': CEIL(missing)
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/field-access/field-access.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/field-access/field-access.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/field-access/field-access.1.query.sqlpp
new file mode 100644
index 0000000..9658700
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/field-access/field-access.1.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+{
+ 'null': {'a': null}.a,
+ 'missing': {'b': missing}.b
+};
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/length/length.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/length/length.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/length/length.1.query.sqlpp
new file mode 100644
index 0000000..7f8615a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/length/length.1.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+{
+ 'null': LENGTH(null),
+ 'missing': LENGTH(missing)
+};
\ No newline at end of file