>From Shahrzad Shirazi <[email protected]>:

Shahrzad Shirazi has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20995?usp=email )


Change subject: WIP: Maybe new hash-based OR
......................................................................

WIP: Maybe new hash-based OR

Change-Id: Ia875c1ddab3649c6e6f1ff2ebb9725de78b2a7df
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
M 
asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
M 
asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/GeoFunctionTypeInferers.java
M 
asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/AbstractFilterBuilder.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionTypeInferer.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptor.java
A 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptorFactory.java
A 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashBasedOrEval.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
M 
hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
12 files changed, 442 insertions(+), 65 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/95/20995/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
index b8685d5..71cc676 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
@@ -206,7 +206,7 @@
         IFunctionTypeInferer fnTypeInfer = 
functionManager.lookupFunctionTypeInferer(fnId);
         if (fnTypeInfer != null) {
             CompilerProperties compilerProps = ((IApplicationContext) 
context.getAppContext()).getCompilerProperties();
-            fnTypeInfer.infer(expr, fd, env, compilerProps);
+            fnTypeInfer.infer(expr, fd, env, compilerProps, 
context.getMetadataProvider());
         }
         return fd;
     }
diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
index 1c338d3..ed3b213 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/RuleCollections.java
@@ -55,7 +55,6 @@
 import org.apache.asterix.optimizer.rules.FixReplicateOperatorOutputsRule;
 import 
org.apache.asterix.optimizer.rules.FullTextContainsParameterCheckAndSetRule;
 import org.apache.asterix.optimizer.rules.FuzzyEqRule;
-import org.apache.asterix.optimizer.rules.HashBasedOrRule;
 import 
org.apache.asterix.optimizer.rules.InjectTypeCastForFunctionArgumentsRule;
 import org.apache.asterix.optimizer.rules.InjectTypeCastForUnionRule;
 import org.apache.asterix.optimizer.rules.InlineUnnestFunctionRule;
@@ -470,7 +469,7 @@
         prepareForJobGenRewrites.add(new EnsureColumnarSupportedTypesRule());
         // EmbedProjectRule should run last. The assumption is that this rules 
set will run once
         prepareForJobGenRewrites.add(new EmbedProjectRule());
-        prepareForJobGenRewrites.add(new HashBasedOrRule());
+        //prepareForJobGenRewrites.add(new HashBasedOrRule());
         return prepareForJobGenRewrites;
     }
 }
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
index af26da5..c5571a4 100755
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
@@ -36,7 +36,7 @@
             IVariableTypeEnvironment inputTypeEnv, JobGenContext context) 
throws AlgebricksException {
         IExternalFunctionDescriptor fd = 
getExternalFunctionDescriptor((IExternalFunctionInfo) expr.getFunctionInfo());
         CompilerProperties props = ((IApplicationContext) 
context.getAppContext()).getCompilerProperties();
-        FunctionTypeInferers.SET_ARGUMENTS_TYPE.infer(expr, fd, inputTypeEnv, 
props);
+        FunctionTypeInferers.SET_ARGUMENTS_TYPE.infer(expr, fd, inputTypeEnv, 
props, context.getMetadataProvider());
         fd.setSourceLocation(expr.getSourceLocation());
         return fd;
     }
diff --git 
a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/GeoFunctionTypeInferers.java
 
