asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wangs...@apache.org
Subject incubator-asterixdb git commit: Added the UUID constructor and changed the relevant documentation
Date Tue, 28 Jul 2015 20:34:02 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master db731695a -> f41b34b6b


Added the UUID constructor and changed the relevant documentation

Change-Id: I2276bf2b44975b13c99d56f448ae3e9e4a74b04e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/326
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/f41b34b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/f41b34b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/f41b34b6

Branch: refs/heads/master
Commit: f41b34b6bf4c4d64c44dd188c81070db44c65378
Parents: db73169
Author: Taewoo Kim <wangsaeu@yahoo.com>
Authored: Tue Jul 28 09:15:41 2015 -0700
Committer: Taewoo Kim <wangsaeu@gmail.com>
Committed: Tue Jul 28 13:26:36 2015 -0700

----------------------------------------------------------------------
 ...small-id-autogenerated-pk_including_uuid.adm |  20 +-
 .../constructor/uuid_01/uuid_01.1.ddl.aql       |   3 +
 .../constructor/uuid_01/uuid_01.2.update.aql    |   0
 .../constructor/uuid_01/uuid_01.3.query.aql     |   5 +
 ...nsert-with-autogenerated-pk_adm_01.1.ddl.aql |  16 ++
 ...rt-with-autogenerated-pk_adm_01.2.update.aql |   6 +
 ...ert-with-autogenerated-pk_adm_01.3.query.aql |   5 +
 ...nsert-with-autogenerated-pk_adm_02.1.ddl.aql |  17 ++
 ...rt-with-autogenerated-pk_adm_02.2.update.aql |   7 +
 ...ert-with-autogenerated-pk_adm_02.3.query.aql |   5 +
 ...nsert-with-autogenerated-pk_adm_03.1.ddl.aql |  18 ++
 ...rt-with-autogenerated-pk_adm_03.2.update.aql |   7 +
 ...ert-with-autogenerated-pk_adm_03.3.query.aql |   5 +
 .../load-with-autogenerated-pk_adm_04.1.ddl.aql |  19 ++
 ...ad-with-autogenerated-pk_adm_04.2.update.aql |   4 +
 ...oad-with-autogenerated-pk_adm_04.3.query.aql |   5 +
 .../results/constructor/uuid_01/uuid_01.1.adm   |   2 +
 .../insert-with-autogenerated-pk_adm_01.1.adm   |   2 +
 .../insert-with-autogenerated-pk_adm_02.1.adm   |   2 +
 .../insert-with-autogenerated-pk_adm_03.1.adm   |   2 +
 .../load-with-autogenerated-pk_adm_02.1.adm     |   2 +
 .../load-with-autogenerated-pk_adm_04.1.adm     |   2 +
 .../src/test/resources/runtimets/testsuite.xml  |  26 +++
 asterix-doc/src/site/markdown/aql/datamodel.md  |  14 ++
 asterix-doc/src/site/markdown/aql/manual.md     |  99 +++++----
 .../src/site/markdown/aql/primer-sql-like.md    |   3 +-
 asterix-doc/src/site/markdown/aql/primer.md     |   5 +-
 .../data/nontagged/printers/AUUIDPrinter.java   |  10 +-
 .../uci/ics/asterix/om/base/AMutableUUID.java   |   6 +
 .../om/functions/AsterixBuiltinFunctions.java   |   7 +-
 .../om/pointables/cast/ARecordCaster.java       |   2 +-
 .../AUUIDFromStringConstructorDescriptor.java   | 217 +++++++++++++++++++
 .../runtime/formats/NonTaggedDataFormat.java    |   2 +
 .../operators/file/AbstractDataParser.java      |   7 +-
 34 files changed, 484 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/data/pub-small/dblp-small-id-autogenerated-pk_including_uuid.adm
