http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/NonTaggedFormatUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/NonTaggedFormatUtil.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/NonTaggedFormatUtil.java new file mode 100644 index 0000000..c524d28 --- /dev/null +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/NonTaggedFormatUtil.java @@ -0,0 +1,272 @@ +/* + * 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.om.utils; + +import org.apache.asterix.common.config.DatasetConfig.IndexType; +import org.apache.asterix.common.exceptions.AsterixException; +import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer; +import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer; +import org.apache.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDeserializer; +import org.apache.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer; +import org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer; +import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider; +import org.apache.asterix.formats.nontagged.BinaryTokenizerFactoryProvider; +import org.apache.asterix.formats.nontagged.TypeTraitProvider; +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.AbstractCollectionType; +import org.apache.asterix.om.types.BuiltinType; +import org.apache.asterix.om.types.EnumDeserializer; +import org.apache.asterix.om.types.IAType; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; +import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException; +import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; +import org.apache.hyracks.api.dataflow.value.ITypeTraits; +import org.apache.hyracks.data.std.primitive.ByteArrayPointable; +import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; +import org.apache.hyracks.util.string.UTF8StringUtil; + +public final class NonTaggedFormatUtil { + + public static final boolean isFixedSizedCollection(IAType type) { + switch (type.getTypeTag()) { + case UNION: + if (!((AUnionType) type).isUnknownableType()) { + return false; + } else { + return isFixedSizedCollection(((AUnionType) type).getActualType()); + } + default: + return isFixedSizedCollection(type.getTypeTag()); + } + } + + public static final boolean isFixedSizedCollection(ATypeTag type) { + switch (type) { + case STRING: + case BINARY: + case RECORD: + case INTERVAL: + case ORDEREDLIST: + case UNORDEREDLIST: + case POLYGON: + case ANY: + return false; + default: + return true; + } + } + + public static final boolean hasOptionalField(ARecordType recType) { + for (int i = 0; i < recType.getFieldTypes().length; i++) { + IAType type = recType.getFieldTypes()[i]; + if (type != null) { + ATypeTag tag = type.getTypeTag(); + if (tag == ATypeTag.NULL || tag == ATypeTag.MISSING) { + return true; + } + if (tag != ATypeTag.UNION) { + continue; + } + // union + AUnionType unionType = (AUnionType) type; + if (unionType.isUnknownableType()) { + return true; + } + } + } + return false; + } + + /** + * Decide whether a type is an optional type + * + * @param type + * @return true if it is optional; false otherwise + */ + public static boolean isOptional(IAType type) { + return type.getTypeTag() == ATypeTag.UNION && ((AUnionType) type).isUnknownableType(); + } + + public static int getFieldValueLength(byte[] serNonTaggedAObject, int offset, ATypeTag typeTag, boolean tagged) + throws AsterixException { + switch (typeTag) { + case ANY: + ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serNonTaggedAObject[offset]); + if (tag == ATypeTag.ANY) { + throw new AsterixException("Field value has type tag ANY, but it should have a concrete type."); + } + return getFieldValueLength(serNonTaggedAObject, offset, tag, true) + 1; + case MISSING: + case NULL: + return 0; + case BOOLEAN: + case INT8: + return 1; + case INT16: + return 2; + case INT32: + case FLOAT: + case DATE: + case YEARMONTHDURATION: + return 4; + case TIME: + return 4; + case INT64: + case DOUBLE: + case DATETIME: + case DAYTIMEDURATION: + return 8; + case DURATION: + return 12; + case POINT: + case UUID: + return 16; + case INTERVAL: + if (tagged) { + return AIntervalSerializerDeserializer.getIntervalLength(serNonTaggedAObject, offset + 1); + } else { + return AIntervalSerializerDeserializer.getIntervalLength(serNonTaggedAObject, offset); + } + case POINT3D: + case CIRCLE: + return 24; + case LINE: + case RECTANGLE: + return 32; + case POLYGON: + if (tagged) { + return AInt16SerializerDeserializer.getShort(serNonTaggedAObject, offset + 1) * 16 + 2; + } else { + return AInt16SerializerDeserializer.getShort(serNonTaggedAObject, offset) * 16 + 2; + } + case STRING: + if (tagged) { + int len = UTF8StringUtil.getUTFLength(serNonTaggedAObject, offset + 1); + return len + UTF8StringUtil.getNumBytesToStoreLength(len); + } else { + int len = UTF8StringUtil.getUTFLength(serNonTaggedAObject, offset); + return len + UTF8StringUtil.getNumBytesToStoreLength(len); + } + case BINARY: + if (tagged) { + int len = ByteArrayPointable.getContentLength(serNonTaggedAObject, offset + 1); + return len + ByteArrayPointable.getNumberBytesToStoreMeta(len); + } else { + int len = ByteArrayPointable.getContentLength(serNonTaggedAObject, offset); + return len + ByteArrayPointable.getNumberBytesToStoreMeta(len); + } + case RECORD: + if (tagged) { + return ARecordSerializerDeserializer.getRecordLength(serNonTaggedAObject, offset + 1) - 1; + } else { + return ARecordSerializerDeserializer.getRecordLength(serNonTaggedAObject, offset) - 1; + } + case ORDEREDLIST: + if (tagged) { + return AOrderedListSerializerDeserializer.getOrderedListLength(serNonTaggedAObject, offset + 1) - 1; + } else { + return AOrderedListSerializerDeserializer.getOrderedListLength(serNonTaggedAObject, offset) - 1; + } + case UNORDEREDLIST: + if (tagged) { + return AUnorderedListSerializerDeserializer.getUnorderedListLength(serNonTaggedAObject, offset + 1) + - 1; + } else { + return AUnorderedListSerializerDeserializer.getUnorderedListLength(serNonTaggedAObject, offset) - 1; + } + default: + throw new NotImplementedException( + "No getLength implemented for a value of this type " + typeTag + " ."); + } + } + + public static int getNumDimensions(ATypeTag typeTag) { + switch (typeTag) { + case POINT: + case LINE: + case POLYGON: + case CIRCLE: + case RECTANGLE: + return 2; + case POINT3D: + return 3; + default: + throw new NotImplementedException( + "getNumDimensions is not implemented for this type " + typeTag + " ."); + } + } + + public static IAType getNestedSpatialType(ATypeTag typeTag) { + switch (typeTag) { + case POINT: + case LINE: + case POLYGON: + case CIRCLE: + case RECTANGLE: + return BuiltinType.ADOUBLE; + default: + throw new NotImplementedException(typeTag + " is not a supported spatial data type."); + } + } + + public static IBinaryTokenizerFactory getBinaryTokenizerFactory(ATypeTag keyType, IndexType indexType, + int gramLength) throws AlgebricksException { + switch (indexType) { + case SINGLE_PARTITION_WORD_INVIX: + case LENGTH_PARTITIONED_WORD_INVIX: { + return BinaryTokenizerFactoryProvider.INSTANCE.getWordTokenizerFactory(keyType, false, false); + } + case SINGLE_PARTITION_NGRAM_INVIX: + case LENGTH_PARTITIONED_NGRAM_INVIX: { + return BinaryTokenizerFactoryProvider.INSTANCE.getNGramTokenizerFactory(keyType, gramLength, true, + false); + } + default: { + throw new AlgebricksException("Tokenizer not applicable to index type '" + indexType + "'."); + } + } + } + + public static IAType getTokenType(IAType keyType) throws AlgebricksException { + IAType type = keyType; + ATypeTag typeTag = keyType.getTypeTag(); + // Extract item type from list. + if (typeTag == ATypeTag.UNORDEREDLIST || typeTag == ATypeTag.ORDEREDLIST) { + AbstractCollectionType listType = (AbstractCollectionType) keyType; + if (!listType.isTyped()) { + throw new AlgebricksException("Cannot build an inverted index on untyped lists.)"); + } + type = listType.getItemType(); + } + return type; + } + + public static IBinaryComparatorFactory getTokenBinaryComparatorFactory(IAType keyType) throws AlgebricksException { + IAType type = getTokenType(keyType); + // Ignore case for string types. + return BinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(type, true, true); + } + + public static ITypeTraits getTokenTypeTrait(IAType keyType) throws AlgebricksException { + IAType type = getTokenType(keyType); + return TypeTraitProvider.INSTANCE.getTypeTrait(type); + } +}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/RecordUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/RecordUtil.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/RecordUtil.java new file mode 100644 index 0000000..031669a --- /dev/null +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/RecordUtil.java @@ -0,0 +1,78 @@ +/* + * 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.om.utils; + +import java.util.List; + +import org.apache.asterix.om.types.ARecordType; +import org.apache.asterix.om.types.IAType; +import org.apache.commons.lang3.StringUtils; + +public class RecordUtil { + /** + * A fully open record type which has the name OpenRecord + */ + public static final ARecordType FULLY_OPEN_RECORD_TYPE = + new ARecordType("OpenRecord", new String[0], new IAType[0], true); + + private RecordUtil() { + } + + /** + * Create a fully open record type with the passed name + * + * @param name + * @return + */ + public static ARecordType createOpenRecordType(String name) { + return new ARecordType(name, new String[0], new IAType[0], true); + } + + /** + * A util method that takes a field name and return a String representation for error messages + * + * @param field + * @return + */ + public static String toFullyQualifiedName(List<String> field) { + return StringUtils.join(field, "."); + } + + /** + * A util method that takes String array and return a String representation for error messages + * + * @param field + * @return + */ + public static String toFullyQualifiedName(String... names) { + return StringUtils.join(names, "."); + } + + /** + * compute the null Bitmap size for the open fields + * + * @param recordType + * the record type + * @return the size of the bitmap + */ + public static int computeNullBitmapSize(ARecordType recordType) { + return NonTaggedFormatUtil.hasOptionalField(recordType) + ? (int) Math.ceil(recordType.getFieldNames().length / 4.0) : 0; + } +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ResettableByteArrayOutputStream.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ResettableByteArrayOutputStream.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ResettableByteArrayOutputStream.java new file mode 100644 index 0000000..c1b671b --- /dev/null +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ResettableByteArrayOutputStream.java @@ -0,0 +1,32 @@ +/* + * 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.om.utils; + +import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream; + +/** + * This class extends ByteArrayAccessibleOutputStream to allow reset to a given + * size. + */ +public class ResettableByteArrayOutputStream extends ByteArrayAccessibleOutputStream { + + public void reset(int size) { + count = size; + } +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-om/src/test/java/org/apache/asterix/om/util/JSONDeserializerForTypesTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/test/java/org/apache/asterix/om/util/JSONDeserializerForTypesTest.java b/asterixdb/asterix-om/src/test/java/org/apache/asterix/om/util/JSONDeserializerForTypesTest.java index a0a5c5f..32ec75a 100644 --- a/asterixdb/asterix-om/src/test/java/org/apache/asterix/om/util/JSONDeserializerForTypesTest.java +++ b/asterixdb/asterix-om/src/test/java/org/apache/asterix/om/util/JSONDeserializerForTypesTest.java @@ -28,6 +28,7 @@ import org.apache.asterix.om.types.AUnionType; import org.apache.asterix.om.types.AUnorderedListType; import org.apache.asterix.om.types.BuiltinType; import org.apache.asterix.om.types.IAType; +import org.apache.asterix.om.utils.JSONDeserializerForTypes; import org.junit.Assert; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ListAccessor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ListAccessor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ListAccessor.java index e456bc3..9783284 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ListAccessor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ListAccessor.java @@ -27,7 +27,7 @@ import org.apache.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDe import org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; import org.apache.asterix.runtime.exceptions.TypeMismatchException; import org.apache.hyracks.api.exceptions.HyracksDataException; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java index fb35332..714fabe 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java @@ -29,7 +29,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptor; import org.apache.asterix.om.functions.IFunctionDescriptorFactory; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor; import org.apache.asterix.runtime.exceptions.TypeMismatchException; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java index 145b6d5..276c9ae 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java @@ -29,7 +29,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; import org.apache.asterix.om.types.hierachy.ATypeHierarchy; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor; import org.apache.asterix.runtime.exceptions.TypeMismatchException; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java index bec79e8..3321efc 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java @@ -29,7 +29,8 @@ 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.IAType; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.RecordUtil; import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; @@ -55,7 +56,7 @@ public class FieldAccessByIndexEvalFactory implements IScalarEvaluatorFactory { this.recordEvalFactory = recordEvalFactory; this.fieldIndexEvalFactory = fieldIndexEvalFactory; this.recordType = recordType; - this.nullBitmapSize = ARecordType.computeNullBitmapSize(recordType); + this.nullBitmapSize = RecordUtil.computeNullBitmapSize(recordType); } @Override http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java index 4d13d09..87fa292 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java @@ -27,7 +27,7 @@ import org.apache.asterix.runtime.exceptions.TypeMismatchException; import org.apache.asterix.om.functions.BuiltinFunctions; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; import org.apache.hyracks.api.context.IHyracksTaskContext; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java index d95dcfe..f13771e 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java @@ -36,7 +36,8 @@ 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.runtime.RuntimeRecordTypeInfo; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.RecordUtil; import org.apache.asterix.runtime.exceptions.TypeMismatchException; import org.apache.asterix.runtime.exceptions.UnsupportedTypeException; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; @@ -154,7 +155,7 @@ public class FieldAccessNestedEvalFactory implements IScalarEvaluatorFactory { if (subFieldIndex == -1) { break; } - nullBitmapSize = ARecordType.computeNullBitmapSize((ARecordType) subType); + nullBitmapSize = RecordUtil.computeNullBitmapSize((ARecordType) subType); subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, start, subFieldIndex, nullBitmapSize, ((ARecordType) subType).isOpen()); if (subFieldOffset == 0) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java index b58c19e..c162e3d 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java @@ -29,7 +29,8 @@ import org.apache.asterix.om.types.ARecordType; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; import org.apache.asterix.om.types.runtime.RuntimeRecordTypeInfo; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.RecordUtil; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory; import org.apache.hyracks.api.context.IHyracksTaskContext; @@ -96,7 +97,7 @@ public class GetRecordFieldValueEvalFactory implements IScalarEvaluatorFactory { // Look at closed fields first. int subFieldIndex = recTypeInfo.getFieldIndex(serFldName, serFldNameOffset + 1, serFldNameLen - 1); if (subFieldIndex >= 0) { - int nullBitmapSize = ARecordType.computeNullBitmapSize(recordType); + int nullBitmapSize = RecordUtil.computeNullBitmapSize(recordType); subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, serRecordOffset, subFieldIndex, nullBitmapSize, recordType.isOpen()); if (subFieldOffset == 0) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordPairsDescriptor.java ---------------------------------------------------------------------- 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 8ecdca7..7158d2d 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 @@ -35,6 +35,7 @@ import org.apache.asterix.om.pointables.base.IVisitablePointable; 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.utils.RecordUtil; import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; @@ -79,7 +80,7 @@ public class RecordPairsDescriptor extends AbstractScalarFunctionDynamicDescript final ArrayBackedValueStorage itemStorage = new ArrayBackedValueStorage(); final DataOutput itemOutput = itemStorage.getDataOutput(); final RecordBuilder recBuilder = new RecordBuilder(); - recBuilder.reset(ARecordType.FULLY_OPEN_RECORD_TYPE); + recBuilder.reset(RecordUtil.FULLY_OPEN_RECORD_TYPE); // For writing the resulting list of records. final OrderedListBuilder listBuilder = new OrderedListBuilder(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java ---------------------------------------------------------------------- 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 ad43a48..01aff1a 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 @@ -59,7 +59,8 @@ 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.IAType; -import org.apache.asterix.om.util.ConstantExpressionUtil; +import org.apache.asterix.om.utils.ConstantExpressionUtil; +import org.apache.asterix.om.utils.RecordUtil; import org.apache.asterix.runtime.evaluators.common.CreateMBREvalFactory; import org.apache.asterix.runtime.evaluators.common.FunctionManagerImpl; import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByIndexEvalFactory; @@ -535,7 +536,7 @@ public class NonTaggedDataFormat implements IDataFormat { break; } case ANY: - fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE, listFieldPath); + fd.setImmutableStates(RecordUtil.FULLY_OPEN_RECORD_TYPE, listFieldPath); break; default: { throw new NotImplementedException("field-access-nested for data of type " + t); @@ -553,7 +554,7 @@ public class NonTaggedDataFormat implements IDataFormat { if (typeTag.equals(ATypeTag.RECORD)) { fd.setImmutableStates(t); } else if (typeTag.equals(ATypeTag.ANY)) { - fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE); + fd.setImmutableStates(RecordUtil.FULLY_OPEN_RECORD_TYPE); } else { throw new NotImplementedException("get-record-fields for data of type " + t); } @@ -569,7 +570,7 @@ public class NonTaggedDataFormat implements IDataFormat { if (typeTag.equals(ATypeTag.RECORD)) { fd.setImmutableStates(t); } else if (typeTag.equals(ATypeTag.ANY)) { - fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE); + fd.setImmutableStates(RecordUtil.FULLY_OPEN_RECORD_TYPE); } else { throw new NotImplementedException("get-record-field-value for data of type " + t); } @@ -585,7 +586,7 @@ public class NonTaggedDataFormat implements IDataFormat { if (typeTag.equals(ATypeTag.RECORD)) { fd.setImmutableStates(t); } else if (typeTag.equals(ATypeTag.ANY)) { - fd.setImmutableStates(ARecordType.FULLY_OPEN_RECORD_TYPE); + fd.setImmutableStates(RecordUtil.FULLY_OPEN_RECORD_TYPE); } else { throw new NotImplementedException("record-fields with data of type " + t); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java index cb56c39..07c366c 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java @@ -20,7 +20,7 @@ package org.apache.asterix.runtime.message; import java.util.Set; -import org.apache.asterix.runtime.util.ClusterStateManager; +import org.apache.asterix.runtime.utils.ClusterStateManager; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java index d87cd23..c655ecd 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java @@ -20,7 +20,7 @@ package org.apache.asterix.runtime.message; import java.util.Set; -import org.apache.asterix.runtime.util.ClusterStateManager; +import org.apache.asterix.runtime.utils.ClusterStateManager; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ReportMaxResourceIdMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ReportMaxResourceIdMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ReportMaxResourceIdMessage.java index b1e6e69..dd7335a 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ReportMaxResourceIdMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ReportMaxResourceIdMessage.java @@ -27,7 +27,7 @@ import org.apache.asterix.common.messaging.api.IApplicationMessage; import org.apache.asterix.common.messaging.api.INCMessageBroker; import org.apache.asterix.common.metadata.MetadataIndexImmutableProperties; import org.apache.asterix.common.transactions.IResourceIdManager; -import org.apache.asterix.runtime.util.AppContextInfo; +import org.apache.asterix.runtime.utils.AppContextInfo; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; import org.apache.hyracks.control.nc.NodeControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java index 9247e09..2fedcca 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java @@ -24,8 +24,8 @@ import org.apache.asterix.common.exceptions.ExceptionUtils; import org.apache.asterix.common.messaging.api.IApplicationMessage; import org.apache.asterix.common.messaging.api.ICCMessageBroker; import org.apache.asterix.common.transactions.IResourceIdManager; -import org.apache.asterix.runtime.util.AppContextInfo; -import org.apache.asterix.runtime.util.ClusterStateManager; +import org.apache.asterix.runtime.utils.AppContextInfo; +import org.apache.asterix.runtime.utils.ClusterStateManager; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java index d3c3502..d8b2136 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java @@ -19,7 +19,7 @@ package org.apache.asterix.runtime.message; import org.apache.asterix.common.messaging.api.IApplicationMessage; -import org.apache.asterix.runtime.util.ClusterStateManager; +import org.apache.asterix.runtime.utils.ClusterStateManager; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java index 3adc8e9..81492c2 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java @@ -19,7 +19,7 @@ package org.apache.asterix.runtime.message; import org.apache.asterix.common.messaging.api.IApplicationMessage; -import org.apache.asterix.runtime.util.ClusterStateManager; +import org.apache.asterix.runtime.utils.ClusterStateManager; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.service.IControllerService; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMInvertedIndexUpsertOperatorDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMInvertedIndexUpsertOperatorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMInvertedIndexUpsertOperatorDescriptor.java index 8e88b9c..f1547a8 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMInvertedIndexUpsertOperatorDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMInvertedIndexUpsertOperatorDescriptor.java @@ -29,13 +29,13 @@ import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.job.IOperatorDescriptorRegistry; import org.apache.hyracks.dataflow.std.file.IFileSplitProvider; import org.apache.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; +import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; import org.apache.hyracks.storage.am.common.api.ITupleFilterFactory; import org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; -import org.apache.hyracks.storage.common.IStorageManagerInterface; +import org.apache.hyracks.storage.common.IStorageManager; public class LSMInvertedIndexUpsertOperatorDescriptor extends LSMInvertedIndexInsertDeleteOperatorDescriptor { @@ -44,17 +44,17 @@ public class LSMInvertedIndexUpsertOperatorDescriptor private final int[] prevFieldPermutation; public LSMInvertedIndexUpsertOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor recDesc, - IStorageManagerInterface storageManager, IFileSplitProvider fileSplitProvider, + IStorageManager storageManager, IFileSplitProvider fileSplitProvider, IIndexLifecycleManagerProvider lifecycleManagerProvider, ITypeTraits[] tokenTypeTraits, IBinaryComparatorFactory[] tokenComparatorFactories, ITypeTraits[] invListsTypeTraits, IBinaryComparatorFactory[] invListComparatorFactories, IBinaryTokenizerFactory tokenizerFactory, int[] fieldPermutation, IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory, IModificationOperationCallbackFactory modificationOpCallbackFactory, - String indexName, int[] prevFieldPermutation, IMetadataPageManagerFactory metadataPageManagerFactory) { + String indexName, int[] prevFieldPermutation, IPageManagerFactory pageManagerFactory) { super(spec, recDesc, storageManager, fileSplitProvider, lifecycleManagerProvider, tokenTypeTraits, tokenComparatorFactories, invListsTypeTraits, invListComparatorFactories, tokenizerFactory, fieldPermutation, IndexOperation.UPSERT, dataflowHelperFactory, tupleFilterFactory, - modificationOpCallbackFactory, indexName, metadataPageManagerFactory); + modificationOpCallbackFactory, indexName, pageManagerFactory); this.prevFieldPermutation = prevFieldPermutation; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java index 878f3eb..b2ffd6e 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMPrimaryUpsertOperatorNodePushable.java @@ -45,7 +45,7 @@ import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender; import org.apache.hyracks.dataflow.common.comm.util.FrameUtils; import org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; -import org.apache.hyracks.dataflow.common.util.TaskUtils; +import org.apache.hyracks.dataflow.common.utils.TaskUtil; import org.apache.hyracks.storage.am.btree.impls.RangePredicate; import org.apache.hyracks.storage.am.btree.util.BTreeUtils; import org.apache.hyracks.storage.am.common.api.IIndexCursor; @@ -126,7 +126,7 @@ public class LSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertUpdateDe try { if (ctx.getSharedObject() != null) { PrimaryIndexLogMarkerCallback callback = new PrimaryIndexLogMarkerCallback((AbstractLSMIndex) index); - TaskUtils.putInSharedMap(ILogMarkerCallback.KEY_MARKER_CALLBACK, callback, ctx); + TaskUtil.putInSharedMap(ILogMarkerCallback.KEY_MARKER_CALLBACK, callback, ctx); } missingTupleBuilder = new ArrayTupleBuilder(1); DataOutput out = missingTupleBuilder.getDataOutput(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMTreeUpsertOperatorDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMTreeUpsertOperatorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMTreeUpsertOperatorDescriptor.java index 79a02a4..fe69a04 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMTreeUpsertOperatorDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/LSMTreeUpsertOperatorDescriptor.java @@ -31,13 +31,13 @@ import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.job.IOperatorDescriptorRegistry; import org.apache.hyracks.dataflow.std.file.IFileSplitProvider; import org.apache.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; +import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; import org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory; import org.apache.hyracks.storage.am.common.api.ITupleFilterFactory; import org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; -import org.apache.hyracks.storage.common.IStorageManagerInterface; +import org.apache.hyracks.storage.common.IStorageManager; public class LSMTreeUpsertOperatorDescriptor extends LSMTreeInsertDeleteOperatorDescriptor { @@ -47,18 +47,18 @@ public class LSMTreeUpsertOperatorDescriptor extends LSMTreeInsertDeleteOperator private int filterIndex = -1; public LSMTreeUpsertOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor recDesc, - IStorageManagerInterface storageManager, IIndexLifecycleManagerProvider lifecycleManagerProvider, + IStorageManager storageManager, IIndexLifecycleManagerProvider lifecycleManagerProvider, IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits, IBinaryComparatorFactory[] comparatorFactories, int[] bloomFilterKeyFields, int[] fieldPermutation, IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory, boolean isPrimary, String indexName, IMissingWriterFactory missingWriterFactory, IModificationOperationCallbackFactory modificationOpCallbackProvider, ISearchOperationCallbackFactory searchOpCallbackProvider, int[] prevValuePermutation, - IMetadataPageManagerFactory metadataPageManagerFactory) { + IPageManagerFactory pageManagerFactory) { super(spec, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits, comparatorFactories, bloomFilterKeyFields, fieldPermutation, IndexOperation.UPSERT, dataflowHelperFactory, tupleFilterFactory, isPrimary, indexName, missingWriterFactory, - modificationOpCallbackProvider, searchOpCallbackProvider, metadataPageManagerFactory); + modificationOpCallbackProvider, searchOpCallbackProvider, pageManagerFactory); this.prevValuePermutation = prevValuePermutation; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java index 1d4dd89..84a59ac 100644 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java +++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java @@ -31,7 +31,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptorFactory; import org.apache.asterix.om.types.ATypeTag; import org.apache.asterix.om.types.EnumDeserializer; import org.apache.asterix.om.types.hierachy.ATypeHierarchy; -import org.apache.asterix.om.util.NonTaggedFormatUtil; +import org.apache.asterix.om.utils.NonTaggedFormatUtil; import org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ef9be0f9/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/AppContextInfo.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/AppContextInfo.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/AppContextInfo.java deleted file mode 100644 index ce3c2ca..0000000 --- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/util/AppContextInfo.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.util; - -import java.io.IOException; -import java.util.function.Supplier; -import java.util.logging.Logger; - -import org.apache.asterix.common.cluster.IGlobalRecoveryMaanger; -import org.apache.asterix.common.config.BuildProperties; -import org.apache.asterix.common.config.CompilerProperties; -import org.apache.asterix.common.config.ExtensionProperties; -import org.apache.asterix.common.config.ExternalProperties; -import org.apache.asterix.common.config.FeedProperties; -import org.apache.asterix.common.config.MetadataProperties; -import org.apache.asterix.common.config.PropertiesAccessor; -import org.apache.asterix.common.config.ReplicationProperties; -import org.apache.asterix.common.config.StorageProperties; -import org.apache.asterix.common.config.TransactionProperties; -import org.apache.asterix.common.config.IPropertiesProvider; -import org.apache.asterix.common.config.MessagingProperties; -import org.apache.asterix.common.dataflow.IApplicationContextInfo; -import org.apache.asterix.common.exceptions.AsterixException; -import org.apache.asterix.common.library.ILibraryManager; -import org.apache.asterix.common.metadata.IMetadataBootstrap; -import org.apache.asterix.common.transactions.IResourceIdManager; -import org.apache.hyracks.api.application.ICCApplicationContext; -import org.apache.hyracks.api.client.IHyracksClientConnection; -import org.apache.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider; -import org.apache.hyracks.storage.common.IStorageManagerInterface; - -/* - * Acts as an holder class for IndexRegistryProvider, AsterixStorageManager - * instances that are accessed from the NCs. In addition an instance of ICCApplicationContext - * is stored for access by the CC. - */ -public class AppContextInfo implements IApplicationContextInfo, IPropertiesProvider { - - public static final AppContextInfo INSTANCE = new AppContextInfo(); - private ICCApplicationContext appCtx; - private IGlobalRecoveryMaanger globalRecoveryMaanger; - private ILibraryManager libraryManager; - private IResourceIdManager resourceIdManager; - private CompilerProperties compilerProperties; - private ExternalProperties externalProperties; - private MetadataProperties metadataProperties; - private StorageProperties storageProperties; - private TransactionProperties txnProperties; - private FeedProperties feedProperties; - private BuildProperties buildProperties; - private ReplicationProperties replicationProperties; - private ExtensionProperties extensionProperties; - private MessagingProperties messagingProperties; - private Supplier<IMetadataBootstrap> metadataBootstrapSupplier; - private IHyracksClientConnection hcc; - private Object extensionManager; - private volatile boolean initialized = false; - - private AppContextInfo() { - } - - public static synchronized void initialize(ICCApplicationContext ccAppCtx, IHyracksClientConnection hcc, - IGlobalRecoveryMaanger globalRecoveryMaanger, - ILibraryManager libraryManager, - IResourceIdManager resourceIdManager, - Supplier<IMetadataBootstrap> metadataBootstrapSupplier) - throws AsterixException, IOException { - if (INSTANCE.initialized) { - throw new AsterixException(AppContextInfo.class.getSimpleName() + " has been initialized already"); - } - INSTANCE.initialized = true; - INSTANCE.appCtx = ccAppCtx; - INSTANCE.hcc = hcc; - INSTANCE.globalRecoveryMaanger = globalRecoveryMaanger; - INSTANCE.libraryManager = libraryManager; - INSTANCE.resourceIdManager = resourceIdManager; - // Determine whether to use old-style asterix-configuration.xml or new-style configuration. - // QQQ strip this out eventually - PropertiesAccessor propertiesAccessor = PropertiesAccessor.getInstance(ccAppCtx.getAppConfig()); - INSTANCE.compilerProperties = new CompilerProperties(propertiesAccessor); - INSTANCE.externalProperties = new ExternalProperties(propertiesAccessor); - INSTANCE.metadataProperties = new MetadataProperties(propertiesAccessor); - INSTANCE.storageProperties = new StorageProperties(propertiesAccessor); - INSTANCE.txnProperties = new TransactionProperties(propertiesAccessor); - INSTANCE.feedProperties = new FeedProperties(propertiesAccessor); - INSTANCE.extensionProperties = new ExtensionProperties(propertiesAccessor); - INSTANCE.replicationProperties = new ReplicationProperties(propertiesAccessor); - INSTANCE.hcc = hcc; - INSTANCE.buildProperties = new BuildProperties(propertiesAccessor); - INSTANCE.messagingProperties = new MessagingProperties(propertiesAccessor); - INSTANCE.metadataBootstrapSupplier = metadataBootstrapSupplier; - - Logger.getLogger("org.apache.asterix").setLevel(INSTANCE.externalProperties.getLogLevel()); - Logger.getLogger("org.apache.hyracks").setLevel(INSTANCE.externalProperties.getLogLevel()); - } - - public boolean initialized() { - return initialized; - } - - @Override - public ICCApplicationContext getCCApplicationContext() { - return appCtx; - } - - @Override - public StorageProperties getStorageProperties() { - return storageProperties; - } - - @Override - public TransactionProperties getTransactionProperties() { - return txnProperties; - } - - @Override - public CompilerProperties getCompilerProperties() { - return compilerProperties; - } - - @Override - public MetadataProperties getMetadataProperties() { - return metadataProperties; - } - - @Override - public ExternalProperties getExternalProperties() { - return externalProperties; - } - - @Override - public FeedProperties getFeedProperties() { - return feedProperties; - } - - @Override - public BuildProperties getBuildProperties() { - return buildProperties; - } - - public IHyracksClientConnection getHcc() { - return hcc; - } - - @Override - public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider() { - return RuntimeComponentsProvider.RUNTIME_PROVIDER; - } - - @Override - public IStorageManagerInterface getStorageManagerInterface() { - return RuntimeComponentsProvider.RUNTIME_PROVIDER; - } - - @Override - public ReplicationProperties getReplicationProperties() { - return replicationProperties; - } - - @Override - public IGlobalRecoveryMaanger getGlobalRecoveryManager() { - return globalRecoveryMaanger; - } - - @Override - public ILibraryManager getLibraryManager() { - return libraryManager; - } - - public Object getExtensionManager() { - return extensionManager; - } - - public void setExtensionManager(Object extensionManager) { - this.extensionManager = extensionManager; - } - - public ExtensionProperties getExtensionProperties() { - return extensionProperties; - } - - @Override - public MessagingProperties getMessagingProperties() { - return messagingProperties; - } - - public IResourceIdManager getResourceIdManager() { - return resourceIdManager; - } - - public IMetadataBootstrap getMetadataBootstrap() { - return metadataBootstrapSupplier.get(); - } -}