b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/GeoFunctionTypeInferers.java
index f609beb..db6615c 100644
--- 
a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/GeoFunctionTypeInferers.java
+++ 
b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/GeoFunctionTypeInferers.java
@@ -29,6 +29,7 @@
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;

 public class GeoFunctionTypeInferers {
     private GeoFunctionTypeInferers() {
@@ -37,7 +38,7 @@
     public static final class GeometryConstructorTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             IAType t = (IAType) 
context.getType(fce.getArguments().get(0).getValue());
             ATypeTag typeTag = t.getTypeTag();
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/AbstractFilterBuilder.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/AbstractFilterBuilder.java
index f41a116..39e78d2 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/AbstractFilterBuilder.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/AbstractFilterBuilder.java
@@ -110,7 +110,7 @@
         IFunctionTypeInferer fnTypeInfer = 
functionManager.lookupFunctionTypeInferer(fnId);
         if (fnTypeInfer != null) {
             CompilerProperties compilerProps = ((IApplicationContext) 
context.getAppContext()).getCompilerProperties();
-            fnTypeInfer.infer(funcExpr, fd, typeEnv, compilerProps);
+            fnTypeInfer.infer(funcExpr, fd, typeEnv, compilerProps, 
context.getMetadataProvider());
         }
         return fd;
     }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionTypeInferer.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionTypeInferer.java
index 97042e2..5a1123e 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionTypeInferer.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionTypeInferer.java
@@ -23,8 +23,9 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;

 public interface IFunctionTypeInferer {
     void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-            CompilerProperties compilerProps) throws AlgebricksException;
+            CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException;
 }
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptor.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptor.java
index e9cd97b..dabc6b3 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptor.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptor.java
@@ -20,19 +20,13 @@
 package org.apache.asterix.runtime.evaluators.comparisons;

 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.common.ILogicalBinaryComparator.Result;
