ASTERIXDB-1261, ASTERIXDB-1274, ASTERIXDB-1275 UUID Fixes
UUIDPrinter no longer has a UUID object
UUIDComparator is used by AbstractComparisonEValuator
Removed UUID_STRING type
Added test for uuid comparator
Change-Id: Ie33dc8b02e32b3e85a3cb64ef08cb028a50f4ca0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/587
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.1.ddl.aql
new file mode 100644
index 0000000..b8b7c80
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.1.ddl.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+drop dataverse channels if exists;
+create dataverse channels;
+use dataverse channels;
+
+create type TypeA as closed
+{ "resultId":uuid, "subscriptionId":uuid, "deliveryTime":datetime }
+
+create dataset nearbyTweetChannelResults(TypeA)
+primary key resultId autogenerated;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.2.update.aql
new file mode 100644
index 0000000..0d435a0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.2.update.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse channels;
+
+insert into dataset nearbyTweetChannelResults(
+{"subscriptionId":uuid("d0b6fac0-3903-43dc-8ef6-7b0923ffc759"), "deliveryTime":datetime("2011-08-25T10:10:00.000Z")}
+);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.3.query.aql
new file mode 100644
index 0000000..cd006ad
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/uuid_1/uuid_01.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+use dataverse channels;
+for $result in dataset nearbyTweetChannelResults
+where $result.subscriptionId=uuid("d0b6fac0-3903-43dc-8ef6-7b0923ffc759")
+return $result.subscriptionId;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/uuid_1/uuid_1.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/uuid_1/uuid_1.1.adm
new file mode 100644
index 0000000..6e8a7b7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/uuid_1/uuid_1.1.adm
@@ -0,0 +1 @@
+uuid("d0b6fac0-3903-43dc-8ef6-7b0923ffc759")
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 375d05a..2e0c073 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1160,6 +1160,11 @@
<output-dir compare="Text">binary_null</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="comparison">
+ <compilation-unit name="uuid_1">
+ <output-dir compare="Text">uuid_1</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="constructor">
<test-case FilePath="constructor">
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
index 6a3d61d..1d2650d 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
@@ -169,7 +169,6 @@
case UINT64:
case UINT8:
case UNION:
- case UUID_STRING:
// These are internal types and do not need a printer.
throw new NotImplementedException("No printer for type " + typeTag);
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
index c1b6b81..86cb7ac 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
@@ -21,7 +21,7 @@
import java.io.PrintStream;
-import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.asterix.om.base.AUUID;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.data.std.primitive.LongPointable;
@@ -29,8 +29,6 @@
public class AUUIDPrinter implements IPrinter {
public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
- // We use mutable UUID not to create a UUID object multiple times.
- AMutableUUID uuid = new AMutableUUID(0, 0);
@Override
public void init() throws AlgebricksException {
@@ -40,9 +38,8 @@
public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
long msb = LongPointable.getLong(b, s + 1);
long lsb = LongPointable.getLong(b, s + 9);
- uuid.setValue(msb, lsb);
- ps.print("uuid(\"" + uuid.toStringLiteralOnly() + "\")");
+ ps.print("uuid(\"" + AUUID.toStringLiteralOnly(msb, lsb) + "\")");
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
index 137597c..319476f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
@@ -148,7 +148,6 @@
case UNION:
case UNORDEREDLIST:
case UUID:
- case UUID_STRING:
throw new NotImplementedException("No printer for type " + typeTag);
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
index 34dd3a2..967131f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
@@ -19,18 +19,16 @@
package org.apache.asterix.dataflow.data.nontagged.printers.csv;
-import org.apache.asterix.om.base.AMutableUUID;
+import java.io.PrintStream;
+
+import org.apache.asterix.om.base.AUUID;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.data.std.primitive.LongPointable;
-import java.io.PrintStream;
-
public class AUUIDPrinter implements IPrinter {
public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
- // We use mutable UUID not to create a UUID object multiple times.
- AMutableUUID uuid = new AMutableUUID(0, 0);
@Override
public void init() throws AlgebricksException {
@@ -40,9 +38,8 @@
public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
long msb = LongPointable.getLong(b, s + 1);
long lsb = LongPointable.getLong(b, s + 9);
- uuid.setValue(msb, lsb);
- ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+ ps.print("\"" + AUUID.toStringLiteralOnly(msb, lsb) + "\"");
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
index 8f06d77..2d5a8f6 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AObjectPrinter.java
@@ -103,7 +103,7 @@
AIntervalPrinter.INSTANCE.print(b, s, l, ps);
break;
}
- case POINT: {
+ case POINT: {
APointPrinter.INSTANCE.print(b, s, l, ps);
break;
}
@@ -166,7 +166,6 @@
case UINT64:
case UINT8:
case UNION:
- case UUID_STRING:
throw new NotImplementedException("No printer for type " + typeTag);
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinter.java
index 4057bbe..20b87c2 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUUIDPrinter.java
@@ -19,18 +19,16 @@
package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
-import org.apache.asterix.om.base.AMutableUUID;
+import java.io.PrintStream;
+
+import org.apache.asterix.om.base.AUUID;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.data.std.primitive.LongPointable;
-import java.io.PrintStream;
-
public class AUUIDPrinter implements IPrinter {
public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
- // We use mutable UUID not to create a UUID object multiple times.
- AMutableUUID uuid = new AMutableUUID(0, 0);
@Override
public void init() throws AlgebricksException {
@@ -40,9 +38,8 @@
public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
long msb = LongPointable.getLong(b, s + 1);
long lsb = LongPointable.getLong(b, s + 9);
- uuid.setValue(msb, lsb);
- ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+ ps.print("\"" + AUUID.toStringLiteralOnly(msb, lsb) + "\"");
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AObjectPrinter.java
index 1f610d0..561b5d9 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AObjectPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AObjectPrinter.java
@@ -103,7 +103,7 @@
AIntervalPrinter.INSTANCE.print(b, s, l, ps);
break;
}
- case POINT: {
+ case POINT: {
APointPrinter.INSTANCE.print(b, s, l, ps);
break;
}
@@ -166,7 +166,6 @@
case UINT64:
case UINT8:
case UNION:
- case UUID_STRING:
throw new NotImplementedException("No printer for type " + typeTag);
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AUUIDPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AUUIDPrinter.java
index 0c955b5..f21cdff 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AUUIDPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AUUIDPrinter.java
@@ -19,18 +19,16 @@
package org.apache.asterix.dataflow.data.nontagged.printers.json.lossless;
-import org.apache.asterix.om.base.AMutableUUID;
+import java.io.PrintStream;
+
+import org.apache.asterix.om.base.AUUID;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
import org.apache.hyracks.data.std.primitive.LongPointable;
-import java.io.PrintStream;
-
public class AUUIDPrinter implements IPrinter {
public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
- // We use mutable UUID not to create a UUID object multiple times.
- AMutableUUID uuid = new AMutableUUID(0, 0);
@Override
public void init() throws AlgebricksException {
@@ -40,9 +38,8 @@
public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
long msb = LongPointable.getLong(b, s + 1);
long lsb = LongPointable.getLong(b, s + 9);
- uuid.setValue(msb, lsb);
- ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+ ps.print("\"" + AUUID.toStringLiteralOnly(msb, lsb) + "\"");
}
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
deleted file mode 100644
index 72c9388..0000000
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
+++ /dev/null
@@ -1,58 +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.dataflow.data.nontagged.serde;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.asterix.om.base.AUUID;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
-
-public class AUUIDStringSerializerDeserializer implements ISerializerDeserializer<AUUID> {
-
- private static final long serialVersionUID = 1L;
-
- public static final AUUIDStringSerializerDeserializer INSTANCE = new AUUIDStringSerializerDeserializer();
-
- private AUUIDStringSerializerDeserializer() {
- }
-
- // Conversion from the String format (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) to an AUUID instance correspondence
- @Override
- public AUUID deserialize(DataInput in) throws HyracksDataException {
- try {
- return AUUID.fromString(new String(new UTF8StringSerializerDeserializer().deserialize(in)));
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
-
- // Conversion from an AUUID instance to the String format (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) correspondence
- @Override
- public void serialize(AUUID instance, DataOutput out) throws HyracksDataException {
- try {
- new UTF8StringSerializerDeserializer().serialize(instance.toStringLiteralOnly(), out);
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
-}
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
index 19174f6..b51b4a4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
@@ -144,7 +144,6 @@
case UINT32:
case UINT64:
case UINT8:
- case UUID_STRING:
// These types are not intended to be printed to the user.
break;
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
index f4c8156..103e3ee 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
@@ -138,7 +138,6 @@
case UINT32:
case UINT64:
case UINT8:
- case UUID_STRING:
// These types are not intended to be printed to the user.
break;
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
index 302ecd8..7eff19b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
@@ -144,7 +144,6 @@
case UINT32:
case UINT64:
case UINT8:
- case UUID_STRING:
// These types are not intended to be printed to the user.
break;
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
index 5f8867a..c79ecbd 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
@@ -144,7 +144,6 @@
case UINT32:
case UINT64:
case UINT8:
- case UUID_STRING:
// These types are not intended to be printed to the user.
break;
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
index 9be8cae..99a6d2f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
@@ -18,6 +18,11 @@
*/
package org.apache.asterix.formats.nontagged;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+
import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.ACircleSerializerDeserializer;
@@ -44,7 +49,6 @@
import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AUUIDSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AUUIDStringSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.SerializerDeserializerUtil;
@@ -61,11 +65,6 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.dataflow.common.data.marshalling.ShortSerializerDeserializer;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-
public class AqlSerializerDeserializerProvider implements ISerializerDeserializerProvider, Serializable {
private static final long serialVersionUID = 1L;
@@ -176,9 +175,6 @@
case UUID: {
return AUUIDSerializerDeserializer.INSTANCE;
}
- case UUID_STRING: {
- return AUUIDStringSerializerDeserializer.INSTANCE;
- }
case SHORTWITHOUTTYPEINFO: {
return ShortSerializerDeserializer.INSTANCE;
}
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java b/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
index 1fe237c..bb54988 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/base/AUUID.java
@@ -22,13 +22,12 @@
import java.security.SecureRandom;
import java.util.UUID;
-import org.json.JSONException;
-import org.json.JSONObject;
-
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.visitors.IOMVisitor;
+import org.json.JSONException;
+import org.json.JSONObject;
public class AUUID implements IAObject {
@@ -135,14 +134,18 @@
@Override
public String toString() {
- return "AUUID: {"
- + (digits(msb >> 32, 8) + "-" + digits(msb >> 16, 4) + "-" + digits(msb, 4) + "-"
- + digits(lsb >> 48, 4) + "-" + digits(lsb, 12)) + "}";
+ return "AUUID: {" + toStringLiteralOnly(msb, lsb) + "}";
+
}
public String toStringLiteralOnly() {
- return digits(msb >> 32, 8) + "-" + digits(msb >> 16, 4) + "-" + digits(msb, 4) + "-" + digits(lsb >> 48, 4)
- + "-" + digits(lsb, 12);
+ return toStringLiteralOnly(msb, lsb);
+ }
+
+ public static String toStringLiteralOnly(long msbValue, long lsbValue) {
+ return digits(msbValue >> 32, 8) + "-" + digits(msbValue >> 16, 4) + "-" + digits(msbValue, 4) + "-"
+ + digits(lsbValue >> 48, 4) + "-" + digits(lsbValue, 12);
+
}
// Since AUUID is a wrapper of java.util.uuid,
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
index 3587cda..0a341f0 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
@@ -67,7 +67,6 @@
YEARMONTHDURATION(36),
DAYTIMEDURATION(37),
UUID(38),
- UUID_STRING(39),
SHORTWITHOUTTYPEINFO(40);
private byte value;
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java b/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
index 0c0fdaa..620b9ae 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/BuiltinType.java
@@ -742,34 +742,6 @@
}
};
- // AUUID_STRING is used when converting between the string representation of
- // UUID and corresponding a UUID instance
- public static final BuiltinType AUUID_STRING = new LowerCaseConstructorType() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public ATypeTag getTypeTag() {
- return ATypeTag.UUID_STRING;
- }
-
- @Override
- public String getDisplayName() {
- return "UUID_STRING";
- }
-
- @Override
- public String getTypeName() {
- return "uuid_string";
- }
-
- @Override
- public JSONObject toJSON() throws JSONException {
- JSONObject type = new JSONObject();
- type.put("type", getDisplayName());
- return type;
- }
- };
-
public static final BuiltinType ANY = new BuiltinType() {
private static final long serialVersionUID = 1L;
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/TypeTagUtil.java b/asterix-om/src/main/java/org/apache/asterix/om/types/TypeTagUtil.java
index ae7490c..a73ff73 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/TypeTagUtil.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/TypeTagUtil.java
@@ -78,8 +78,6 @@
return BuiltinType.ADAYTIMEDURATION;
case UUID:
return BuiltinType.AUUID;
- case UUID_STRING:
- return BuiltinType.AUUID_STRING;
default:
throw new AsterixException("Typetag " + typeTag + " is not a built-in type");
}
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index 44b3752..356a77b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -29,6 +29,7 @@
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.serde.ADoubleSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
@@ -96,6 +97,9 @@
.createBinaryComparator();
protected IBinaryComparator rectangleBinaryComparator = ARectanglePartialBinaryComparatorFactory.INSTANCE
.createBinaryComparator();
+ protected IBinaryComparator uuidBinaryComparator = AUUIDPartialBinaryComparatorFactory.INSTANCE
+ .createBinaryComparator();
+
protected final IBinaryComparator byteArrayComparator = new PointableBinaryComparatorFactory(
ByteArrayPointable.FACTORY).createBinaryComparator();
@@ -127,8 +131,8 @@
case POLYGON:
case CIRCLE:
case RECTANGLE:
- throw new AlgebricksException("Comparison operations (GT, GE, LT, and LE) for the " + typeTag
- + " type are not defined.");
+ throw new AlgebricksException(
+ "Comparison operations (GT, GE, LT, and LE) for the " + typeTag + " type are not defined.");
default:
return;
}
@@ -203,8 +207,8 @@
private ComparisonResult compareStrongTypedWithArg(ATypeTag expectedTypeTag, ATypeTag actualTypeTag)
throws AlgebricksException {
if (expectedTypeTag != actualTypeTag) {
- throw new AlgebricksException("Comparison is undefined between " + expectedTypeTag + " and "
- + actualTypeTag + ".");
+ throw new AlgebricksException(
+ "Comparison is undefined between " + expectedTypeTag + " and " + actualTypeTag + ".");
}
int result = 0;
try {
@@ -256,6 +260,10 @@
result = byteArrayComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
outRight.getByteArray(), 1, outRight.getLength() - 1);
break;
+ case UUID:
+ result = uuidBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+ outRight.getByteArray(), 1, outRight.getLength() - 1);
+ break;
default:
throw new AlgebricksException("Comparison for " + actualTypeTag + " is not supported.");
}