Remove tinyaccessor dependency from production.
Change-Id: Ib2dfb36b59ba4a77884c30c2b11c2a846c4890fa
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1459
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
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 dc9ff17..d14b8e2 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
@@ -197,7 +197,7 @@
import org.apache.asterix.runtime.evaluators.functions.NumericTruncDescriptor;
import org.apache.asterix.runtime.evaluators.functions.NumericUnaryMinusDescriptor;
import org.apache.asterix.runtime.evaluators.functions.OrDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.OrderedListConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.OrderedListConstructorDescriptor;
import org.apache.asterix.runtime.evaluators.functions.PrefixLenJaccardDescriptor;
import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardCheckDescriptor;
import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardDescriptor;
@@ -244,7 +244,7 @@
import org.apache.asterix.runtime.evaluators.functions.SubstringDescriptor;
import org.apache.asterix.runtime.evaluators.functions.SwitchCaseDescriptor;
import org.apache.asterix.runtime.evaluators.functions.UUIDDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.UnorderedListConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.UnorderedListConstructorDescriptor;
import org.apache.asterix.runtime.evaluators.functions.WordTokensDescriptor;
import org.apache.asterix.runtime.evaluators.functions.binary.BinaryConcatDescriptor;
import org.apache.asterix.runtime.evaluators.functions.binary.BinaryLengthDescriptor;
diff --git a/asterixdb/asterix-app/pom.xml b/asterixdb/asterix-app/pom.xml
index d4a9e5f..b6e6be1 100644
--- a/asterixdb/asterix-app/pom.xml
+++ b/asterixdb/asterix-app/pom.xml
@@ -303,6 +303,7 @@
<groupId>com.e-movimento.tinytools</groupId>
<artifactId>privilegedaccessor</artifactId>
<version>1.2.2</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
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 78e0679..c362e2e 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
@@ -402,7 +402,7 @@
protected AlgebricksMetaOperatorDescriptor createCastOp(JobSpecification spec, DatasetType dsType) {
CastTypeDescriptor castFuncDesc = (CastTypeDescriptor) CastTypeDescriptor.FACTORY.createFunctionDescriptor();
- castFuncDesc.reset(enforcedItemType, itemType);
+ castFuncDesc.setImmutableStates(enforcedItemType, itemType);
int[] outColumns = new int[1];
int[] projectionList = new int[(dataset.hasMetaPart() ? 2 : 1) + numPrimaryKeys];
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
index 322adda..d9bb73a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
@@ -30,22 +30,26 @@
import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
public interface IFunctionDescriptor extends Serializable {
- public FunctionIdentifier getIdentifier();
- public FunctionDescriptorTag getFunctionDescriptorTag();
+ default void setImmutableStates(Object... states) {
+ }
- public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException;
+ FunctionIdentifier getIdentifier();
- public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+ FunctionDescriptorTag getFunctionDescriptorTag();
+
+ IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException;
+
+ IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
- public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+ ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
final IScalarEvaluatorFactory[] args) throws AlgebricksException;
- public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+ IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
- public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+ IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
throws AlgebricksException;
}
diff --git a/asterixdb/asterix-runtime/pom.xml b/asterixdb/asterix-runtime/pom.xml
index 4d33485..4500bfc 100644
--- a/asterixdb/asterix-runtime/pom.xml
+++ b/asterixdb/asterix-runtime/pom.xml
@@ -137,11 +137,6 @@
<version>5.1</version>
</dependency>
<dependency>
- <groupId>com.e-movimento.tinytools</groupId>
- <artifactId>privilegedaccessor</artifactId>
- <version>1.2.2</version>
- </dependency>
- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
index 54f598d..f117d14 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
@@ -39,8 +39,9 @@
private AOrderedListType oltype;
- public void reset(AOrderedListType orderedListType) {
- this.oltype = orderedListType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.oltype = (AOrderedListType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
index 57d50fd..5cac892 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
@@ -39,8 +39,9 @@
private ARecordType recType;
- public void reset(ARecordType recType) {
- this.recType = recType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
index 24cb5e3..0b26583 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
@@ -50,9 +50,10 @@
private ARecordType recType;
private boolean[] openFields;
- public void reset(ARecordType recType, boolean[] openFields) {
- this.recType = recType;
- this.openFields = openFields;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
+ this.openFields = (boolean[]) states[1];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OrderedListConstructorDescriptor.java
similarity index 95%
rename from asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
rename to asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OrderedListConstructorDescriptor.java
index a9cb442..977101a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OrderedListConstructorDescriptor.java
@@ -7,7 +7,7 @@
* "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
+ * 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
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.evaluators.functions;
+package org.apache.asterix.runtime.evaluators.constructors;
import java.io.DataOutput;
import java.io.IOException;
@@ -50,8 +50,9 @@
private AOrderedListType oltype;
- public void reset(AOrderedListType orderedListType) {
- this.oltype = orderedListType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.oltype = (AOrderedListType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/UnorderedListConstructorDescriptor.java
similarity index 95%
rename from asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
rename to asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/UnorderedListConstructorDescriptor.java
index 076a789..50b7699 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/UnorderedListConstructorDescriptor.java
@@ -7,7 +7,7 @@
* "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
+ * 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
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.runtime.evaluators.functions;
+package org.apache.asterix.runtime.evaluators.constructors;
import java.io.DataOutput;
import java.io.IOException;
@@ -25,6 +25,7 @@
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.types.AOrderedListType;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.AUnorderedListType;
import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
@@ -50,8 +51,9 @@
private AUnorderedListType ultype;
- public void reset(AUnorderedListType unorderedListType) {
- this.ultype = unorderedListType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.ultype = (AUnorderedListType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
index aa276cc..95eaac6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastTypeDescriptor.java
@@ -62,7 +62,10 @@
private CastTypeDescriptor() {
}
- public void reset(IAType reqType, IAType inputType) {
+ @Override
+ public void setImmutableStates(Object... states) {
+ reqType = (IAType) states[0];
+ inputType = (IAType) states[1];
// If reqType or inputType is null, or they are the same, it indicates there is a bug in the compiler.
if (reqType == null || inputType == null || reqType.equals(inputType)) {
throw new IllegalStateException(
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
index bb6efb8..150c28e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
@@ -54,11 +54,13 @@
private IAType inputTypeLeft;
private IAType inputTypeRight;
- public void reset(IAType inTypeLeft, IAType inTypeRight) {
- this.inputTypeLeft = inTypeLeft;
- this.inputTypeRight = inTypeRight;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.inputTypeLeft = (IAType) states[0];
+ this.inputTypeRight = (IAType) states[1];
}
+
@Override
public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
final IScalarEvaluatorFactory evalFactoryLeft = args[0];
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
index 859d8c3..7ce7dec 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
@@ -37,8 +37,9 @@
private ARecordType recType;
- public void reset(ARecordType recType) {
- this.recType = recType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
index cf8a781..95b06f7 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
@@ -40,9 +40,10 @@
private ARecordType recType;
private List<String> fldName;
- public void reset(ARecordType recType, List<String> fldName) {
- this.recType = recType;
- this.fldName = fldName;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
+ this.fldName = (List<String>) states[1];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
index 97d92fd..3419b68 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
@@ -37,8 +37,9 @@
private ARecordType recType;
- public void reset(ARecordType recType) {
- this.recType = recType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
index 98fc8ed..6205d77 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
@@ -37,8 +37,9 @@
private ARecordType recType;
- public void reset(ARecordType recType) {
- this.recType = recType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
index 5f2a730..8d4f8c2 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
@@ -74,10 +74,11 @@
private AOrderedListType inListType;
private IAType inputFieldListItemType;
- public void reset(IAType outType, IAType inType0, IAType inType1) {
- outRecType = TypeComputeUtils.extractRecordType(outType);
- inRecType = TypeComputeUtils.extractRecordType(inType0);
- inListType = TypeComputeUtils.extractOrderedListType(inType1);
+ @Override
+ public void setImmutableStates(Object... states) {
+ outRecType = TypeComputeUtils.extractRecordType((IAType) states[0]);
+ inRecType = TypeComputeUtils.extractRecordType((IAType) states[1]);
+ inListType = TypeComputeUtils.extractOrderedListType((IAType) states[2]);
inputFieldListItemType = inListType.getItemType();
if (inputFieldListItemType == null || inputFieldListItemType.getTypeTag() == ATypeTag.ANY) {
inputFieldListItemType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
index 7a1e69f..650581b 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
@@ -74,10 +74,11 @@
private ARecordType inRecType0;
private ARecordType inRecType1;
- public void reset(IAType outType, IAType inType0, IAType inType1) {
- outRecType = TypeComputeUtils.extractRecordType(outType);
- inRecType0 = TypeComputeUtils.extractRecordType(inType0);
- inRecType1 = TypeComputeUtils.extractRecordType(inType1);
+ @Override
+ public void setImmutableStates(Object... states) {
+ outRecType = TypeComputeUtils.extractRecordType((IAType) states[0]);
+ inRecType0 = TypeComputeUtils.extractRecordType((IAType) states[1]);
+ inRecType1 = TypeComputeUtils.extractRecordType((IAType) states[2]);
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPairsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPairsDescriptor.java
index 09b644a..8ecdca7 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPairsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPairsDescriptor.java
@@ -58,8 +58,9 @@
private static final long serialVersionUID = 1L;
private ARecordType recType;
- public void reset(ARecordType recType) {
- this.recType = recType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ this.recType = (ARecordType) states[0];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
index 8550a9b..092fbfb 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
@@ -44,10 +44,11 @@
private ARecordType inputRecType;
private AOrderedListType inputListType;
- public void reset(IAType outType, IAType inType, IAType inListType) {
- outputRecordType = (ARecordType) outType;
- inputRecType = (ARecordType) inType;
- inputListType = (AOrderedListType) inListType;
+ @Override
+ public void setImmutableStates(Object... states) {
+ outputRecordType = (ARecordType) states[0];
+ inputRecType = (ARecordType) states[1];
+ inputListType = (AOrderedListType) states[2];
}
@Override
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index 00a147c..ad43a48 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -55,20 +55,13 @@
import org.apache.asterix.om.functions.IFunctionManager;
import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
-import org.apache.asterix.om.types.AOrderedListType;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.AUnionType;
-import org.apache.asterix.om.types.AUnorderedListType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.util.ConstantExpressionUtil;
-import org.apache.asterix.runtime.aggregates.collections.ListifyAggregateDescriptor;
import org.apache.asterix.runtime.evaluators.common.CreateMBREvalFactory;
import org.apache.asterix.runtime.evaluators.common.FunctionManagerImpl;
-import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.OrderedListConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.UnorderedListConstructorDescriptor;
import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByIndexEvalFactory;
import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByNameDescriptor;
import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessNestedEvalFactory;
@@ -112,8 +105,6 @@
import org.apache.hyracks.dataflow.common.data.parsers.LongParserFactory;
import org.apache.hyracks.dataflow.common.data.parsers.UTF8StringParserFactory;
-import junit.extensions.PA;
-
public class NonTaggedDataFormat implements IDataFormat {
private static boolean registered = false;
@@ -372,7 +363,7 @@
@Override
public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
throws AlgebricksException {
- ((ListifyAggregateDescriptor) fd).reset((AOrderedListType) context.getType(expr));
+ fd.setImmutableStates(context.getType(expr));
}
});
functionTypeInferers.put(BuiltinFunctions.RECORD_MERGE, new FunctionTypeInferer() {
@@ -383,8 +374,7 @@
IAType outType = (IAType) context.getType(expr);
IAType type0 = (IAType) context.getType(f.getArguments().get(0).getValue());
IAType type1 = (IAType) context.getType(f.getArguments().get(1).getValue());
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType, "
- + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
+ fd.setImmutableStates(outType, type0, type1);
}
});
@@ -396,8 +386,7 @@
AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expr;
IAType type0 = (IAType) context.getType(f.getArguments().get(0).getValue());
IAType type1 = (IAType) context.getType(f.getArguments().get(1).getValue());
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType)",
- type0, type1);
+ fd.setImmutableStates(type0, type1);
}
});
@@ -417,8 +406,7 @@
if (type1.getTypeTag().equals(ATypeTag.ANY)) {
type1 = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
}
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType,"
- + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
+ fd.setImmutableStates(outType, type0, type1);
}
});
@@ -438,8 +426,7 @@
if (type1.getTypeTag().equals(ATypeTag.ANY)) {
type1 = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
}
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType,"
- + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
+ fd.setImmutableStates(outType, type0, type1);
}
});
functionTypeInferers.put(BuiltinFunctions.CAST_TYPE, new FunctionTypeInferer() {
@@ -449,8 +436,7 @@
AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
IAType rt = TypeCastUtils.getRequiredType(funcExpr);
IAType it = (IAType) context.getType(funcExpr.getArguments().get(0).getValue());
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType)", rt,
- it);
+ fd.setImmutableStates(rt, it);
}
});
functionTypeInferers.put(BuiltinFunctions.OPEN_RECORD_CONSTRUCTOR, new FunctionTypeInferer() {
@@ -458,8 +444,7 @@
public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
throws AlgebricksException {
ARecordType rt = (ARecordType) context.getType(expr);
- ((OpenRecordConstructorDescriptor) fd).reset(rt,
- computeOpenFields((AbstractFunctionCallExpression) expr, rt));
+ fd.setImmutableStates(rt, computeOpenFields((AbstractFunctionCallExpression) expr, rt));
}
private boolean[] computeOpenFields(AbstractFunctionCallExpression expr, ARecordType recType) {
@@ -486,21 +471,21 @@
@Override
public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
throws AlgebricksException {
- ((ClosedRecordConstructorDescriptor) fd).reset((ARecordType) context.getType(expr));
+ fd.setImmutableStates(context.getType(expr));
}
});
functionTypeInferers.put(BuiltinFunctions.ORDERED_LIST_CONSTRUCTOR, new FunctionTypeInferer() {
@Override
public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
throws AlgebricksException {
- ((OrderedListConstructorDescriptor) fd).reset((AOrderedListType) context.getType(expr));
+ fd.setImmutableStates(context.getType(expr));
}
});
functionTypeInferers.put(BuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR, new FunctionTypeInferer() {
@Override
public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
throws AlgebricksException {
- ((UnorderedListConstructorDescriptor) fd).reset((AUnorderedListType) context.getType(expr));
+ fd.setImmutableStates(context.getType(expr));
}
});
functionTypeInferers.put(BuiltinFunctions.FIELD_ACCESS_BY_INDEX, new FunctionTypeInferer() {
@@ -511,8 +496,7 @@
IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
switch (t.getTypeTag()) {
case RECORD: {
- ARecordType recType = (ARecordType) t;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
+ fd.setImmutableStates(t);
break;
}
case UNION: {
@@ -520,8 +504,7 @@
if (unionT.isUnknownableType()) {
IAType t2 = unionT.getActualType();
if (t2.getTypeTag() == ATypeTag.RECORD) {
- ARecordType recType = (ARecordType) t2;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
+ fd.setImmutableStates(t2);
break;
}
}
@@ -548,14 +531,11 @@
switch (t.getTypeTag()) {
case RECORD: {
- ARecordType recType = (ARecordType) t;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType, java.util.List)", recType,
- listFieldPath);
+ fd.setImmutableStates(t, listFieldPath);
break;
}
case ANY:
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType, java.util.List)",
- ARecordType.FULLY_OPEN_RECORD_TYPE, listFieldPath);
+ fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE, listFieldPath);
break;
default: {
throw new NotImplementedException("field-access-nested for data of type " + t);
@@ -571,11 +551,9 @@
IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
ATypeTag typeTag = t.getTypeTag();
if (typeTag.equals(ATypeTag.RECORD)) {
- ARecordType recType = (ARecordType) t;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
+ fd.setImmutableStates(t);
} else if (typeTag.equals(ATypeTag.ANY)) {
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)",
- ARecordType.FULLY_OPEN_RECORD_TYPE);
+ fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE);
} else {
throw new NotImplementedException("get-record-fields for data of type " + t);
}
@@ -589,11 +567,9 @@
IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
ATypeTag typeTag = t.getTypeTag();
if (typeTag.equals(ATypeTag.RECORD)) {
- ARecordType recType = (ARecordType) t;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
+ fd.setImmutableStates(t);
} else if (typeTag.equals(ATypeTag.ANY)) {
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)",
- ARecordType.FULLY_OPEN_RECORD_TYPE);
+ fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE);
} else {
throw new NotImplementedException("get-record-field-value for data of type " + t);
}
@@ -607,11 +583,9 @@
IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
ATypeTag typeTag = t.getTypeTag();
if (typeTag.equals(ATypeTag.RECORD)) {
- ARecordType recType = (ARecordType) t;
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
+ fd.setImmutableStates(t);
} else if (typeTag.equals(ATypeTag.ANY)) {
- PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)",
- ARecordType.FULLY_OPEN_RECORD_TYPE);
+ fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE);
} else {
throw new NotImplementedException("record-fields with data of type " + t);
}