-import org.apache.asterix.om.base.ABoolean;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.functions.IFunctionTypeInferer;
 import org.apache.asterix.runtime.functions.FunctionTypeInferers;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IEvaluatorContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;

 @MissingNullInOutFunction
 public class EqualsDescriptor extends AbstractComparisonDescriptor {
@@ -57,29 +51,8 @@

     @Override
     public IScalarEvaluatorFactory 
createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
-        return new IScalarEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
+        return new EqualsDescriptorFactory(args[0], leftType, args[1], 
rightType, sourceLoc);

-            @Override
-            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext 
ctx) throws HyracksDataException {
-                return new AbstractValueComparisonEvaluator(args[0], leftType, 
args[1], rightType, ctx, sourceLoc,
-                        true) {
-
-                    @Override
-                    protected boolean getComparisonResult(Result r) {
-                        return r == Result.EQ;
-                    }
-
-                    @Override
-                    protected void handleIncomparable(IPointable result) 
throws HyracksDataException {
-                        resultStorage.reset();
-                        serde.serialize(ABoolean.FALSE, out);
-                        result.set(resultStorage);
-                    }
-                };
-            }
-
-        };
     }
 
 }
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptorFactory.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptorFactory.java
new file mode 100644
index 0000000..db6c41a
--- /dev/null
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/EqualsDescriptorFactory.java
@@ -0,0 +1,96 @@
+/*
+ * 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.evaluators.comparisons;
+
+import org.apache.asterix.dataflow.data.common.ILogicalBinaryComparator.Result;
+import org.apache.asterix.om.base.ABoolean;
+import org.apache.asterix.om.types.IAType;
+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.IEvaluatorContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class EqualsDescriptorFactory implements IScalarEvaluatorFactory {
+    private static final long serialVersionUID = 1L;
+
+    private final IScalarEvaluatorFactory leftEvalFactory;
+    private final IScalarEvaluatorFactory rightEvalFactory;
+    private final IAType leftType;
+    private final IAType rightType;
+    private final SourceLocation sourceLoc;
+    private final boolean leftIsConstant;
+    private final boolean rightIsConstant;
+
+    public EqualsDescriptorFactory(IScalarEvaluatorFactory leftEvalFactory, 
IAType leftType,
+            IScalarEvaluatorFactory rightEvalFactory, IAType rightType, 
SourceLocation sourceLoc) {
+        this.leftEvalFactory = leftEvalFactory;
+        this.leftType = leftType;
+        this.rightEvalFactory = rightEvalFactory;
+        this.rightType = rightType;
+        this.sourceLoc = sourceLoc;
+        this.leftIsConstant = leftEvalFactory instanceof ConstantEvalFactory;
+        this.rightIsConstant = rightEvalFactory instanceof ConstantEvalFactory;
+    }
+
+    public IScalarEvaluatorFactory getConstantFactory() {
+        return leftIsConstant ? leftEvalFactory : rightIsConstant ? 
rightEvalFactory : null;
+    }
+
+    public IScalarEvaluatorFactory getExpressionFactory() {
+        return leftIsConstant ? rightEvalFactory : leftEvalFactory;
+    }
+
+    public IAType getConstantType() {
+        return leftIsConstant ? leftType : rightIsConstant ? rightType : null;
+    }
+
+    public IAType getExpressionType() {
+        return leftIsConstant ? rightType : leftType;
+    }
+
+    public boolean isLeftConstant() {
+        return leftIsConstant;
+    }
+
+    public boolean isRightConstant() {
+        return rightIsConstant;
+    }
+
+    @Override
+    public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) 
throws HyracksDataException {
+        return new AbstractValueComparisonEvaluator(leftEvalFactory, leftType, 
rightEvalFactory, rightType, ctx,
+                sourceLoc, true) {
+
+            @Override
+            protected boolean getComparisonResult(Result r) {
+                return r == Result.EQ;
+            }
+
+            @Override
+            protected void handleIncomparable(IPointable result) throws 
HyracksDataException {
+                resultStorage.reset();
+                serde.serialize(ABoolean.FALSE, out);
+                result.set(resultStorage);
+            }
+        };
+    }
+}
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashBasedOrEval.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashBasedOrEval.java
new file mode 100644
index 0000000..2988c99
--- /dev/null
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashBasedOrEval.java
@@ -0,0 +1,160 @@
+/*
+ * 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.evaluators.functions;
+
+import java.io.DataOutput;
+
+import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider;
+import org.apache.asterix.formats.nontagged.BinaryHashFunctionFactoryProvider;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ABoolean;
+import org.apache.asterix.om.base.AMissing;
+import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.IAType;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import 
org.apache.asterix.runtime.evaluators.comparisons.EqualsDescriptorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IEvaluatorContext;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
+import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.BinaryEntry;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+class HashBasedOrEval implements IScalarEvaluator {
+
+    private static final byte[] DUMMY_VALUE = new byte[] { 0 };
+
+    /** Same defaults as RecordAddFieldsDescriptor for BinaryHashMap. */
+    private static final int TABLE_SIZE = 100;
+    private static final int TABLE_FRAME_SIZE = 32768;
+
+    private final ArrayBackedValueStorage resultStorage = new 
ArrayBackedValueStorage();
+    private final DataOutput output = resultStorage.getDataOutput();
+    private final VoidPointable valuePtr = new VoidPointable();
+    private final VoidPointable constPtr = new VoidPointable();
+    private final BinaryEntry keyEntry = new BinaryEntry();
+    private final BinaryEntry valEntry = new BinaryEntry();
+    private final BinaryHashMap valueSet;
+
+    private final IBinaryHashFunction putHashFunc;
+    private final IBinaryHashFunction getHashFunc;
+    private final IBinaryComparator cmp;
+    private final IAType elementType;
+
+    private final IScalarEvaluator fieldEval;
+    private final IScalarEvaluator[] constEvals;
+    private final int numConst;
+    private boolean setBuilt = false;
+
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ABoolean> booleanSerde =
+            
SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ABOOLEAN);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ANull> nullSerde =
+            
SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ANULL);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AMissing> missingSerde =
+            
SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AMISSING);
+
+    HashBasedOrEval(IAType elementType, IEvaluatorContext ctx, 
IScalarEvaluatorFactory[] args)
+            throws HyracksDataException {
+        this.elementType = elementType;
+        this.numConst = args.length;
+
+        EqualsDescriptorFactory firstEqFactory = (EqualsDescriptorFactory) 
args[0];
+        fieldEval = 
firstEqFactory.getExpressionFactory().createScalarEvaluator(ctx);
+
+        constEvals = new IScalarEvaluator[numConst];
+        for (int i = 0; i < numConst; i++) {
+            EqualsDescriptorFactory eqFactory = (EqualsDescriptorFactory) 
args[i];
+            constEvals[i] = 
eqFactory.getConstantFactory().createScalarEvaluator(ctx);
+        }
+        putHashFunc = 
BinaryHashFunctionFactoryProvider.INSTANCE.getBinaryHashFunctionFactory(elementType)
+                .createBinaryHashFunction();
+        getHashFunc = 
BinaryHashFunctionFactoryProvider.INSTANCE.getBinaryHashFunctionFactory(elementType)
+                .createBinaryHashFunction();
+        cmp = 
BinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(elementType,
 true)
+                .createBinaryComparator();
+
+        valueSet = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, 
putHashFunc, getHashFunc, cmp);
+
+    }
+
+    @Override
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws 
HyracksDataException {
+        resultStorage.reset();
+        buildSetIfNeeded(tuple);
+
+        fieldEval.evaluate(tuple, valuePtr);
+        byte[] data = valuePtr.getByteArray();
+        int offset = valuePtr.getStartOffset();
+
+        if (data[offset] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+            missingSerde.serialize(AMissing.MISSING, output);
+            result.set(resultStorage);
+            return;
+        }
+        if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            nullSerde.serialize(ANull.NULL, output);
+            result.set(resultStorage);
+            return;
+        }
+        if 
(!ATypeHierarchy.isCompatible(EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]),
+                elementType.getTypeTag())) {
+            booleanSerde.serialize(ABoolean.FALSE, output);
+            result.set(resultStorage);
+            return;
+        }
+
+        keyEntry.set(data, offset, valuePtr.getLength());
+        BinaryEntry found = valueSet.get(keyEntry);
+        if (found == null) {
+            booleanSerde.serialize(ABoolean.FALSE, output);
+        } else {
+            booleanSerde.serialize(ABoolean.TRUE, output);
+        }
+        result.set(resultStorage);
+    }
+
+    private void buildSetIfNeeded(IFrameTupleReference tuple) throws 
HyracksDataException {
+        if (setBuilt) {
+            return;
+        }
+        valEntry.set(DUMMY_VALUE, 0, 1);
+        for (int i = 0; i < numConst; i++) {
+            constEvals[i].evaluate(tuple, constPtr);
+            byte[] data = constPtr.getByteArray();
+            int offset = constPtr.getStartOffset();
+            if (offset < data.length) {
+                keyEntry.set(data, offset, constPtr.getLength());
+                valueSet.put(keyEntry, valEntry);
+            }
+        }
+        setBuilt = true;
+    }
+}
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
index a931aeb..3b7988e 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;

