Taewoo Kim has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/326
Change subject: Added the UUID constructor and changed the relevant
documentation
......................................................................
Added the UUID constructor and changed the relevant documentation
Change-Id: I2276bf2b44975b13c99d56f448ae3e9e4a74b04e
---
M asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.ddl.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.2.update.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.query.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.ddl.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.2.update.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.query.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.ddl.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.2.update.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.query.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.ddl.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.2.update.aql
A
asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.query.aql
A
asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.adm
A
asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.adm
A
asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.adm
A
asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_02.1.adm
A
asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.adm
M asterix-app/src/test/resources/runtimets/testsuite.xml
M asterix-doc/src/site/markdown/aql/datamodel.md
M asterix-doc/src/site/markdown/aql/manual.md
M asterix-doc/src/site/markdown/aql/primer-sql-like.md
M asterix-doc/src/site/markdown/aql/primer.md
M
asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
M asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
M
asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
M
asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
A
asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDStringConstructorDescriptor.java
M
asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
29 files changed, 352 insertions(+), 64 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/26/326/1
diff --git
a/asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
b/asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
index 174e408..89edfb1 100644
---
a/asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
+++
b/asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
@@ -1,10 +1,10 @@
-{"id": "89fb1567-70f8-4e59-87d9-ace64f73daf1", "dblpid":
"books/acm/kim95/Blakeley95", "title": "OQL[C++] Extending C++ with an Object
Query Capability.", "authors": "José A. Blakeley", "misc": "2002-01-03 69-88
Modern Database Systems db/books/collections/kim95.html#Blakeley95 1995" }
-{"id": "8cea25ab-55f8-467e-929d-94888f754832", "dblpid":
"books/acm/kim95/ChristodoulakisK95", "title": "Multimedia Information Systems
Issues and Approaches.", "authors": "Stavros Christodoulakis Leonidas Koveos",
"misc": "2002-01-03 318-337 1995 Modern Database Systems
db/books/collections/kim95.html#ChristodoulakisK95" }
-{"id": "8d59a28c-dfde-404b-a6a4-de2acefbcd88", "dblpid":
"books/acm/kim95/DittrichD95", "title": "Where Object-Oriented DBMSs Should Do
Better A Critique Based on Early Experiences.", "authors": "Angelika Kotz
Dittrich Klaus R. Dittrich", "misc": "2002-01-03 238-254 1995 Modern Database
Systems db/books/collections/kim95.html#DittrichD95" }
-{"id": "8d68c3e2-5101-479e-9dbb-5dc59d3d465c", "dblpid":
"books/acm/kim95/Goodman95", "title": "An Object-Oriented DBMS War Story
Developing a Genome Mapping Database in C++.", "authors": "Nathan Goodman",
"misc": "2002-01-03 216-237 1995 Modern Database Systems
db/books/collections/kim95.html#Goodman95" }
-{"id": "9171b105-e2e0-4ebd-b7ae-d1c2914b3233", "dblpid":
"books/acm/kim95/KelleyGKRG95", "title": "Schema Architecture of the UniSQL/M
Multidatabase System", "authors": "William Kelley Sunit K. Gala Won Kim Tom C.
Reyes Bruce Graham", "misc": "2004-03-08 Modern Database Systems
books/acm/Kim95 621-648 1995 db/books/collections/kim95.html#KelleyGKRG95" }
-{"id": "93e4d3ec-a6c9-4a71-a8a1-d8a827250c72", "dblpid":
"books/acm/kim95/Kim95", "title": "Introduction to Part 1 Next-Generation
Database Technology.", "authors": "Won Kim", "misc": "2002-01-03 5-17 1995
Modern Database Systems db/books/collections/kim95.html#Kim95" }
-{"id": "9816c851-7232-498b-9eb3-5fed80f46307", "dblpid":
"books/acm/kim95/Kim95b", "title": "Introduction to Part 2 Technology for
Interoperating Legacy Databases.", "authors": "Won Kim", "misc": "2002-01-03
515-520 1995 Modern Database Systems db/books/collections/kim95.html#Kim95b" }
-{"id": "00f3969c-8427-47cd-9bd3-201cd931af9c", "dblpid":
"books/acm/kim95/KimG95", "title": "Requirements for a Performance Benchmark
for Object-Oriented Database Systems.", "authors": "Won Kim Jorge F. Garza",
"misc": "2002-01-03 203-215 1995 Modern Database Systems
db/books/collections/kim95.html#KimG95" }
-{"id": "01d75219-1d25-4a52-a651-d81dca2f9330", "dblpid":
"books/acm/kim95/Kowalski95", "title": "The POSC Solution to Managing E&P
Data.", "authors": "Vincent J. Kowalski", "misc": "2002-01-03 281-301 1995
Modern Database Systems db/books/collections/kim95.html#Kowalski95" }
-{"id": "02a199ca-bf58-412e-bd9f-60a0c975a8ac", "dblpid":
"books/acm/kim95/Lunt95", "title": "Authorization in Object-Oriented
Databases.", "authors": "Teresa F. Lunt", "misc": "2002-01-03 130-145 1995
Modern Database Systems db/books/collections/kim95.html#Lunt95" }
+{"id": uuid("89fb1567-70f8-4e59-87d9-ace64f73daf1"), "dblpid":
"books/acm/kim95/Blakeley95", "title": "OQL[C++] Extending C++ with an Object
Query Capability.", "authors": "José A. Blakeley", "misc": "2002-01-03 69-88
Modern Database Systems db/books/collections/kim95.html#Blakeley95 1995" }
+{"id": uuid("8cea25ab-55f8-467e-929d-94888f754832"), "dblpid":
"books/acm/kim95/ChristodoulakisK95", "title": "Multimedia Information Systems
Issues and Approaches.", "authors": "Stavros Christodoulakis Leonidas Koveos",
"misc": "2002-01-03 318-337 1995 Modern Database Systems
db/books/collections/kim95.html#ChristodoulakisK95" }
+{"id": uuid("8d59a28c-dfde-404b-a6a4-de2acefbcd88"), "dblpid":
"books/acm/kim95/DittrichD95", "title": "Where Object-Oriented DBMSs Should Do
Better A Critique Based on Early Experiences.", "authors": "Angelika Kotz
Dittrich Klaus R. Dittrich", "misc": "2002-01-03 238-254 1995 Modern Database
Systems db/books/collections/kim95.html#DittrichD95" }
+{"id": uuid("8d68c3e2-5101-479e-9dbb-5dc59d3d465c"), "dblpid":
"books/acm/kim95/Goodman95", "title": "An Object-Oriented DBMS War Story
Developing a Genome Mapping Database in C++.", "authors": "Nathan Goodman",
"misc": "2002-01-03 216-237 1995 Modern Database Systems
db/books/collections/kim95.html#Goodman95" }
+{"id": uuid("9171b105-e2e0-4ebd-b7ae-d1c2914b3233"), "dblpid":
"books/acm/kim95/KelleyGKRG95", "title": "Schema Architecture of the UniSQL/M
Multidatabase System", "authors": "William Kelley Sunit K. Gala Won Kim Tom C.
Reyes Bruce Graham", "misc": "2004-03-08 Modern Database Systems
books/acm/Kim95 621-648 1995 db/books/collections/kim95.html#KelleyGKRG95" }
+{"id": uuid("93e4d3ec-a6c9-4a71-a8a1-d8a827250c72"), "dblpid":
"books/acm/kim95/Kim95", "title": "Introduction to Part 1 Next-Generation
Database Technology.", "authors": "Won Kim", "misc": "2002-01-03 5-17 1995
Modern Database Systems db/books/collections/kim95.html#Kim95" }
+{"id": uuid("9816c851-7232-498b-9eb3-5fed80f46307"), "dblpid":
"books/acm/kim95/Kim95b", "title": "Introduction to Part 2 Technology for
Interoperating Legacy Databases.", "authors": "Won Kim", "misc": "2002-01-03
515-520 1995 Modern Database Systems db/books/collections/kim95.html#Kim95b" }
+{"id": uuid("00f3969c-8427-47cd-9bd3-201cd931af9c"), "dblpid":
"books/acm/kim95/KimG95", "title": "Requirements for a Performance Benchmark
for Object-Oriented Database Systems.", "authors": "Won Kim Jorge F. Garza",
"misc": "2002-01-03 203-215 1995 Modern Database Systems
db/books/collections/kim95.html#KimG95" }
+{"id": uuid("01d75219-1d25-4a52-a651-d81dca2f9330"), "dblpid":
"books/acm/kim95/Kowalski95", "title": "The POSC Solution to Managing E&P
Data.", "authors": "Vincent J. Kowalski", "misc": "2002-01-03 281-301 1995
Modern Database Systems db/books/collections/kim95.html#Kowalski95" }
+{"id": uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"), "dblpid":
"books/acm/kim95/Lunt95", "title": "Authorization in Object-Oriented
Databases.", "authors": "Teresa F. Lunt", "misc": "2002-01-03 130-145 1995
Modern Database Systems db/books/collections/kim95.html#Lunt95" }
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.ddl.aql
new file mode 100644
index 0000000..0f36704
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.ddl.aql
@@ -0,0 +1,16 @@
+// insert test case: insert to a dataset that has an autogenerated-PK
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: uuid,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id autogenerated;
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.2.update.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.2.update.aql
new file mode 100644
index 0000000..f7e9998
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.2.update.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+insert into dataset DBLP ({"dblpid": "books/acm/kim95/Blakeley95",
+"title": "OQL[C++] Extending C++ with an Object Query Capability.",
+"authors": "José A. Blakeley",
+"misc": "2002-01-03 69-88 Modern Database Systems
db/books/collections/kim95.html#Blakeley95 1995" });
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.query.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.query.aql
new file mode 100644
index 0000000..75659dd
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+where contains($o.title,"Extending")
+return $o.title;
\ No newline at end of file
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.ddl.aql
new file mode 100644
index 0000000..f39e6ce
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.ddl.aql
@@ -0,0 +1,17 @@
+// insert test case: insert to a dataset that has an autogenerated-PK
+// This should fail since we are trying to insert a value into the
autogenerated PK field.
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: uuid,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id autogenerated;
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.2.update.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.2.update.aql
new file mode 100644
index 0000000..f13aeb5
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.2.update.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+insert into dataset DBLP ({"id": "89fb1567-70f8-4e59-87d9-ace64f73daf1",
+"dblpid": "books/acm/kim95/Blakeley95",
+"title": "OQL[C++] Extending C++ with an Object Query Capability.",
+"authors": "José A. Blakeley",
+"misc": "2002-01-03 69-88 Modern Database Systems
db/books/collections/kim95.html#Blakeley95 1995" });
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.query.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.query.aql
new file mode 100644
index 0000000..75659dd
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+where contains($o.title,"Extending")
+return $o.title;
\ No newline at end of file
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.ddl.aql
new file mode 100644
index 0000000..dd1293c
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.ddl.aql
@@ -0,0 +1,18 @@
+// insert test case: insert to a dataset that has an autogenerated-PK
+// For this test case, id field is the PK, however that is not an
auto-generated field.
+// This test case should succeed.
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: uuid,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+create dataset DBLP(DBLPType) primary key id;
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.2.update.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.2.update.aql
new file mode 100644
index 0000000..3309493
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.2.update.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+insert into dataset DBLP ({"id": uuid("89fb1567-70f8-4e59-87d9-ace64f73daf1"),
+"dblpid": "books/acm/kim95/Blakeley95",
+"title": "OQL[C++] Extending C++ with an Object Query Capability.",
+"authors": "José A. Blakeley",
+"misc": "2002-01-03 69-88 Modern Database Systems
db/books/collections/kim95.html#Blakeley95 1995" });
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.query.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.query.aql
new file mode 100644
index 0000000..9ce80dd
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+where contains($o.title,"Extending")
+return $o;
\ No newline at end of file
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.ddl.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.ddl.aql
new file mode 100644
index 0000000..b383ed2
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.ddl.aql
@@ -0,0 +1,19 @@
+// Bulk-Load test case: load a ADM file to a dataset that has an
auto-generated-PK
+// This test should succeed since we load every field data including the PK
field - id.
+// Note that id field is not an autogenerated field.
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type DBLPType as closed {
+ id: uuid,
+ dblpid: string,
+ title: string,
+ authors: string,
+ misc: string
+}
+
+// not auto-generated at this time
+create dataset DBLP(DBLPType) primary key id;
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.2.update.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.2.update.aql
new file mode 100644
index 0000000..69411c7
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.2.update.aql
@@ -0,0 +1,4 @@
+use dataverse test;
+
+load dataset DBLP using localfs
+(("path"="nc1://data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm"),("format"="adm"));
\ No newline at end of file
diff --git
a/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.query.aql
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.query.aql
new file mode 100644
index 0000000..2590ca1
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $o in dataset('DBLP')
+where contains($o.title,"Authorization in Object-Oriented Databases.")
+return $o.title;
\ No newline at end of file
diff --git
a/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.adm
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.adm
new file mode 100644
index 0000000..fb77d5f
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.adm
@@ -0,0 +1,2 @@
+[ "OQL[C++] Extending C++ with an Object Query Capability."
+ ]
diff --git
a/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.adm
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.adm
new file mode 100644
index 0000000..fb77d5f
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.adm
@@ -0,0 +1,2 @@
+[ "OQL[C++] Extending C++ with an Object Query Capability."
+ ]
diff --git
a/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.adm
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.adm
new file mode 100644
index 0000000..fb77d5f
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.adm
@@ -0,0 +1,2 @@
+[ "OQL[C++] Extending C++ with an Object Query Capability."
+ ]
diff --git
a/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_02.1.adm
b/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_02.1.adm
new file mode 100644
index 0000000..9d6fc63
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_02.1.adm
@@ -0,0 +1,2 @@
+[ "Authorization in Object-Oriented Databases."
+ ]
diff --git
a/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.adm
b/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.adm
new file mode 100644
index 0000000..9d6fc63
--- /dev/null
+++
b/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.adm
@@ -0,0 +1,2 @@
+[ "Authorization in Object-Oriented Databases."
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml
b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 94ae2f2..33695c1 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1507,6 +1507,22 @@
</test-case>
-->
<test-case FilePath="dml">
+ <compilation-unit name="insert-with-autogenerated-pk_adm_01">
+ <output-dir
compare="Text">insert-with-autogenerated-pk_adm_01</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
+ <compilation-unit name="insert-with-autogenerated-pk_adm_02">
+ <output-dir
compare="Text">insert-with-autogenerated-pk_adm_02</output-dir>
+
<expected-error>edu.uci.ics.asterix.runtime.operators.file.ADMDataParser.ParseException</expected-error>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
+ <compilation-unit name="insert-with-autogenerated-pk_adm_03">
+ <output-dir
compare="Text">insert-with-autogenerated-pk_adm_03</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
<compilation-unit name="load-with-autogenerated-pk_txt_01">
<output-dir
compare="Text">load-with-autogenerated-pk_txt_01</output-dir>
</compilation-unit>
@@ -1529,6 +1545,11 @@
</compilation-unit>
</test-case>
<test-case FilePath="dml">
+ <compilation-unit name="load-with-autogenerated-pk_adm_04">
+ <output-dir
compare="Text">load-with-autogenerated-pk_adm_04</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
<compilation-unit name="load-with-autogenerated-pk_csv_01">
<output-dir
compare="Text">load-with-autogenerated-pk_csv_01</output-dir>
</compilation-unit>
diff --git a/asterix-doc/src/site/markdown/aql/datamodel.md
b/asterix-doc/src/site/markdown/aql/datamodel.md
index 71a5cbb..f249bdf 100644
--- a/asterix-doc/src/site/markdown/aql/datamodel.md
+++ b/asterix-doc/src/site/markdown/aql/datamodel.md
@@ -18,6 +18,7 @@
* [Datetime](#PrimitiveTypesDateTime)
* [Duration/Year-month-duration/Day-time-duration](#PrimitiveTypesDuration)
* [Interval](#PrimitiveTypesInterval)
+ * [UUID](#PrimitiveTypesUUID)
* [Derived Types](#DerivedTypes)
* [Record](#DerivedTypesRecord)
* [OrderedList](#DerivedTypesOrderedList)
@@ -283,6 +284,19 @@
{ "v1": interval-date("2013-01-01, 2013-05-05"), "v2":
interval-time("00:01:01.000Z, 13:39:01.049Z"), "v3":
interval-datetime("2013-01-01T00:01:01.000Z, 2013-05-05T13:39:01.049Z") }
+### <a id="PrimitiveTypesUUID">UUID</a><font size="4"><a href="#toc">[Back to
TOC]</a></font> ###
+`uuid` represents a UUID value, which stands for Universally unique
identifier. It is defined by a canonical format using hexadecimal text with
inserted hyphen characters. (E.g.: 5a28ce1e-6a74-4201-9e8f-683256e5706f). This
type is generally used to store auto-generated primary key values.
+
+ * Example:
+
+ let $v1 := uuid("5c848e5c-6b6a-498f-8452-8847a2957421")
+ return { "v1":$v1 }
+
+
+ * The expected result is:
+
+ { "v1": uuid("5c848e5c-6b6a-498f-8452-8847a2957421") }
+
## <a id="DerivedTypes">Derived Types</a><font size="4"><a href="#toc">[Back
to TOC]</a></font> ##
diff --git a/asterix-doc/src/site/markdown/aql/manual.md
b/asterix-doc/src/site/markdown/aql/manual.md
index 3968330..cabbbd3 100644
--- a/asterix-doc/src/site/markdown/aql/manual.md
+++ b/asterix-doc/src/site/markdown/aql/manual.md
@@ -6,7 +6,7 @@
* [2. Expressions](#Expressions)
* [3. Statements](#Statements)
-## <a id="Introduction">1. Introduction</a><font size="4"> <a
href="#toc">[Back to TOC]</a></font>
+## <a id="Introduction">1. Introduction</a><font size="4"> <a
href="#toc">[Back to TOC]</a></font>
This document is intended as a reference guide to the full syntax
and semantics of the Asterix Query Language (AQL), the language for talking to
AsterixDB.
@@ -16,17 +16,17 @@
New AsterixDB users are encouraged to read and work through the (friendlier)
guide
"AsterixDB 101: An ADM and AQL Primer" before attempting to make use of this
document.
In addition, readers are advised to read and understand the Asterix Data Model
(ADM)
-reference guide since a basic understanding of ADM concepts is a prerequisite
to understanding AQL.
+reference guide since a basic understanding of ADM concepts is a prerequisite
to understanding AQL.
In what follows, we detail the features of the AQL language in a
grammar-guided manner:
-We list and briefly explain each of the productions in the AQL grammar,
offering
+We list and briefly explain each of the productions in the AQL grammar,
offering
examples for clarity in cases where doing so seems needed or helpful.
-## <a id="Expressions">2. Expressions</a> <font size="4"><a href="#toc">[Back
to TOC]</a></font>
+## <a id="Expressions">2. Expressions</a> <font size="4"><a href="#toc">[Back
to TOC]</a></font>
Query ::= Expression
An AQL query can be any legal AQL expression.
-
+
Expression ::= ( OperatorExpr | IfThenElse | FLWOR | QuantifiedExpression )
AQL is a fully composable expression language.
@@ -78,7 +78,7 @@
| "." <DIGITS> ( "f" | "F" )
DoubleLiteral ::= <DIGITS>
| <DIGITS> ( "." <DIGITS> )?
- | "." <DIGITS>
+ | "." <DIGITS>
Literals (constants) in AQL can be strings, integers, floating point values,
double values, boolean constants, or the constant value null.
@@ -155,7 +155,7 @@
Dataset access expressions are most commonly used in FLWOR expressions, where
variables
are bound to their contents.
-Note that the Identifier that identifies a dataset (or any other Identifier in
AQL) can also be a StringLiteral.
+Note that the Identifier that identifies a dataset (or any other Identifier in
AQL) can also be a StringLiteral.
This is especially useful to avoid conficts with AQL keywords (e.g. "dataset",
"null", or "type").
The following are three examples of legal dataset access expressions.
@@ -205,7 +205,7 @@
##### Note
-When constructing nested records there needs to be a space between the closing
braces to avoid confusion with the `}}` token that ends an unordered list
constructor:
+When constructing nested records there needs to be a space between the closing
braces to avoid confusion with the `}}` token that ends an unordered list
constructor:
`{ "a" : { "b" : "c" }}` will fail to parse while `{ "a" : { "b" : "c" } }`
will work.
### Path Expressions
@@ -282,7 +282,7 @@
ForClause ::= ("for"|"from") Variable ( "at" Variable )? "in" (
Expression )
LetClause ::= ("let"|"with") Variable ":=" Expression
WhereClause ::= "where" Expression
- OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
+ OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," (
Variable ":=" )? Expression )*
("with"|"keeping") VariableRef ( "," VariableRef )*
@@ -341,7 +341,7 @@
##### Example
for $user in dataset FacebookUsers
- let $messages :=
+ let $messages :=
for $message in dataset FacebookMessages
where $message.author-id = $user.id
return $message.message
@@ -435,10 +435,10 @@
QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in"
Expression
( "," Variable "in" Expression )* "satisfies"
Expression
-
+
Quantified expressions are used for expressing existential or universal
predicates involving the elements of a collection.
-The following pair of examples illustrate the use of a quantified expression
to test that every (or some) element in the set [1, 2, 3] of integers is less
than three.
+The following pair of examples illustrate the use of a quantified expression
to test that every (or some) element in the set [1, 2, 3] of integers is less
than three.
The first example yields `false` and second example yields `true`.
It is useful to note that if the set were instead the empty set, the first
expression would yield `true`
@@ -450,7 +450,7 @@
every $x in [ 1, 2, 3 ] satisfies $x < 3
some $x in [ 1, 2, 3 ] satisfies $x < 3
-## <a id="Statements">3. Statements</a> <font size="4"><a href="#toc">[Back to
TOC]</a></font>
+## <a id="Statements">3. Statements</a> <font size="4"><a href="#toc">[Back to
TOC]</a></font>
Statement ::= ( SingleStatement ( ";" )? )* <EOF>
SingleStatement ::= DataverseDeclaration
@@ -461,7 +461,7 @@
| SetStatement
| InsertStatement
| DeleteStatement
- | Query
+ | Query
In addition to expresssions for queries, AQL supports a variety of statements
for data
definition and manipulation purposes as well as controlling the context to be
used in
@@ -470,7 +470,7 @@
This section details the statements supported in the AQL language.
### Declarations
-
+
DataverseDeclaration ::= "use" "dataverse" Identifier
The world of data in an AsterixDB cluster is organized into data namespaces
called dataverses.
@@ -481,9 +481,9 @@
##### Example
use dataverse TinySocial;
-
+
The set statement in AQL is used to control aspects of the expression
evalation context for queries.
-
+
SetStatement ::= "set" Identifier StringLiteral
As an example, the following set statements request that Jaccard similarity
with a similarity threshold 0.6
@@ -492,7 +492,7 @@
##### Example
set simfunction "jaccard";
- set simthreshold "0.6f";
+ set simthreshold "0.6f";
When writing a complex AQL query, it can sometimes be helpful to define one or
more
auxilliary functions that each address a sub-piece of the overall query.
@@ -504,7 +504,7 @@
The following is a very simple example of a temporary AQL function definition.
##### Example
-
+
declare function add($a, $b) {
$a + $b
};
@@ -578,24 +578,34 @@
"employment" : [ EmploymentType ]
}
+The next example creates a new ADM record type called FbUserType. Note that
the type of the id field is UUID. You need to use this field type if you want
to have this field be an autogenerated-PK field. Refer to the Datasets section
later for more details.
+
+##### Example
+
+ create type FbUserType as closed {
+ "id" : uuid,
+ "alias" : string,
+ "name" : string
+ }
+
#### Datasets
DatasetSpecification ::= "internal"? "dataset" QualifiedName "("
Identifier ")" IfNotExists
PrimaryKey ( "on" Identifier )? ( "hints"
Properties )?
- ( "using" "compaction" "policy" CompactionPolicy
( Configuration )? )?
+ ( "using" "compaction" "policy" CompactionPolicy
( Configuration )? )?
( "with filter on" Identifier )?
- | "external" "dataset" QualifiedName "(" Identifier
")" IfNotExists
+ | "external" "dataset" QualifiedName "(" Identifier
")" IfNotExists
"using" AdapterName Configuration ( "hints"
Properties )?
- ( "using" "compaction" "policy" CompactionPolicy
( Configuration )? )?
+ ( "using" "compaction" "policy" CompactionPolicy
( Configuration )? )?
AdapterName ::= Identifier
Configuration ::= "(" ( KeyValuePair ( "," KeyValuePair )* )? ")"
KeyValuePair ::= "(" StringLiteral "=" StringLiteral ")"
Properties ::= ( "(" Property ( "," Property )* ")" )?
Property ::= Identifier "=" ( StringLiteral | IntegerLiteral )
FunctionSignature ::= FunctionOrTypeName "@" IntegerLiteral
- PrimaryKey ::= "primary" "key" NestedField ( "," NestedField )*
+ PrimaryKey ::= "primary" "key" NestedField ( "," NestedField )*
( "autogenerated ")?
CompactionPolicy ::= Identifier
- PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )*
+ PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )* (
"autogenerated ")?
The create dataset statement is used to create a new dataset.
Datasets are named, unordered collections of ADM record instances; they
@@ -603,7 +613,7 @@
Datasets are typed, and AsterixDB will ensure that their contents conform to
their type definitions.
An Internal dataset (the default) is a dataset that is stored in and managed
by AsterixDB.
It must have a specified unique primary key that can be used to partition data
across nodes of an AsterixDB cluster.
-The primary key is also used in secondary indexes to uniquely identify the
indexed primary data records.
+The primary key is also used in secondary indexes to uniquely identify the
indexed primary data records. Random primary key (UUID) values can be
auto-generated by declaring the field to be UUID and putting "autogenerated"
after the "primary key" identifier. In this case, values for the auto-generated
PK field should not be provided by the user since it will be auto-generated by
AsterixDB.
Optionally, a filter can be created on a field to further optimize range
queries with predicates on the filter's field.
(Refer to [Filter-Based LSM Index Acceleration](filters.html) for more
information about filters.)
@@ -643,6 +653,12 @@
##### Example
create internal dataset FacebookUsers(FacebookUserType) primary key id;
+The following example creates an internal dataset for storing FbUserType
records.
+It specifies that their id field is their primary key. It also specifies that
the id field is an auto-generated field, meaning that a randomly generated UUID
value will be assigned to each record by the system. (A user should therefore
not proivde a value for this field.) Note that the id field should be UUID.
+
+##### Example
+ create internal dataset FbMsgs(FbUserType) primary key id autogenerated;
+
The next example creates an external dataset for storing LineitemType records.
The choice of the `hdfs` adapter means that its data will reside in HDFS.
The create statement provides parameters used by the hdfs adapter:
@@ -655,10 +671,10 @@
("input-format"="text-input-format"),
("format"="delimited-text"),
("delimiter"="|"));
-
+
#### Indices
- IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName
+ IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName
"(" ( OpenField ) ( "," OpenField )* ")" ( "type"
IndexType )? ( "enforced" )?
IndexType ::= "btree"
| "rtree"
@@ -671,7 +687,7 @@
Index could be created on arbitrary nested fields by providing valid path
expression as an indexed field identifier.
An index field is not required to be part of the datatype associated with a
dataset if that datatype is declared as
open, field type is provided along with it's type and `enforced` keyword is
specified in the end of index definition.
-`Enforcing` an open field will introduce a load-time check, which will make
sure that the actual type of an indexed
+`Enforcing` an open field will introduce a load-time check, which will make
sure that the actual type of an indexed
field (if such field exists in the record) matches the specified field type.
The following example creates a btree index called fbAuthorIdx on the
author-id field of the FacebookMessages dataset.
@@ -681,7 +697,7 @@
create index fbAuthorIdx on FacebookMessages(author-id) type btree
enforced;
-The following example creates an open btree index called fbSendTimeIdx on the
open send-time field of the
+The following example creates an open btree index called fbSendTimeIdx on the
open send-time field of the
FacebookMessages dataset having datetime type.
This index can be useful for accelerating exact-match queries, range search
queries, and joins involving the send-time field.
@@ -700,7 +716,7 @@
The following example creates an rtree index called fbSenderLocIdx on the
sender-location field of the FacebookMessages dataset.
This index can be useful for accelerating queries that use the
-[`spatial-intersect` function](functions.html#spatial-intersect) in a
predicate involving the
+[`spatial-intersect` function](functions.html#spatial-intersect) in a
predicate involving the
sender-location field.
##### Example
@@ -733,13 +749,13 @@
The following is a very simple example of a create function statement.
It differs from the declare function example shown previously in that it
results in a function that is
persistently registered by name in the specified dataverse.
-
+
##### Example
-
+
create function add($a, $b) {
$a + $b
};
-
+
#### Removal
DropStatement ::= "drop" ( "dataverse" Identifier IfExists
@@ -753,7 +769,7 @@
It can be used to drop dataverses, datatypes, datasets, indexes, and functions.
The following examples illustrate uses of the drop statement.
-
+
##### Example
drop dataset FacebookUsers if exists;
@@ -761,7 +777,7 @@
drop index fbSenderLocIndex;
drop type FacebookUserType;
-
+
drop dataverse TinySocial;
drop function add;
@@ -769,11 +785,12 @@
### Import/Export Statements
LoadStatement ::= "load" "dataset" QualifiedName "using" AdapterName
Configuration ( "pre-sorted" )?
-
+
The load statement is used to initially populate a dataset via bulk loading of
data from an external file.
An appropriate adapter must be selected to handle the nature of the desired
external data.
The load statement accepts the same adapters and the same parameters as
external datasets.
(See the [guide to external data](externaldata.html) for more information on
the available adapters.)
+If a dataset has an auto-generated primary key field, a file to be imported
should not include that field in it.
The following example shows how to bulk load the FacebookUsers dataset from an
external file containing
data that has been prepared in ADM format.
@@ -797,10 +814,10 @@
If the query part of an insert returns a single object, then the insert
statement itself will
be a single, atomic transaction.
If the query part returns multiple objects, then each object inserted will be
handled independently
-as a tranaction.
+as a tranaction. If a dataset has an auto-generated primary key field, an
insert statement should not include a value for that field in it. (The system
will automatically extend the provided record with this additional field and a
corresponding value.)
The following example illustrates a query-based insertion.
-
+
##### Example
insert into dataset UsersCopy (for $user in dataset FacebookUsers return
$user)
@@ -822,13 +839,13 @@
The following example illustrates a single-object deletion.
##### Example
-
+
delete $user from dataset FacebookUsers where $user.id = 8;
We close this guide to AQL with one final example of a query expression.
-
+
##### Example
-
+
for $praise in {{ "great", "brilliant", "awesome" }}
return
string-concat(["AsterixDB is ", $praise])
diff --git a/asterix-doc/src/site/markdown/aql/primer-sql-like.md
b/asterix-doc/src/site/markdown/aql/primer-sql-like.md
index bdc6e92..db1d1ea 100644
--- a/asterix-doc/src/site/markdown/aql/primer-sql-like.md
+++ b/asterix-doc/src/site/markdown/aql/primer-sql-like.md
@@ -144,8 +144,6 @@
data size (e.g., dataset scans).
The only fields that _must_ be specified a priori are the primary key and any
fields that you
would like to build indexes on.
-(AsterixDB does not yet support auto-generated keys or indexes on the
unspecified "open" fields
-of its data instances).
### Creating Datasets and Indexes ###
diff --git a/asterix-doc/src/site/markdown/aql/primer.md
b/asterix-doc/src/site/markdown/aql/primer.md
index cffc5a2..8c747d5 100644
--- a/asterix-doc/src/site/markdown/aql/primer.md
+++ b/asterix-doc/src/site/markdown/aql/primer.md
@@ -148,8 +148,7 @@
with each instance---making for more bits on disk and longer times for
operations affected by
data size (e.g., dataset scans).
The only fields that _must_ be specified a priori are the primary key.
-(AsterixDB does not yet support auto-generated keys).
-Indexes could be build on fields, which don't belong to fixed part of
datatype's schema, as long as field's type is
+Indexes could be build on fields, which don't belong to fixed part of
datatype's schema, as long as field's type is
specified and _enforced_ keyword is provided in the end of index definition.
Index fields could also be nested arbitrarily deep in datatype definition.
diff --git
a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
index 4e404ef..774987b 100644
---
a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
+++
b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
@@ -16,8 +16,8 @@
package edu.uci.ics.asterix.dataflow.data.nontagged.printers;
import java.io.PrintStream;
-import java.util.UUID;
+import edu.uci.ics.asterix.om.base.AMutableUUID;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.data.IPrinter;
import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
@@ -25,18 +25,20 @@
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 {
- // do nothing
}
@Override
public void print(byte[] b, int s, int l, PrintStream ps) throws
AlgebricksException {
- long msb = LongPointable.getLong(b, s + 1);
+ long msb = LongPointable.getLong(b, s + 1);
long lsb = LongPointable.getLong(b, s + 9);
- UUID uuid = new UUID(msb, lsb);
- ps.print("\"" + uuid.toString() + "\"");
+ uuid.setValue(msb, lsb);
+
+ ps.print("uuid(\"" + uuid.toStringLiteralOnly() + "\")");
}
}
diff --git
a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
index be0bf98..26d717a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
@@ -32,6 +32,12 @@
lsb = uuidBits[1];
}
+ // Set the most significant bits and the least significant bits.
+ public void setValue(long msb, long lsb) {
+ this.msb = msb;
+ this.lsb = lsb;
+ }
+
// Since AUUID is a wrapper of java.util.uuid,
// we can use the same method that creates a UUID from a String.
public void fromStringToAMuatbleUUID(String value) {
diff --git
a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 560156c..39fad26 100644
---
a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -762,6 +762,7 @@
addFunction(CREATE_POLYGON, OptionalAPolygonTypeComputer.INSTANCE,
true);
addFunction(CREATE_RECTANGLE, OptionalARectangleTypeComputer.INSTANCE,
true);
addFunction(CREATE_UUID, AUUIDTypeComputer.INSTANCE, false);
+ addFunction(UUID_CONSTRUCTOR, AUUIDTypeComputer.INSTANCE, true);
addFunction(DATE_CONSTRUCTOR, OptionalADateTypeComputer.INSTANCE,
true);
addFunction(DATETIME_CONSTRUCTOR,
OptionalADateTimeTypeComputer.INSTANCE, true);
@@ -986,9 +987,9 @@
addFunction(INTERVAL_COVERED_BY,
OptionalABooleanTypeComputer.INSTANCE, true);
addFunction(INTERVAL_ENDS, OptionalABooleanTypeComputer.INSTANCE,
true);
addFunction(INTERVAL_ENDED_BY, OptionalABooleanTypeComputer.INSTANCE,
true);
- addFunction(CURRENT_DATE, ADateTypeComputer.INSTANCE, true);
- addFunction(CURRENT_TIME, ATimeTypeComputer.INSTANCE, true);
- addFunction(CURRENT_DATETIME, ADateTimeTypeComputer.INSTANCE, true);
+ addFunction(CURRENT_DATE, ADateTypeComputer.INSTANCE, false);
+ addFunction(CURRENT_TIME, ATimeTypeComputer.INSTANCE, false);
+ addFunction(CURRENT_DATETIME, ADateTimeTypeComputer.INSTANCE, false);
addPrivateFunction(DAY_TIME_DURATION_GREATER_THAN,
OptionalABooleanTypeComputer.INSTANCE, true);
addPrivateFunction(DAY_TIME_DURATION_LESS_THAN,
OptionalABooleanTypeComputer.INSTANCE, true);
addPrivateFunction(YEAR_MONTH_DURATION_GREATER_THAN,
OptionalABooleanTypeComputer.INSTANCE, true);
diff --git
a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
index 8f3a219..66df700 100644
---
a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
+++
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
@@ -268,7 +268,7 @@
IAType t = cachedReqType.getFieldTypes()[i];
if (!(t.getTypeTag() == ATypeTag.UNION &&
NonTaggedFormatUtil.isOptionalField((AUnionType) t))) {
// no matched field in the input for a required closed
field
- throw new IllegalStateException("type mismatch: miss a
required closed field "
+ throw new IllegalStateException("type mismatch: missing a
required closed field "
+ cachedReqType.getFieldNames()[i] + ":" +
t.getTypeName());
}
}
diff --git
a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDStringConstructorDescriptor.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDStringConstructorDescriptor.java
new file mode 100644
index 0000000..ff7c274
--- /dev/null
+++
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDStringConstructorDescriptor.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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 edu.uci.ics.asterix.runtime.evaluators.constructors;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.AMutableUUID;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.AUUID;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import
edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import
edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+/**
+ * Receives a string representation of UUID and construct a UUID value.
+ *
+ */
+public class AUUIDStringConstructorDescriptor extends
AbstractScalarFunctionDynamicDescriptor {
+
+ private static final long serialVersionUID = 1L;
+ private final static byte SER_STRING_TYPE_TAG =
ATypeTag.STRING.serialize();
+ private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+ public static final IFunctionDescriptorFactory FACTORY = new
IFunctionDescriptorFactory() {
+ public IFunctionDescriptor createFunctionDescriptor() {
+ return new AUUIDStringConstructorDescriptor();
+ }
+ };
+
+ @Override
+ public ICopyEvaluatorFactory createEvaluatorFactory(final
ICopyEvaluatorFactory[] args) {
+ return new ICopyEvaluatorFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public ICopyEvaluator createEvaluator(final IDataOutputProvider
output) throws AlgebricksException {
+ return new ICopyEvaluator() {
+
+ private DataOutput out = output.getDataOutput();
+
+ private ArrayBackedValueStorage outInput = new
ArrayBackedValueStorage();
+ private ICopyEvaluator eval =
args[0].createEvaluator(outInput);
+ private String errorMessage = "This can not be an instance
of UUID";
+ private AMutableUUID aUUID = new AMutableUUID(0, 0);
+ @SuppressWarnings("unchecked")
+ private ISerializerDeserializer<AUUID> uuidSerde =
AqlSerializerDeserializerProvider.INSTANCE
+ .getSerializerDeserializer(BuiltinType.AUUID);
+ @SuppressWarnings("unchecked")
+ private ISerializerDeserializer<ANull> nullSerde =
AqlSerializerDeserializerProvider.INSTANCE
+ .getSerializerDeserializer(BuiltinType.ANULL);
+
+ @Override
+ public void evaluate(IFrameTupleReference tuple) throws
AlgebricksException {
+ try {
+ outInput.reset();
+ eval.evaluate(tuple);
+ byte[] serString = outInput.getByteArray();
+ if (serString[0] == SER_STRING_TYPE_TAG) {
+ // first byte: tag, next two bytes: length, so
we add 3 bytes.
+ aUUID.fromStringToAMuatbleUUID(new
String(serString, outInput.getStartOffset() + 3, outInput.getLength() - 3));
+ uuidSerde.serialize(aUUID, out);
+ } else if (serString[0] == SER_NULL_TYPE_TAG)
+ nullSerde.serialize(ANull.NULL, out);
+ else
+ throw new AlgebricksException(errorMessage);
+ } catch (IOException e1) {
+ throw new AlgebricksException(errorMessage);
+ }
+ }
+ };
+ }
+ };
+ }
+
+ @Override
+ public FunctionIdentifier getIdentifier() {
+ return AsterixBuiltinFunctions.UUID_CONSTRUCTOR;
+ }
+
+}
\ No newline at end of file
diff --git
a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index 29d2afd..675d7f9 100644
---
a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -163,6 +163,7 @@
import
edu.uci.ics.asterix.runtime.evaluators.constructors.ARectangleConstructorDescriptor;
import
edu.uci.ics.asterix.runtime.evaluators.constructors.AStringConstructorDescriptor;
import
edu.uci.ics.asterix.runtime.evaluators.constructors.ATimeConstructorDescriptor;
+import
edu.uci.ics.asterix.runtime.evaluators.constructors.AUUIDStringConstructorDescriptor;
import
edu.uci.ics.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
import
edu.uci.ics.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
import
edu.uci.ics.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
@@ -554,6 +555,7 @@
temp.add(ADurationConstructorDescriptor.FACTORY);
temp.add(AYearMonthDurationConstructorDescriptor.FACTORY);
temp.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+ temp.add(AUUIDStringConstructorDescriptor.FACTORY);
temp.add(CreateUUIDDescriptor.FACTORY);
// Spatial
--
To view, visit https://asterix-gerrit.ics.uci.edu/326
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2276bf2b44975b13c99d56f448ae3e9e4a74b04e
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Taewoo Kim <[email protected]>