http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/ADMPrinterFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/ADMPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/ADMPrinterFactoryProvider.java new file mode 100644 index 0000000..6b723e3 --- /dev/null +++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/ADMPrinterFactoryProvider.java @@ -0,0 +1,153 @@ +/* + * 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.formats.nontagged; + +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABooleanPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ACirclePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADatePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADateTimePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADayTimeDurationPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADoublePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADurationPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AFloatPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt16PrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt32PrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt64PrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt8PrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AIntervalPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ALinePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ANullPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AOptionalFieldPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AObjectPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AOrderedlistPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.APoint3DPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.APointPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.APolygonPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARecordPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARectanglePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AStringPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ATimePrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnionPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnorderedlistPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.AYearMonthDurationPrinterFactory; +import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory; +import org.apache.asterix.om.types.AOrderedListType; +import org.apache.asterix.om.types.ARecordType; +import org.apache.asterix.om.types.AUnionType; +import org.apache.asterix.om.types.AUnorderedListType; +import org.apache.asterix.om.types.IAType; +import org.apache.hyracks.algebricks.data.IPrinterFactory; +import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider; + +public class ADMPrinterFactoryProvider implements IPrinterFactoryProvider { + + public static final ADMPrinterFactoryProvider INSTANCE = new ADMPrinterFactoryProvider(); + + private ADMPrinterFactoryProvider() { + } + + @Override + public IPrinterFactory getPrinterFactory(Object type) { + IAType aqlType = (IAType) type; + + if (aqlType != null) { + switch (aqlType.getTypeTag()) { + case INT8: + return AInt8PrinterFactory.INSTANCE; + case INT16: + return AInt16PrinterFactory.INSTANCE; + case INT32: + return AInt32PrinterFactory.INSTANCE; + case INT64: + return AInt64PrinterFactory.INSTANCE; + case MISSING: + case NULL: + return ANullPrinterFactory.INSTANCE; + case BOOLEAN: + return ABooleanPrinterFactory.INSTANCE; + case FLOAT: + return AFloatPrinterFactory.INSTANCE; + case DOUBLE: + return ADoublePrinterFactory.INSTANCE; + case TIME: + return ATimePrinterFactory.INSTANCE; + case DATE: + return ADatePrinterFactory.INSTANCE; + case DATETIME: + return ADateTimePrinterFactory.INSTANCE; + case DURATION: + return ADurationPrinterFactory.INSTANCE; + case DAYTIMEDURATION: + return ADayTimeDurationPrinterFactory.INSTANCE; + case YEARMONTHDURATION: + return AYearMonthDurationPrinterFactory.INSTANCE; + case INTERVAL: + return AIntervalPrinterFactory.INSTANCE; + case POINT: + return APointPrinterFactory.INSTANCE; + case POINT3D: + return APoint3DPrinterFactory.INSTANCE; + case LINE: + return ALinePrinterFactory.INSTANCE; + case POLYGON: + return APolygonPrinterFactory.INSTANCE; + case CIRCLE: + return ACirclePrinterFactory.INSTANCE; + case RECTANGLE: + return ARectanglePrinterFactory.INSTANCE; + case STRING: + return AStringPrinterFactory.INSTANCE; + case BINARY: + return ABinaryHexPrinterFactory.INSTANCE; + case RECORD: + return new ARecordPrinterFactory((ARecordType) aqlType); + case ORDEREDLIST: + return new AOrderedlistPrinterFactory((AOrderedListType) aqlType); + case UNORDEREDLIST: + return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType); + case UNION: + if (((AUnionType) aqlType).isUnknownableType()) { + return new AOptionalFieldPrinterFactory((AUnionType) aqlType); + } else { + return new AUnionPrinterFactory((AUnionType) aqlType); + } + case UUID: + return AUUIDPrinterFactory.INSTANCE; + case SHORTWITHOUTTYPEINFO: + return ShortWithoutTypeInfoPrinterFactory.INSTANCE; + case ANY: + case BITARRAY: + case ENUM: + case SPARSERECORD: + case SYSTEM_NULL: + case TYPE: + case UINT16: + case UINT32: + case UINT64: + case UINT8: + // These types are not intended to be printed to the user. + break; + } + } + return AObjectPrinterFactory.INSTANCE; + + } +}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java deleted file mode 100644 index 97808a1..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java +++ /dev/null @@ -1,153 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABooleanPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ACirclePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADatePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADateTimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADayTimeDurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADoublePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AFloatPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt16PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt32PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt64PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt8PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AIntervalPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ALinePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ANullPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AOptionalFieldPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AObjectPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AOrderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.APoint3DPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.APointPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.APolygonPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARecordPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARectanglePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AStringPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ATimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnionPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnorderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AYearMonthDurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory; -import org.apache.asterix.om.types.AOrderedListType; -import org.apache.asterix.om.types.ARecordType; -import org.apache.asterix.om.types.AUnionType; -import org.apache.asterix.om.types.AUnorderedListType; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.data.IPrinterFactory; -import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider; - -public class AqlADMPrinterFactoryProvider implements IPrinterFactoryProvider { - - public static final AqlADMPrinterFactoryProvider INSTANCE = new AqlADMPrinterFactoryProvider(); - - private AqlADMPrinterFactoryProvider() { - } - - @Override - public IPrinterFactory getPrinterFactory(Object type) { - IAType aqlType = (IAType) type; - - if (aqlType != null) { - switch (aqlType.getTypeTag()) { - case INT8: - return AInt8PrinterFactory.INSTANCE; - case INT16: - return AInt16PrinterFactory.INSTANCE; - case INT32: - return AInt32PrinterFactory.INSTANCE; - case INT64: - return AInt64PrinterFactory.INSTANCE; - case MISSING: - case NULL: - return ANullPrinterFactory.INSTANCE; - case BOOLEAN: - return ABooleanPrinterFactory.INSTANCE; - case FLOAT: - return AFloatPrinterFactory.INSTANCE; - case DOUBLE: - return ADoublePrinterFactory.INSTANCE; - case TIME: - return ATimePrinterFactory.INSTANCE; - case DATE: - return ADatePrinterFactory.INSTANCE; - case DATETIME: - return ADateTimePrinterFactory.INSTANCE; - case DURATION: - return ADurationPrinterFactory.INSTANCE; - case DAYTIMEDURATION: - return ADayTimeDurationPrinterFactory.INSTANCE; - case YEARMONTHDURATION: - return AYearMonthDurationPrinterFactory.INSTANCE; - case INTERVAL: - return AIntervalPrinterFactory.INSTANCE; - case POINT: - return APointPrinterFactory.INSTANCE; - case POINT3D: - return APoint3DPrinterFactory.INSTANCE; - case LINE: - return ALinePrinterFactory.INSTANCE; - case POLYGON: - return APolygonPrinterFactory.INSTANCE; - case CIRCLE: - return ACirclePrinterFactory.INSTANCE; - case RECTANGLE: - return ARectanglePrinterFactory.INSTANCE; - case STRING: - return AStringPrinterFactory.INSTANCE; - case BINARY: - return ABinaryHexPrinterFactory.INSTANCE; - case RECORD: - return new ARecordPrinterFactory((ARecordType) aqlType); - case ORDEREDLIST: - return new AOrderedlistPrinterFactory((AOrderedListType) aqlType); - case UNORDEREDLIST: - return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType); - case UNION: - if (((AUnionType) aqlType).isUnknownableType()) { - return new AOptionalFieldPrinterFactory((AUnionType) aqlType); - } else { - return new AUnionPrinterFactory((AUnionType) aqlType); - } - case UUID: - return AUUIDPrinterFactory.INSTANCE; - case SHORTWITHOUTTYPEINFO: - return ShortWithoutTypeInfoPrinterFactory.INSTANCE; - case ANY: - case BITARRAY: - case ENUM: - case SPARSERECORD: - case SYSTEM_NULL: - case TYPE: - case UINT16: - case UINT32: - case UINT64: - case UINT8: - // These types are not intended to be printed to the user. - break; - } - } - return AObjectPrinterFactory.INSTANCE; - - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java deleted file mode 100644 index a9a57d7..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java +++ /dev/null @@ -1,57 +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.formats.nontagged; - -import org.apache.asterix.om.types.ATypeTag; -import org.apache.asterix.om.types.EnumDeserializer; -import org.apache.hyracks.algebricks.data.IBinaryBooleanInspector; -import org.apache.hyracks.algebricks.data.IBinaryBooleanInspectorFactory; -import org.apache.hyracks.api.context.IHyracksTaskContext; - -public class AqlBinaryBooleanInspectorImpl implements IBinaryBooleanInspector { - private static final AqlBinaryBooleanInspectorImpl INSTANCE = new AqlBinaryBooleanInspectorImpl(); - public static final IBinaryBooleanInspectorFactory FACTORY = new IBinaryBooleanInspectorFactory() { - private static final long serialVersionUID = 1L; - - @Override - public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx) { - // Stateless class. No need to construct an object per call - return INSTANCE; - } - }; - - private AqlBinaryBooleanInspectorImpl() { - } - - @Override - public boolean getBooleanValue(byte[] bytes, int offset, int length) { - byte serializedTypeTag = bytes[offset]; - if (serializedTypeTag == ATypeTag.SERIALIZED_MISSING_TYPE_TAG - || serializedTypeTag == ATypeTag.SERIALIZED_NULL_TYPE_TAG) { - return false; - } - /** check if the runtime type is boolean */ - ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serializedTypeTag); - if (typeTag != ATypeTag.BOOLEAN) { - throw new IllegalStateException("Runtime error: the select condition should be of the boolean type!"); - } - return bytes[offset + 1] == 1; - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java deleted file mode 100644 index 7927e76..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java +++ /dev/null @@ -1,219 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.comparators.ABinaryComparator; -import org.apache.asterix.dataflow.data.nontagged.comparators.ACirclePartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.ADurationPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalAscPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalDescPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.ALinePartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.AObjectAscBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.AObjectDescBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.APolygonPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.ARectanglePartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.AUUIDPartialBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.BooleanBinaryComparatorFactory; -import org.apache.asterix.dataflow.data.nontagged.comparators.RawBinaryComparatorFactory; -import org.apache.asterix.om.types.ATypeTag; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider; -import org.apache.hyracks.api.dataflow.value.IBinaryComparator; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.data.std.accessors.PointableBinaryComparatorFactory; -import org.apache.hyracks.data.std.primitive.ByteArrayPointable; -import org.apache.hyracks.data.std.primitive.BytePointable; -import org.apache.hyracks.data.std.primitive.DoublePointable; -import org.apache.hyracks.data.std.primitive.FloatPointable; -import org.apache.hyracks.data.std.primitive.IntegerPointable; -import org.apache.hyracks.data.std.primitive.LongPointable; -import org.apache.hyracks.data.std.primitive.ShortPointable; -import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable; -import org.apache.hyracks.data.std.primitive.UTF8StringPointable; - -import java.io.Serializable; - -public class AqlBinaryComparatorFactoryProvider implements IBinaryComparatorFactoryProvider, Serializable { - - private static final long serialVersionUID = 1L; - public static final AqlBinaryComparatorFactoryProvider INSTANCE = new AqlBinaryComparatorFactoryProvider(); - public static final PointableBinaryComparatorFactory BYTE_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - BytePointable.FACTORY); - public static final PointableBinaryComparatorFactory SHORT_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - ShortPointable.FACTORY); - public static final PointableBinaryComparatorFactory INTEGER_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - IntegerPointable.FACTORY); - public static final PointableBinaryComparatorFactory LONG_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - LongPointable.FACTORY); - public static final PointableBinaryComparatorFactory FLOAT_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - FloatPointable.FACTORY); - public static final PointableBinaryComparatorFactory DOUBLE_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - DoublePointable.FACTORY); - public static final PointableBinaryComparatorFactory UTF8STRING_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - UTF8StringPointable.FACTORY); - // Equivalent to UTF8STRING_POINTABLE_INSTANCE but all characters are considered lower case to implement case-insensitive comparisons. - public static final PointableBinaryComparatorFactory UTF8STRING_LOWERCASE_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - UTF8StringLowercasePointable.FACTORY); - public static final PointableBinaryComparatorFactory BINARY_POINTABLE_INSTANCE = new PointableBinaryComparatorFactory( - ByteArrayPointable.FACTORY); - - private AqlBinaryComparatorFactoryProvider() { - } - - // This method add the option of ignoring the case in string comparisons. - // TODO: We should incorporate this option more nicely, but I'd have to change algebricks. - public IBinaryComparatorFactory getBinaryComparatorFactory(Object type, boolean ascending, boolean ignoreCase) { - if (type == null) { - return anyBinaryComparatorFactory(ascending); - } - IAType aqlType = (IAType) type; - if (aqlType.getTypeTag() == ATypeTag.STRING && ignoreCase) { - return addOffset(UTF8STRING_LOWERCASE_POINTABLE_INSTANCE, ascending); - } - return getBinaryComparatorFactory(type, ascending); - } - - @Override - public IBinaryComparatorFactory getBinaryComparatorFactory(Object type, boolean ascending) { - // During a comparison, since proper type promotion among several numeric types are required, - // we will use AObjectAscBinaryComparatorFactory, instead of using a specific comparator - return anyBinaryComparatorFactory(ascending); - } - - public IBinaryComparatorFactory getBinaryComparatorFactory(ATypeTag type, boolean ascending) { - switch (type) { - case ANY: - case UNION: - // we could do smth better for nullable fields - return anyBinaryComparatorFactory(ascending); - case NULL: - case MISSING: - return new IBinaryComparatorFactory() { - - private static final long serialVersionUID = 1L; - - @Override - public IBinaryComparator createBinaryComparator() { - return new IBinaryComparator() { - - @Override - public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { - return 0; - } - }; - } - }; - case BOOLEAN: - return addOffset(BooleanBinaryComparatorFactory.INSTANCE, ascending); - case INT8: - return addOffset(BYTE_POINTABLE_INSTANCE, ascending); - case INT16: - return addOffset(SHORT_POINTABLE_INSTANCE, ascending); - case DATE: - case TIME: - case YEARMONTHDURATION: - case INT32: - return addOffset(INTEGER_POINTABLE_INSTANCE, ascending); - case DATETIME: - case DAYTIMEDURATION: - case INT64: - return addOffset(LONG_POINTABLE_INSTANCE, ascending); - case FLOAT: - return addOffset(FLOAT_POINTABLE_INSTANCE, ascending); - case DOUBLE: - return addOffset(DOUBLE_POINTABLE_INSTANCE, ascending); - case STRING: - return addOffset(UTF8STRING_POINTABLE_INSTANCE, ascending); - case RECTANGLE: - return addOffset(ARectanglePartialBinaryComparatorFactory.INSTANCE, ascending); - case CIRCLE: - return addOffset(ACirclePartialBinaryComparatorFactory.INSTANCE, ascending); - case POINT: - return addOffset(APointPartialBinaryComparatorFactory.INSTANCE, ascending); - case POINT3D: - return addOffset(APoint3DPartialBinaryComparatorFactory.INSTANCE, ascending); - case LINE: - return addOffset(ALinePartialBinaryComparatorFactory.INSTANCE, ascending); - case POLYGON: - return addOffset(APolygonPartialBinaryComparatorFactory.INSTANCE, ascending); - case DURATION: - return addOffset(ADurationPartialBinaryComparatorFactory.INSTANCE, ascending); - case INTERVAL: - return addOffset(intervalBinaryComparatorFactory(ascending), ascending); - case UUID: - return addOffset(AUUIDPartialBinaryComparatorFactory.INSTANCE, ascending); - case BINARY: - return addOffset(BINARY_POINTABLE_INSTANCE, ascending); - default: - return addOffset(RawBinaryComparatorFactory.INSTANCE, ascending); - } - } - - private IBinaryComparatorFactory addOffset(final IBinaryComparatorFactory inst, final boolean ascending) { - return new IBinaryComparatorFactory() { - - private static final long serialVersionUID = 1L; - - @Override - public IBinaryComparator createBinaryComparator() { - final IBinaryComparator bc = inst.createBinaryComparator(); - if (ascending) { - return new ABinaryComparator() { - - @Override - public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) - throws HyracksDataException { - return bc.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1); - } - }; - } else { - return new ABinaryComparator() { - @Override - public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) - throws HyracksDataException { - return -bc.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1); - } - }; - } - } - }; - } - - private IBinaryComparatorFactory anyBinaryComparatorFactory(boolean ascending) { - if (ascending) { - return AObjectAscBinaryComparatorFactory.INSTANCE; - } else { - return AObjectDescBinaryComparatorFactory.INSTANCE; - } - } - - private IBinaryComparatorFactory intervalBinaryComparatorFactory(boolean ascending) { - // Intervals have separate binary comparator factories, since asc is primarily based on start point - // and desc is similarly based on end point. - if (ascending) { - return AIntervalAscPartialBinaryComparatorFactory.INSTANCE; - } else { - return AIntervalDescPartialBinaryComparatorFactory.INSTANCE; - } - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java deleted file mode 100644 index 23c245f..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java +++ /dev/null @@ -1,67 +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.formats.nontagged; - -import java.io.Serializable; - -import org.apache.asterix.dataflow.data.nontagged.hash.AMurmurHash3BinaryHashFunctionFamily; -import org.apache.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider; -import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction; -import org.apache.hyracks.api.dataflow.value.IBinaryHashFunctionFactory; -import org.apache.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory; -import org.apache.hyracks.data.std.primitive.DoublePointable; -import org.apache.hyracks.data.std.primitive.FloatPointable; -import org.apache.hyracks.data.std.primitive.IntegerPointable; -import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable; -import org.apache.hyracks.data.std.primitive.UTF8StringPointable; - -public class AqlBinaryHashFunctionFactoryProvider implements IBinaryHashFunctionFactoryProvider, Serializable { - - private static final long serialVersionUID = 1L; - public static final AqlBinaryHashFunctionFactoryProvider INSTANCE = new AqlBinaryHashFunctionFactoryProvider(); - public static final PointableBinaryHashFunctionFactory INTEGER_POINTABLE_INSTANCE = new PointableBinaryHashFunctionFactory( - IntegerPointable.FACTORY); - public static final PointableBinaryHashFunctionFactory FLOAT_POINTABLE_INSTANCE = new PointableBinaryHashFunctionFactory( - FloatPointable.FACTORY); - public static final PointableBinaryHashFunctionFactory DOUBLE_POINTABLE_INSTANCE = new PointableBinaryHashFunctionFactory( - DoublePointable.FACTORY); - public static final PointableBinaryHashFunctionFactory UTF8STRING_POINTABLE_INSTANCE = new PointableBinaryHashFunctionFactory( - UTF8StringPointable.FACTORY); - // Equivalent to UTF8STRING_POINTABLE_INSTANCE but all characters are considered lower case to implement case-insensitive hashing. - public static final PointableBinaryHashFunctionFactory UTF8STRING_LOWERCASE_POINTABLE_INSTANCE = new PointableBinaryHashFunctionFactory( - UTF8StringLowercasePointable.FACTORY); - - private AqlBinaryHashFunctionFactoryProvider() { - } - - @Override - public IBinaryHashFunctionFactory getBinaryHashFunctionFactory(Object type) { - return new IBinaryHashFunctionFactory() { - - private static final long serialVersionUID = 1L; - - @Override - public IBinaryHashFunction createBinaryHashFunction() { - // Actual numeric type promotion happens in the createBinaryHashFunction() - return AMurmurHash3BinaryHashFunctionFamily.INSTANCE.createBinaryHashFunction(0); - } - }; - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java deleted file mode 100644 index 8f0853e..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java +++ /dev/null @@ -1,48 +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.formats.nontagged; - -import java.io.Serializable; - -import org.apache.asterix.dataflow.data.nontagged.hash.AMurmurHash3BinaryHashFunctionFamily; -import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; -import org.apache.hyracks.algebricks.data.IBinaryHashFunctionFamilyProvider; -import org.apache.hyracks.api.dataflow.value.IBinaryHashFunctionFamily; - -/** - * We use a binary hash function that promotes numeric types (INT8,INT16,INT32,INT64,FLOAT) to DOUBLE if requested. - * Non-numeric types will be hashed without type promotion. - */ -public class AqlBinaryHashFunctionFamilyProvider implements IBinaryHashFunctionFamilyProvider, Serializable { - - private static final long serialVersionUID = 1L; - public static final AqlBinaryHashFunctionFamilyProvider INSTANCE = new AqlBinaryHashFunctionFamilyProvider(); - - private AqlBinaryHashFunctionFamilyProvider() { - - } - - @Override - public IBinaryHashFunctionFamily getBinaryHashFunctionFamily(Object type) throws AlgebricksException { - // AMurmurHash3BinaryHashFunctionFamily converts numeric type to double type before doing hash() - return AMurmurHash3BinaryHashFunctionFamily.INSTANCE; - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java deleted file mode 100644 index d7b3845..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryIntegerInspector.java +++ /dev/null @@ -1,45 +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.formats.nontagged; - -import org.apache.asterix.om.types.hierachy.ATypeHierarchy; -import org.apache.hyracks.algebricks.data.IBinaryIntegerInspector; -import org.apache.hyracks.algebricks.data.IBinaryIntegerInspectorFactory; -import org.apache.hyracks.api.context.IHyracksTaskContext; -import org.apache.hyracks.api.exceptions.HyracksDataException; - -public class AqlBinaryIntegerInspector implements IBinaryIntegerInspector { - - public static final IBinaryIntegerInspectorFactory FACTORY = new IBinaryIntegerInspectorFactory() { - private static final long serialVersionUID = 1L; - - @Override - public IBinaryIntegerInspector createBinaryIntegerInspector(IHyracksTaskContext ctx) { - return new AqlBinaryIntegerInspector(); - } - }; - - private AqlBinaryIntegerInspector() { - } - - @Override - public int getIntegerValue(byte[] bytes, int offset, int length) throws HyracksDataException { - return ATypeHierarchy.getIntegerValue("integer-inspector", 0, bytes, offset); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java deleted file mode 100644 index db8d6b6..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java +++ /dev/null @@ -1,85 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.common.AListElementTokenFactory; -import org.apache.asterix.dataflow.data.common.AOrderedListBinaryTokenizerFactory; -import org.apache.asterix.dataflow.data.common.AUnorderedListBinaryTokenizerFactory; -import org.apache.asterix.dataflow.data.common.IBinaryTokenizerFactoryProvider; -import org.apache.asterix.om.types.ATypeTag; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8WordTokenFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8NGramTokenFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8WordTokenFactory; - -public class AqlBinaryTokenizerFactoryProvider implements IBinaryTokenizerFactoryProvider { - - public static final AqlBinaryTokenizerFactoryProvider INSTANCE = new AqlBinaryTokenizerFactoryProvider(); - - private static final IBinaryTokenizerFactory aqlStringTokenizer = new DelimitedUTF8StringBinaryTokenizerFactory( - true, true, - new UTF8WordTokenFactory(ATypeTag.SERIALIZED_STRING_TYPE_TAG, ATypeTag.SERIALIZED_INT32_TYPE_TAG)); - - private static final IBinaryTokenizerFactory aqlHashingStringTokenizer = new DelimitedUTF8StringBinaryTokenizerFactory( - true, true, - new HashedUTF8WordTokenFactory(ATypeTag.SERIALIZED_INT32_TYPE_TAG, ATypeTag.SERIALIZED_INT32_TYPE_TAG)); - - private static final IBinaryTokenizerFactory orderedListTokenizer = new AOrderedListBinaryTokenizerFactory( - new AListElementTokenFactory()); - - private static final IBinaryTokenizerFactory unorderedListTokenizer = new AUnorderedListBinaryTokenizerFactory( - new AListElementTokenFactory()); - - @Override - public IBinaryTokenizerFactory getWordTokenizerFactory(ATypeTag typeTag, boolean hashedTokens) { - switch (typeTag) { - case STRING: - return hashedTokens ? aqlHashingStringTokenizer : aqlStringTokenizer; - case ORDEREDLIST: - return orderedListTokenizer; - case UNORDEREDLIST: - return unorderedListTokenizer; - default: - return null; - } - } - - @Override - public IBinaryTokenizerFactory getNGramTokenizerFactory(ATypeTag typeTag, int gramLength, boolean usePrePost, - boolean hashedTokens) { - switch (typeTag) { - case STRING: - if (hashedTokens) { - return null; - } else { - return new NGramUTF8StringBinaryTokenizerFactory(gramLength, usePrePost, true, true, - new UTF8NGramTokenFactory(ATypeTag.SERIALIZED_STRING_TYPE_TAG, - ATypeTag.SERIALIZED_INT32_TYPE_TAG)); - } - case ORDEREDLIST: - return orderedListTokenizer; - case UNORDEREDLIST: - return unorderedListTokenizer; - default: - return null; - } - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java deleted file mode 100644 index 265024f..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java +++ /dev/null @@ -1,148 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ABooleanPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ACirclePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADatePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADateTimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADayTimeDurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADoublePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AFloatPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AInt16PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AInt32PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AInt64PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AInt8PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AIntervalPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ALinePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ANullPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AOptionalFieldPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AObjectPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.APoint3DPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.APointPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.APolygonPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ARecordPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ARectanglePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AStringPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.ATimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AUnionPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.csv.AYearMonthDurationPrinterFactory; -import org.apache.asterix.om.types.ARecordType; -import org.apache.asterix.om.types.AUnionType; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException; -import org.apache.hyracks.algebricks.data.IPrinterFactory; -import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider; - -public class AqlCSVPrinterFactoryProvider implements IPrinterFactoryProvider { - - public static final AqlCSVPrinterFactoryProvider INSTANCE = new AqlCSVPrinterFactoryProvider(); - - private AqlCSVPrinterFactoryProvider() { - } - - @Override - public IPrinterFactory getPrinterFactory(Object type) { - IAType aqlType = (IAType) type; - - if (aqlType != null) { - switch (aqlType.getTypeTag()) { - case INT8: - return AInt8PrinterFactory.INSTANCE; - case INT16: - return AInt16PrinterFactory.INSTANCE; - case INT32: - return AInt32PrinterFactory.INSTANCE; - case INT64: - return AInt64PrinterFactory.INSTANCE; - case MISSING: - case NULL: - return ANullPrinterFactory.INSTANCE; - case BOOLEAN: - return ABooleanPrinterFactory.INSTANCE; - case FLOAT: - return AFloatPrinterFactory.INSTANCE; - case DOUBLE: - return ADoublePrinterFactory.INSTANCE; - case TIME: - return ATimePrinterFactory.INSTANCE; - case DATE: - return ADatePrinterFactory.INSTANCE; - case DATETIME: - return ADateTimePrinterFactory.INSTANCE; - case DURATION: - return ADurationPrinterFactory.INSTANCE; - case YEARMONTHDURATION: - return AYearMonthDurationPrinterFactory.INSTANCE; - case DAYTIMEDURATION: - return ADayTimeDurationPrinterFactory.INSTANCE; - case INTERVAL: - return AIntervalPrinterFactory.INSTANCE; - case POINT: - return APointPrinterFactory.INSTANCE; - case POINT3D: - return APoint3DPrinterFactory.INSTANCE; - case LINE: - return ALinePrinterFactory.INSTANCE; - case POLYGON: - return APolygonPrinterFactory.INSTANCE; - case CIRCLE: - return ACirclePrinterFactory.INSTANCE; - case RECTANGLE: - return ARectanglePrinterFactory.INSTANCE; - case STRING: - return AStringPrinterFactory.INSTANCE; - case RECORD: - return new ARecordPrinterFactory((ARecordType) aqlType); - case ORDEREDLIST: - throw new NotImplementedException("'Orderedlist' type unsupported for CSV output"); - case UNORDEREDLIST: - throw new NotImplementedException("'Unorderedlist' type unsupported for CSV output"); - case UNION: - if (((AUnionType) aqlType).isUnknownableType()) { - return new AOptionalFieldPrinterFactory((AUnionType) aqlType); - } else { - return new AUnionPrinterFactory((AUnionType) aqlType); - } - case UUID: - return AUUIDPrinterFactory.INSTANCE; - case SHORTWITHOUTTYPEINFO: - return ShortWithoutTypeInfoPrinterFactory.INSTANCE; - case ANY: - case BINARY: - case BITARRAY: - case ENUM: - case SPARSERECORD: - case SYSTEM_NULL: - case TYPE: - case UINT16: - case UINT32: - case UINT64: - case UINT8: - // These types are not intended to be printed to the user. - break; - } - } - return AObjectPrinterFactory.INSTANCE; - - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java deleted file mode 100644 index a25a9e9..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java +++ /dev/null @@ -1,152 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ABinaryHexPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ABooleanPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ACirclePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADatePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADateTimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADayTimeDurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADoublePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ADurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AFloatPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AInt16PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AInt32PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AInt64PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AInt8PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AIntervalPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ALinePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ANullPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AOptionalFieldPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AObjectPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AOrderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.APoint3DPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.APointPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.APolygonPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ARecordPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ARectanglePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AStringPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ATimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AUnionPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AUnorderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AYearMonthDurationPrinterFactory; -import org.apache.asterix.om.types.AOrderedListType; -import org.apache.asterix.om.types.ARecordType; -import org.apache.asterix.om.types.AUnionType; -import org.apache.asterix.om.types.AUnorderedListType; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.data.IPrinterFactory; -import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider; - -public class AqlCleanJSONPrinterFactoryProvider implements IPrinterFactoryProvider { - - public static final AqlCleanJSONPrinterFactoryProvider INSTANCE = new AqlCleanJSONPrinterFactoryProvider(); - - private AqlCleanJSONPrinterFactoryProvider() { - } - - @Override - public IPrinterFactory getPrinterFactory(Object type) { - IAType aqlType = (IAType) type; - - if (aqlType != null) { - switch (aqlType.getTypeTag()) { - case INT8: - return AInt8PrinterFactory.INSTANCE; - case INT16: - return AInt16PrinterFactory.INSTANCE; - case INT32: - return AInt32PrinterFactory.INSTANCE; - case INT64: - return AInt64PrinterFactory.INSTANCE; - case MISSING: - case NULL: - return ANullPrinterFactory.INSTANCE; - case BOOLEAN: - return ABooleanPrinterFactory.INSTANCE; - case FLOAT: - return AFloatPrinterFactory.INSTANCE; - case DOUBLE: - return ADoublePrinterFactory.INSTANCE; - case TIME: - return ATimePrinterFactory.INSTANCE; - case DATE: - return ADatePrinterFactory.INSTANCE; - case DATETIME: - return ADateTimePrinterFactory.INSTANCE; - case DURATION: - return ADurationPrinterFactory.INSTANCE; - case YEARMONTHDURATION: - return AYearMonthDurationPrinterFactory.INSTANCE; - case DAYTIMEDURATION: - return ADayTimeDurationPrinterFactory.INSTANCE; - case INTERVAL: - return AIntervalPrinterFactory.INSTANCE; - case POINT: - return APointPrinterFactory.INSTANCE; - case POINT3D: - return APoint3DPrinterFactory.INSTANCE; - case LINE: - return ALinePrinterFactory.INSTANCE; - case POLYGON: - return APolygonPrinterFactory.INSTANCE; - case CIRCLE: - return ACirclePrinterFactory.INSTANCE; - case RECTANGLE: - return ARectanglePrinterFactory.INSTANCE; - case STRING: - return AStringPrinterFactory.INSTANCE; - case BINARY: - return ABinaryHexPrinterFactory.INSTANCE; - case RECORD: - return new ARecordPrinterFactory((ARecordType) aqlType); - case ORDEREDLIST: - return new AOrderedlistPrinterFactory((AOrderedListType) aqlType); - case UNORDEREDLIST: - return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType); - case UNION: - if (((AUnionType) aqlType).isUnknownableType()) { - return new AOptionalFieldPrinterFactory((AUnionType) aqlType); - } else { - return new AUnionPrinterFactory((AUnionType) aqlType); - } - case UUID: - return AUUIDPrinterFactory.INSTANCE; - case SHORTWITHOUTTYPEINFO: - return ShortWithoutTypeInfoPrinterFactory.INSTANCE; - case ANY: - case BITARRAY: - case ENUM: - case SPARSERECORD: - case SYSTEM_NULL: - case TYPE: - case UINT16: - case UINT32: - case UINT64: - case UINT8: - // These types are not intended to be printed to the user. - break; - } - } - return AObjectPrinterFactory.INSTANCE; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLinearizeComparatorFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLinearizeComparatorFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLinearizeComparatorFactoryProvider.java deleted file mode 100644 index c6cccfc..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLinearizeComparatorFactoryProvider.java +++ /dev/null @@ -1,103 +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.formats.nontagged; - -import java.io.Serializable; - -import org.apache.asterix.om.types.ATypeTag; -import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; -import org.apache.hyracks.algebricks.data.ILinearizeComparatorFactoryProvider; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparator; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparatorFactory; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.rtree.linearize.HilbertDoubleComparatorFactory; -import org.apache.hyracks.storage.am.rtree.linearize.ZCurveDoubleComparatorFactory; -import org.apache.hyracks.storage.am.rtree.linearize.ZCurveIntComparatorFactory; - -public class AqlLinearizeComparatorFactoryProvider implements ILinearizeComparatorFactoryProvider, Serializable { - - private static final long serialVersionUID = 1L; - public static final AqlLinearizeComparatorFactoryProvider INSTANCE = new AqlLinearizeComparatorFactoryProvider(); - - private AqlLinearizeComparatorFactoryProvider() { - } - - @Override - public ILinearizeComparatorFactory getLinearizeComparatorFactory(Object type, boolean ascending, int dimension) - throws AlgebricksException { - ATypeTag typeTag = (ATypeTag) type; - - if (dimension == 2 && (typeTag == ATypeTag.DOUBLE)) { - return addOffset(new HilbertDoubleComparatorFactory(2), ascending); - } else if (typeTag == ATypeTag.DOUBLE) { - return addOffset(new ZCurveDoubleComparatorFactory(dimension), ascending); - } else if (typeTag == ATypeTag.INT8 || typeTag == ATypeTag.INT16 || typeTag == ATypeTag.INT32 - || typeTag == ATypeTag.INT64) { - return addOffset(new ZCurveIntComparatorFactory(dimension), ascending); - } else { - throw new AlgebricksException("Cannot propose linearizer for key with type " + typeTag + " and dimension " - + dimension + "."); - } - } - - private ILinearizeComparatorFactory addOffset(final IBinaryComparatorFactory inst, final boolean ascending) { - return new ILinearizeComparatorFactory() { - - private static final long serialVersionUID = 1L; - - @Override - public ILinearizeComparator createBinaryComparator() { - final ILinearizeComparator bc = (ILinearizeComparator) inst.createBinaryComparator(); - final int dimension = bc.getDimensions(); - if (ascending) { - return new ILinearizeComparator() { - - @Override - public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) - throws HyracksDataException { - return bc.compare(b1, s1 + 1, l1, b2, s2 + 1, l2); - } - - @Override - public int getDimensions() { - // TODO Auto-generated method stub - return dimension; - } - }; - } else { - return new ILinearizeComparator() { - - @Override - public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) - throws HyracksDataException { - return -bc.compare(b1, s1 + 1, l1, b2, s2 + 1, l2); - } - - @Override - public int getDimensions() { - // TODO Auto-generated method stub - return dimension; - } - }; - } - } - }; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java deleted file mode 100644 index 3ec3801..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java +++ /dev/null @@ -1,152 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ABinaryHexPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ABooleanPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ACirclePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ADatePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ADateTimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ADayTimeDurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ADoublePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ADurationPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AFloatPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AInt16PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AInt32PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AInt64PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AInt8PrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AIntervalPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ALinePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ANullPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AOptionalFieldPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AObjectPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AOrderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.APoint3DPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.APointPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.APolygonPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ARecordPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ARectanglePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AStringPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ATimePrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AUnionPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AUnorderedlistPrinterFactory; -import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AYearMonthDurationPrinterFactory; -import org.apache.asterix.om.types.AOrderedListType; -import org.apache.asterix.om.types.ARecordType; -import org.apache.asterix.om.types.AUnionType; -import org.apache.asterix.om.types.AUnorderedListType; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.data.IPrinterFactory; -import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider; - -public class AqlLosslessJSONPrinterFactoryProvider implements IPrinterFactoryProvider { - - public static final AqlLosslessJSONPrinterFactoryProvider INSTANCE = new AqlLosslessJSONPrinterFactoryProvider(); - - private AqlLosslessJSONPrinterFactoryProvider() { - } - - @Override - public IPrinterFactory getPrinterFactory(Object type) { - IAType aqlType = (IAType) type; - - if (aqlType != null) { - switch (aqlType.getTypeTag()) { - case INT8: - return AInt8PrinterFactory.INSTANCE; - case INT16: - return AInt16PrinterFactory.INSTANCE; - case INT32: - return AInt32PrinterFactory.INSTANCE; - case INT64: - return AInt64PrinterFactory.INSTANCE; - case MISSING: - case NULL: - return ANullPrinterFactory.INSTANCE; - case BOOLEAN: - return ABooleanPrinterFactory.INSTANCE; - case FLOAT: - return AFloatPrinterFactory.INSTANCE; - case DOUBLE: - return ADoublePrinterFactory.INSTANCE; - case TIME: - return ATimePrinterFactory.INSTANCE; - case DATE: - return ADatePrinterFactory.INSTANCE; - case DATETIME: - return ADateTimePrinterFactory.INSTANCE; - case DURATION: - return ADurationPrinterFactory.INSTANCE; - case YEARMONTHDURATION: - return AYearMonthDurationPrinterFactory.INSTANCE; - case DAYTIMEDURATION: - return ADayTimeDurationPrinterFactory.INSTANCE; - case INTERVAL: - return AIntervalPrinterFactory.INSTANCE; - case POINT: - return APointPrinterFactory.INSTANCE; - case POINT3D: - return APoint3DPrinterFactory.INSTANCE; - case LINE: - return ALinePrinterFactory.INSTANCE; - case POLYGON: - return APolygonPrinterFactory.INSTANCE; - case CIRCLE: - return ACirclePrinterFactory.INSTANCE; - case RECTANGLE: - return ARectanglePrinterFactory.INSTANCE; - case STRING: - return AStringPrinterFactory.INSTANCE; - case BINARY: - return ABinaryHexPrinterFactory.INSTANCE; - case RECORD: - return new ARecordPrinterFactory((ARecordType) aqlType); - case ORDEREDLIST: - return new AOrderedlistPrinterFactory((AOrderedListType) aqlType); - case UNORDEREDLIST: - return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType); - case UNION: - if (((AUnionType) aqlType).isUnknownableType()) { - return new AOptionalFieldPrinterFactory((AUnionType) aqlType); - } else { - return new AUnionPrinterFactory((AUnionType) aqlType); - } - case UUID: - return AUUIDPrinterFactory.INSTANCE; - case SHORTWITHOUTTYPEINFO: - return ShortWithoutTypeInfoPrinterFactory.INSTANCE; - case ANY: - case BITARRAY: - case ENUM: - case SPARSERECORD: - case SYSTEM_NULL: - case TYPE: - case UINT16: - case UINT32: - case UINT64: - case UINT8: - // These types are not intended to be printed to the user. - break; - } - } - return AObjectPrinterFactory.INSTANCE; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java deleted file mode 100644 index a819b67..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java +++ /dev/null @@ -1,89 +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.formats.nontagged; - -import org.apache.asterix.dataflow.data.nontagged.keynormalizers.AWrappedAscNormalizedKeyComputerFactory; -import org.apache.asterix.dataflow.data.nontagged.keynormalizers.AWrappedDescNormalizedKeyComputerFactory; -import org.apache.asterix.om.types.IAType; -import org.apache.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider; -import org.apache.hyracks.api.dataflow.value.INormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.ByteArrayNormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.DoubleNormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.FloatNormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.Integer64NormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.IntegerNormalizedKeyComputerFactory; -import org.apache.hyracks.dataflow.common.data.normalizers.UTF8StringNormalizedKeyComputerFactory; - -public class AqlNormalizedKeyComputerFactoryProvider implements INormalizedKeyComputerFactoryProvider { - - public static final AqlNormalizedKeyComputerFactoryProvider INSTANCE = new AqlNormalizedKeyComputerFactoryProvider(); - - private AqlNormalizedKeyComputerFactoryProvider() { - } - - @Override - public INormalizedKeyComputerFactory getNormalizedKeyComputerFactory(Object type, boolean ascending) { - IAType aqlType = (IAType) type; - if (ascending) { - switch (aqlType.getTypeTag()) { - case DATE: - case TIME: - case YEARMONTHDURATION: - case INT32: - return new AWrappedAscNormalizedKeyComputerFactory(new IntegerNormalizedKeyComputerFactory()); - case DATETIME: - case DAYTIMEDURATION: - case INT64: - return new AWrappedAscNormalizedKeyComputerFactory(new Integer64NormalizedKeyComputerFactory()); - case FLOAT: - return new AWrappedAscNormalizedKeyComputerFactory(new FloatNormalizedKeyComputerFactory()); - case DOUBLE: - return new AWrappedAscNormalizedKeyComputerFactory(new DoubleNormalizedKeyComputerFactory()); - case STRING: - return new AWrappedAscNormalizedKeyComputerFactory(new UTF8StringNormalizedKeyComputerFactory()); - case BINARY: - return new AWrappedAscNormalizedKeyComputerFactory(new ByteArrayNormalizedKeyComputerFactory()); - default: - return null; - } - } else { - switch (aqlType.getTypeTag()) { - case DATE: - case TIME: - case YEARMONTHDURATION: - case INT32: - return new AWrappedDescNormalizedKeyComputerFactory(new IntegerNormalizedKeyComputerFactory()); - case DATETIME: - case DAYTIMEDURATION: - case INT64: - return new AWrappedDescNormalizedKeyComputerFactory(new Integer64NormalizedKeyComputerFactory()); - case FLOAT: - return new AWrappedDescNormalizedKeyComputerFactory(new FloatNormalizedKeyComputerFactory()); - case DOUBLE: - return new AWrappedDescNormalizedKeyComputerFactory(new DoubleNormalizedKeyComputerFactory()); - case STRING: - return new AWrappedDescNormalizedKeyComputerFactory(new UTF8StringNormalizedKeyComputerFactory()); - case BINARY: - return new AWrappedDescNormalizedKeyComputerFactory(new ByteArrayNormalizedKeyComputerFactory()); - default: - return null; - } - } - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8a742fd1/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlPredicateEvaluatorFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlPredicateEvaluatorFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlPredicateEvaluatorFactoryProvider.java deleted file mode 100644 index a30bada..0000000 --- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlPredicateEvaluatorFactoryProvider.java +++ /dev/null @@ -1,83 +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.formats.nontagged; - -import org.apache.asterix.om.types.ATypeTag; -import org.apache.asterix.om.types.EnumDeserializer; -import org.apache.hyracks.api.comm.IFrameTupleAccessor; -import org.apache.hyracks.api.dataflow.value.IPredicateEvaluator; -import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactory; -import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider; - -/* -Provides PredicateEvaluator for equi-join cases to properly take care of NULL fields, being compared with each other. -If any of the join keys, from either side, is NULL, record should not pass equi-join condition. -*/ -public class AqlPredicateEvaluatorFactoryProvider implements IPredicateEvaluatorFactoryProvider { - - private static final long serialVersionUID = 1L; - public static final AqlPredicateEvaluatorFactoryProvider INSTANCE = new AqlPredicateEvaluatorFactoryProvider(); - - @Override - public IPredicateEvaluatorFactory getPredicateEvaluatorFactory(final int[] keys0, final int[] keys1) { - - return new IPredicateEvaluatorFactory() { - private static final long serialVersionUID = 1L; - - @Override - public IPredicateEvaluator createPredicateEvaluator() { - return new IPredicateEvaluator() { - - @Override - public boolean evaluate(IFrameTupleAccessor fta0, int tupId0, IFrameTupleAccessor fta1, - int tupId1) { - - int tStart0 = fta0.getTupleStartOffset(tupId0); - int fStartOffset0 = fta0.getFieldSlotsLength() + tStart0; - - for (int k0 : keys0) { - int fieldStartIx = fta0.getFieldStartOffset(tupId0, k0); - ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER - .deserialize(fta0.getBuffer().array()[fieldStartIx + fStartOffset0]); - if (typeTag == ATypeTag.MISSING || typeTag == ATypeTag.NULL) { - return false; - } - } - - int tStart1 = fta1.getTupleStartOffset(tupId1); - int fStartOffset1 = fta1.getFieldSlotsLength() + tStart1; - - for (int k1 : keys1) { - int fieldStartIx = fta1.getFieldStartOffset(tupId1, k1); - ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER - .deserialize(fta1.getBuffer().array()[fieldStartIx + fStartOffset1]); - if (typeTag == ATypeTag.MISSING || typeTag == ATypeTag.NULL) { - return false; - } - } - - return true; //none of the fields (from both sides) is NULL - } - }; - } - }; - } - -}