----------------------------------------------------------------------
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" }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.1.ddl.aql
new file mode 100644
index 0000000..754ea81
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.2.update.aql
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
new file mode 100644
index 0000000..e243c86
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+let $v1:=uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac")
+let $v2:=uuid("8cea25ab-55f8-467e-929d-94888f754832")
+return {"uuid1": $v1,"uuid2": $v2}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.ddl.aql
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.2.update.aql
----------------------------------------------------------------------
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" });

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.3.query.aql
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.ddl.aql
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.2.update.aql
----------------------------------------------------------------------
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" });

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.3.query.aql
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.ddl.aql
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.2.update.aql
----------------------------------------------------------------------
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" });

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.3.query.aql
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.ddl.aql
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.2.update.aql
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/queries/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.3.query.aql
----------------------------------------------------------------------
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..5f52890
--- /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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm b/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
new file mode 100644
index 0000000..43c37ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
@@ -0,0 +1,2 @@
+[ { "uuid1": uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"), "uuid2": uuid("8cea25ab-55f8-467e-929d-94888f754832") }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_01/insert-with-autogenerated-pk_adm_01.1.adm
----------------------------------------------------------------------
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."
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_02/insert-with-autogenerated-pk_adm_02.1.adm
----------------------------------------------------------------------
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."
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/dml/insert-with-autogenerated-pk_adm_03/insert-with-autogenerated-pk_adm_03.1.adm
----------------------------------------------------------------------
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."
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_03/load-with-autogenerated-pk_adm_02.1.adm
----------------------------------------------------------------------
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."
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/results/dml/load-with-autogenerated-pk_adm_04/load-with-autogenerated-pk_adm_04.1.adm
----------------------------------------------------------------------
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."
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 88271de..898d847 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1191,6 +1191,11 @@
                 <output-dir compare="Text">time_01</output-dir>
             </compilation-unit>
         </test-case>
+        <test-case FilePath="constructor">
+            <compilation-unit name="uuid_01">
+                <output-dir compare="Text">uuid_01</output-dir>
+            </compilation-unit>
+        </test-case>
     </test-group>
     <test-group name="custord">
         <!--
@@ -1507,6 +1512,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 +1550,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>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-doc/src/site/markdown/aql/datamodel.md
----------------------------------------------------------------------
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 @@ Note that a canonical representation of the duration is always returned, regardl
 
         { "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> ##
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-doc/src/site/markdown/aql/manual.md
----------------------------------------------------------------------
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 @@ its support for queries and data modification, as well as its data definition la
  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 @@ or a newly constructed ADM record.
                      | "." <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 @@ Data access in a query expression is accomplished via a DatasetAccessExpression.
 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 @@ or they can come from query variable references or even arbitrarily complex AQL
 
 ##### 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 @@ The example below evaluates to 25.
     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 @@ The query returns one record per user, with result records containing the user's
 ##### 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 @@ The following example illustrates the form of a conditional expression.
 
     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 @@ It is useful to note that if the set were instead the empty set, the first expre
     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 @@ It is useful to note that if the set were instead the empty set, the first expre
                       | 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 @@ evaluating AQL expressions. AQL supports record-level ACID transactions that beg
 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 @@ As an example, the following statement sets the default dataverse to be TinySoci
 ##### 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 @@ be used for set similarity matching when the ~= operator is used in a query expr
 ##### 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 declare function statement supports the creation of such helper functions.
 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 @@ The employment field is an ordered list of instances of another named record typ
       "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 @@ are where data lives persistently and are the targets for queries in AsterixDB.
 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 @@ It specifies that their id field is their primary key.
 ##### 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 @@ the URL and path needed to locate the data in HDFS and a description of the data
       ("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 @@ Supported index types include `btree` for totally ordered datatypes,
 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 @@ This index can be useful for accelerating exact-match queries, range search quer
 
     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 @@ This index can be useful for accelerating exact-match queries, range search quer
 
 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 body of a function can be any AQL expression involving the function's parame
 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 @@ The drop statement in AQL is the inverse of the create statement.
 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 @@ The following examples illustrate uses of the drop statement.
     drop index fbSenderLocIndex;
 
     drop type FacebookUserType;
-    
+
     drop dataverse TinySocial;
 
     drop function add;
@@ -769,11 +785,12 @@ The following examples illustrate uses of the drop statement.
 ### 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 @@ being the insertion of a single object plus its affiliated secondary index entri
 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 @@ as a transaction.
 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])

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-doc/src/site/markdown/aql/primer-sql-like.md
----------------------------------------------------------------------
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..1d560e2 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,7 @@ with each instance---making for more bits on disk and longer times for operation
 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 ###
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-doc/src/site/markdown/aql/primer.md
----------------------------------------------------------------------
diff --git a/asterix-doc/src/site/markdown/aql/primer.md b/asterix-doc/src/site/markdown/aql/primer.md
index cffc5a2..e333a8c 100644
--- a/asterix-doc/src/site/markdown/aql/primer.md
+++ b/asterix-doc/src/site/markdown/aql/primer.md
@@ -148,10 +148,7 @@ the information about other fields that are "just there" in instances of open da
 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 
-specified and _enforced_ keyword is provided in the end of index definition.
-Index fields could also be nested arbitrarily deep in datatype definition.
+Indexes can be built on fields that don't belong to the pre-specified part of datatype's schema as long as their type is specified at index create time and and the _enforced_ keyword is provided at the end of the index definition.  (The _enforced_ keyword asks the system to ensure that the indexed field or fields conform to this specified type in all of the dataset's record instances where they are present.)  Additionally, indexed fields may be nested arbitrarily deep within a dataset's records as long as the nesting does not go pass through a list (be it ordered or unordered) along the way.
 
 ### Creating Datasets and Indexes ###
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AUUIDPrinter.java
----------------------------------------------------------------------
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..8eee115 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 @@ import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
 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 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() + "\")");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableUUID.java
----------------------------------------------------------------------
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..b603092 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 @@ public class AMutableUUID extends AUUID {
         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) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
----------------------------------------------------------------------
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 @@ public class AsterixBuiltinFunctions {
         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 @@ public class AsterixBuiltinFunctions {
         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);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
----------------------------------------------------------------------
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 @@ class ARecordCaster {
                 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());
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
new file mode 100644
index 0000000..8cc5933
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
@@ -0,0 +1,217 @@
+/*
+ * 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 canonical representation of UUID and construct a UUID value.
+ * a UUID is represented by 32 lowercase hexadecimal digits (8-4-4-4-12). (E.g.
+ * uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"))
+ */
+public class AUUIDFromStringConstructorDescriptor 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 AUUIDFromStringConstructorDescriptor();
+        }
+    };
+
+    @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);
+                    private long msb = 0;
+                    private long lsb = 0;
+                    private long tmpLongValue = 0;
+
+                    @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) {
+                                msb = 0;
+                                lsb = 0;
+                                tmpLongValue = 0;
+
+                                // first byte: tag, next two bytes: length, so
+                                // we add 3 bytes.
+                                // First part - 8 bytes
+                                int offset = 3;
+                                msb = calculateLongFromHex(serString, offset, 8);
+                                msb <<= 16;
+                                offset += 8;
+
+                                // Skip the hyphen part
+                                offset += 1;
+
+                                // Second part - 4 bytes
+                                tmpLongValue = calculateLongFromHex(serString, offset, 4);
+                                msb |= tmpLongValue;
+                                msb <<= 16;
+                                offset += 4;
+
+                                // Skip the hyphen part
+                                offset += 1;
+
+                                // Third part - 4 bytes
+                                tmpLongValue = calculateLongFromHex(serString, offset, 4);
+                                msb |= tmpLongValue;
+                                offset += 4;
+
+                                // Skip the hyphen part
+                                offset += 1;
+
+                                // Fourth part - 4 bytes
+                                lsb = calculateLongFromHex(serString, offset, 4);
+                                lsb <<= 48;
+                                offset += 4;
+
+                                // Skip the hyphen part
+                                offset += 1;
+
+                                // The last part - 12 bytes
+                                tmpLongValue = calculateLongFromHex(serString, offset, 12);
+                                lsb |= tmpLongValue;
+
+                                aUUID.setValue(msb, lsb);
+                                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);
+                        }
+                    }
+
+                    // Calculate a long value from a hex string.
+                    private long calculateLongFromHex(byte[] hexArray, int offset, int length)
+                            throws AlgebricksException {
+                        int tmpIntVal = 0;
+                        long tmpLongVal = 0;
+                        for (int i = offset; i < offset + length; i++) {
+                            tmpIntVal = transformHexCharToInt(hexArray[i]);
+                            if (tmpIntVal != -1) {
+                                tmpLongVal = tmpLongVal * 16 + tmpIntVal;
+                            } else {
+                                throw new AlgebricksException("This is not a correct UUID value.");
+                            }
+                        }
+                        return tmpLongVal;
+                    }
+
+                    // Interpret a character to the corresponding integer value.
+                    private int transformHexCharToInt(byte val) throws AlgebricksException {
+                        switch (val) {
+                            case '0':
+                                return 0;
+                            case '1':
+                                return 1;
+                            case '2':
+                                return 2;
+                            case '3':
+                                return 3;
+                            case '4':
+                                return 4;
+                            case '5':
+                                return 5;
+                            case '6':
+                                return 6;
+                            case '7':
+                                return 7;
+                            case '8':
+                                return 8;
+                            case '9':
+                                return 9;
+                            case 'a':
+                            case 'A':
+                                return 10;
+                            case 'b':
+                            case 'B':
+                                return 11;
+                            case 'c':
+                            case 'C':
+                                return 12;
+                            case 'd':
+                            case 'D':
+                                return 13;
+                            case 'e':
+                            case 'E':
+                                return 14;
+                            case 'f':
+                            case 'F':
+                                return 15;
+                            case '-':
+                                // We need to skip this hyphen part.
+                                return -1;
+                            default:
+                                throw new AlgebricksException("This is not a correct UUID value.");
+                        }
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.UUID_CONSTRUCTOR;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
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..11016e0 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.APolygonConstructorDe
 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.AUUIDFromStringConstructorDescriptor;
 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 @@ public class NonTaggedDataFormat implements IDataFormat {
         temp.add(ADurationConstructorDescriptor.FACTORY);
         temp.add(AYearMonthDurationConstructorDescriptor.FACTORY);
         temp.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+        temp.add(AUUIDFromStringConstructorDescriptor.FACTORY);
 
         temp.add(CreateUUIDDescriptor.FACTORY);
         // Spatial

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/f41b34b6/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AbstractDataParser.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AbstractDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AbstractDataParser.java
index c5621d6..7db2f87 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AbstractDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AbstractDataParser.java
@@ -132,11 +132,12 @@ public abstract class AbstractDataParser implements IDataParser {
     protected ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
-    // For UUID, we assume that the format is the string representation of UUID         
-    // (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) when parsing the data.         
+    // For UUID, we assume that the format is the string representation of UUID
+    // (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) when parsing the data.
+    // Thus, we need to call UUID.fromStringToAMuatbleUUID() to convert it to the internal representation (two long values).
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<AUUID> uuidSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.AUUID_STRING);
+            .getSerializerDeserializer(BuiltinType.AUUID);
 
     // To avoid race conditions, the serdes for temporal and spatial data types needs to be one per parser
     @SuppressWarnings("unchecked")


Mime
View raw message