+import static 
org.apache.asterix.runtime.functions.FunctionTypeInferers.SET_OR_TYPE;
+
 import java.io.DataOutput;

 import 
org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
@@ -26,9 +28,12 @@
 import org.apache.asterix.om.base.AMissing;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.om.functions.IFunctionTypeInferer;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.IAType;
 import 
org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -43,8 +48,22 @@
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;

 public class OrDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = OrDescriptor::new;
+
+    public static final IFunctionDescriptorFactory FACTORY = new 
IFunctionDescriptorFactory() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new OrDescriptor();
+        }
+
+        @Override
+        public IFunctionTypeInferer createFunctionTypeInferer() {
+            return SET_OR_TYPE;
+        }
+    };
+
+    protected IAType elementType;

     @Override
     public FunctionIdentifier getIdentifier() {
@@ -52,12 +71,20 @@
     }

     @Override
+    public void setImmutableStates(Object... types) {
+        elementType = (IAType) types[0];
+    }
+
+    @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final 
IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;

             @Override
             public IScalarEvaluator createScalarEvaluator(final 
IEvaluatorContext ctx) throws HyracksDataException {
+                if (elementType != null) {
+                    return new HashBasedOrEval(elementType, ctx, args);
+                }
                 final IPointable argPtr = new VoidPointable();
                 final IScalarEvaluator[] evals = new 
IScalarEvaluator[args.length];
                 for (int i = 0; i < evals.length; i++) {
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
index 2b67fd9..e075a70 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
@@ -38,15 +38,22 @@
 import org.apache.asterix.om.types.AUnionType;
 import org.apache.asterix.om.types.AbstractCollectionType;
 import org.apache.asterix.om.types.IAType;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.om.utils.ConstantExpressionUtil;
 import org.apache.asterix.om.utils.RecordUtil;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import org.apache.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import 
org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
+import 
org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
+import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+import org.apache.hyracks.algebricks.core.config.AlgebricksConfig;

 /**
  * Implementations of {@link IFunctionTypeInferer} for built-in functions
@@ -59,7 +66,7 @@
     public static final IFunctionTypeInferer SET_EXPRESSION_TYPE = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             fd.setImmutableStates(context.getType(expr));
         }
     };
@@ -67,7 +74,7 @@
     public static final IFunctionTypeInferer SET_ARGUMENT_TYPE = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             IAType t = (IAType) 
context.getType(fce.getArguments().get(0).getValue());
             fd.setImmutableStates(TypeComputeUtils.getActualType(t));
@@ -78,7 +85,7 @@
     public static final IFunctionTypeInferer SET_ARGUMENTS_TYPE = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             fd.setImmutableStates((Object[]) getArgumentsTypes(fce, context));
         }
@@ -87,7 +94,7 @@
     public static final IFunctionTypeInferer SET_SORTING_PARAMETERS = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment ctx,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             // sets the type of the input range map produced by the local 
sampling expression and types of sort fields
             AbstractFunctionCallExpression funExp = 
(AbstractFunctionCallExpression) expr;
             Object[] sortingParameters = funExp.getOpaqueParameters();
@@ -98,7 +105,7 @@
     public static final IFunctionTypeInferer SET_NUM_SAMPLES = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression funCallExpr = 
(AbstractFunctionCallExpression) expr;
             Object[] samplingParameters = funCallExpr.getOpaqueParameters();
             fd.setImmutableStates(samplingParameters[0]);
@@ -108,7 +115,7 @@
     public static final IFunctionTypeInferer LISTIFY_INFERER = new 
IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression listifyExpression = 
(AbstractFunctionCallExpression) expr;
             IAType outputListType = (IAType) 
context.getType(listifyExpression);
             IAType itemType = (IAType) 
context.getType(listifyExpression.getArguments().get(0).getValue());
@@ -116,29 +123,140 @@
         }
     };

-    public static final IFunctionTypeInferer SET_OR_TYPES = (expr, fd, 
context, compilerProps) -> {
+    public static final IFunctionTypeInferer SET_OR_TYPES = (expr, fd, 
context, compilerProps, metadataProvider) -> {
         AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) 
expr;
         IAType elementType = (IAType) 
context.getType(fce.getArguments().get(1).getValue());
         fd.setImmutableStates(TypeComputeUtils.getActualType(elementType));
     };

-    public static final IFunctionTypeInferer MEDIAN_MEMORY =
-            (expr, fd, context, compilerProps) -> 
fd.setImmutableStates(compilerProps.getSortMemoryFrames());
+    public static final IFunctionTypeInferer MEDIAN_MEMORY = (expr, fd, 
context, compilerProps, metadataProvider) -> fd
+            .setImmutableStates(compilerProps.getSortMemoryFrames());

-    public static final IFunctionTypeInferer RECORD_MODIFY_INFERER = (expr, 
fd, context, compilerProps) -> {
-        AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) 
expr;
-        IAType outType = (IAType) context.getType(expr);
-        IAType inType = (IAType) 
context.getType(f.getArguments().get(0).getValue());
-        if (inType.getTypeTag().equals(ATypeTag.ANY)) {
-            inType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
+    public static final IFunctionTypeInferer RECORD_MODIFY_INFERER =
+            (expr, fd, context, compilerProps, metadataProvider) -> {
+                AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
+                IAType outType = (IAType) context.getType(expr);
+                IAType inType = (IAType) 
context.getType(f.getArguments().get(0).getValue());
+                if (inType.getTypeTag().equals(ATypeTag.ANY)) {
+                    inType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
+                }
+                fd.setImmutableStates(outType, inType);
+            };
+    public static final IFunctionTypeInferer SET_OR_TYPE = new 
IFunctionTypeInferer() {
+        @Override
+        public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
+            Object hashBasedOption = 
mp.getConfig().get(AlgebricksConfig.HASH_BASED_OR_OPTION);
+            boolean hashBasedOrEnabled = 
AlgebricksConfig.HASH_BASED_OR_OPTION_DEFAULT;
+            if (hashBasedOption != null) {
+                hashBasedOrEnabled = 
Boolean.parseBoolean(String.valueOf(hashBasedOption));
+            }
+            if (!hashBasedOrEnabled) {
+                return;
+            }
+            AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
+            IAType elementType = useHashBased(fce);
+            if (elementType != null) {
+                fd.setImmutableStates((Object[]) new IAType[] { elementType });
+            }
         }
-        fd.setImmutableStates(outType, inType);
     };

+    private static IAType useHashBased(AbstractFunctionCallExpression 
funcExpr) {
+        List<Mutable<ILogicalExpression>> orArgs = funcExpr.getArguments();
+        if (orArgs.size() < 2) {
+            return null;
+        }
+        LogicalVariable commonVar = null;
+        AbstractFunctionCallExpression commonFunExpr = null;
+        IAType type = null;
+        boolean usesVar = false;
+        boolean usesFun = false;
+
+        for (Mutable<ILogicalExpression> arg : orArgs) {
+            ILogicalExpression argExpr = arg.getValue();
+            if (!apply(argExpr)) {
+                return null;
+            }
+
+            AbstractFunctionCallExpression eqExpr = 
(AbstractFunctionCallExpression) argExpr;
+            List<Mutable<ILogicalExpression>> eqArgs = eqExpr.getArguments();
+            ILogicalExpression left = eqArgs.get(0).getValue();
+            ILogicalExpression right = eqArgs.get(1).getValue();
+
+            ConstantExpression constExpr;
+            VariableReferenceExpression varExpr = null;
+            AbstractFunctionCallExpression currentFunExpr = null;
+
+            if (left.getExpressionTag() == LogicalExpressionTag.VARIABLE
+                    && right.getExpressionTag() == 
LogicalExpressionTag.CONSTANT) {
+                varExpr = (VariableReferenceExpression) left;
+                constExpr = (ConstantExpression) right;
+            } else if (right.getExpressionTag() == 
LogicalExpressionTag.VARIABLE
+                    && left.getExpressionTag() == 
LogicalExpressionTag.CONSTANT) {
+                varExpr = (VariableReferenceExpression) right;
+                constExpr = (ConstantExpression) left;
+            } else if (left.getExpressionTag() == 
LogicalExpressionTag.FUNCTION_CALL
+                    && right.getExpressionTag() == 
LogicalExpressionTag.CONSTANT) {
+                currentFunExpr = (AbstractFunctionCallExpression) left;
+                constExpr = (ConstantExpression) right;
+            } else if (right.getExpressionTag() == 
LogicalExpressionTag.FUNCTION_CALL
+                    && left.getExpressionTag() == 
LogicalExpressionTag.CONSTANT) {
+                currentFunExpr = (AbstractFunctionCallExpression) right;
+                constExpr = (ConstantExpression) left;
+            } else {
+                return null;
+            }
+
+            if (type == null) {
+                type = ((AsterixConstantValue) 
constExpr.getValue()).getObject().getType();
+            } else if (!ATypeHierarchy.isCompatible(type.getTypeTag(),
+                    ((AsterixConstantValue) 
constExpr.getValue()).getObject().getType().getTypeTag())) {
+                return null;
+            }
+
+            if (varExpr != null) {
+                if (usesFun) {
+                    return null;
+                }
+                usesVar = true;
+                LogicalVariable var = varExpr.getVariableReference();
+                if (commonVar == null) {
+                    commonVar = var;
+                } else if (!commonVar.equals(var)) {
+                    return null;
+                }
+            } else {
+                if (usesVar) {
+                    return null;
+                }
+                usesFun = true;
+                if (commonFunExpr == null) {
+                    commonFunExpr = currentFunExpr;
+                } else if (!commonFunExpr.equals(currentFunExpr)) {
+                    return null;
+                }
+            }
+        }
+
+        if (!usesVar && !usesFun) {
+            return null;
+        }
+        return type;
+
+    }
+
+    private static boolean apply(ILogicalExpression argExpr) {
+        return argExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL
+                && ((AbstractFunctionCallExpression) 
argExpr).getFunctionIdentifier()
+                        .equals(AlgebricksBuiltinFunctions.EQ)
+                && ((AbstractFunctionCallExpression) 
argExpr).getArguments().size() == 2;
+    }
+
     public static final class CastTypeInferer implements IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression funcExpr = 
(AbstractFunctionCallExpression) expr;
             IAType reqType = TypeCastUtils.getRequiredType(funcExpr);
             IAType inputType = (IAType) 
context.getType(funcExpr.getArguments().get(0).getValue());
@@ -156,7 +274,7 @@
     public static final class DeepEqualityTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             IAType type0 = (IAType) 
context.getType(f.getArguments().get(0).getValue());
             IAType type1 = (IAType) 
context.getType(f.getArguments().get(1).getValue());
@@ -167,7 +285,7 @@
     public static final class FieldAccessByIndexTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             IAType t = (IAType) 
context.getType(fce.getArguments().get(0).getValue());
             switch (t.getTypeTag()) {
@@ -190,7 +308,7 @@
     public static final class FieldAccessNestedTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             // arg 1 should always be a constant array of strings
             AOrderedList fieldPath =
@@ -226,7 +344,7 @@

         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression fce = 
(AbstractFunctionCallExpression) expr;
             IAType t = TypeComputeUtils.getActualType((IAType) 
context.getType(fce.getArguments().get(0).getValue()));
             ATypeTag typeTag = t.getTypeTag();
@@ -251,7 +369,7 @@
     public static final class OpenRecordConstructorTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             ARecordType rt = (ARecordType) context.getType(expr);
             fd.setImmutableStates(rt, 
computeOpenFields((AbstractFunctionCallExpression) expr, rt));
         }
@@ -280,7 +398,7 @@
     public static final class RecordAddFieldsTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             IAType outType = (IAType) context.getType(expr);
             IAType type0 = (IAType) 
context.getType(f.getArguments().get(0).getValue());
@@ -299,7 +417,7 @@
     public static final class RecordMergeTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             IAType outType = (IAType) context.getType(expr);
             IAType type0 = (IAType) 
context.getType(f.getArguments().get(0).getValue());
@@ -311,7 +429,7 @@
     public static final class RecordRemoveFieldsTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             IAType outType = (IAType) context.getType(expr);
             IAType type0 = (IAType) 
context.getType(f.getArguments().get(0).getValue());
@@ -332,7 +450,7 @@
     public static final class RecordConcatTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             List<Mutable<ILogicalExpression>> args = f.getArguments();
             int n = args.size();
@@ -371,7 +489,7 @@
     public static final class FullTextContainsTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression funcExpr = 
(AbstractFunctionCallExpression) expr;
             // get the full-text config evaluator from the expr which is set 
in FullTextContainsParameterCheckAndSetRule
             fd.setImmutableStates(funcExpr.getOpaqueParameters()[0]);
@@ -381,7 +499,7 @@
     public static final class PutAutogeneratedKeyTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             IAType outType = (IAType) context.getType(expr);
             IAType incRecType = (IAType) 
context.getType(f.getArguments().get(0).getValue());
@@ -403,7 +521,7 @@
     public static final class ToObjectVarStrTypeInferer implements 
IFunctionTypeInferer {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, 
IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) throws AlgebricksException {
+                CompilerProperties compilerProps, IMetadataProvider<?, ?> mp) 
throws AlgebricksException {
             AbstractFunctionCallExpression f = 
(AbstractFunctionCallExpression) expr;
             List<Mutable<ILogicalExpression>> args = f.getArguments();
             fd.setImmutableStates(context.getType(expr),
diff --git 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
index b8002db..5aab406 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/config/AlgebricksConfig.java
@@ -49,4 +49,6 @@
     public static final boolean COLUMN_FILTER_DEFAULT = true;
     public static final boolean ORDERED_FIELDS = true;
     public static final int MAX_VARIABLE_OCCURRENCES_INLINING_DEFAULT = 128;
+    public static final String HASH_BASED_OR_OPTION = "hash_based_or";
+    public static final boolean HASH_BASED_OR_OPTION_DEFAULT = false;
 }

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20995?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: phoenix
Gerrit-Change-Id: Ia875c1ddab3649c6e6f1ff2ebb9725de78b2a7df
Gerrit-Change-Number: 20995
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi <[email protected]>

Reply via email to