Merge branch 'master' into jarodwen/hotfix/issue363
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
index 3dad464..dc86722 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
@@ -186,6 +186,8 @@
                 case DATE:
                 case TIME:
                 case DURATION:
+                case YEARMONTHDURATION:
+                case DAYTIMEDURATION:
                 case INTERVAL:
                 case POINT:
                 case POINT3D:
diff --git a/asterix-app/.gitignore b/asterix-app/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/asterix-app/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/asterix-app/data/temporal/temporalData.json b/asterix-app/data/temporal/temporalData.json
index 5b3a0f5..bedf2c7 100644
--- a/asterix-app/data/temporal/temporalData.json
+++ b/asterix-app/data/temporal/temporalData.json
@@ -1,3 +1,4 @@
 {"id": "001", "dateField": date("-2012-12-12"), "dateFieldPlus": date("0990-01-01"), "timeField": time("23:49:12.39Z"), "timeFieldPlus": time("03:23:12.2"), "datetimeField": datetime("2012-12-12T00:00:00.001"), "datetimeFieldPlus": datetime("-00130810T221015398"), "durationField": duration("P20Y19DT3H74M23.34S"), "durationFieldPlus": duration("-P2MT4M300.68S"), "intervalField": interval-datetime("2012-12-12T00:00:00.001,20130810T221015398") }
 {"id": "002", "timeField": time("12:12:12.219+08:00"), "timeField2": time("13:13:13.321-08:00"), "datetimeField": datetime("19201220T232918478-1200"), "intervalField": interval-time("12:29:30+08:00, 235959999-0800") }
-{"id": "003", "durationField": duration("-P27Y48DT2400H"), "datetimeField": datetime("-0290-03-23T00:59:48.999+07:00"), "intervalField": interval-date("-2012-03-17, 2013-04-01"), "intervalPlus": interval-time("19:23:32.328Z,23:20:20") }
\ No newline at end of file
+{"id": "003", "durationField": duration("-P27Y48DT2400H"), "datetimeField": datetime("-0290-03-23T00:59:48.999+07:00"), "intervalField": interval-date("-2012-03-17, 2013-04-01"), "intervalPlus": interval-time("19:23:32.328Z,23:20:20") }
+{"id": "003", "dayTimeDurationField": day-time-duration("-P48DT2400H"), "yearMonthDurationField": year-month-duration("P27Y50M") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.1.ddl.aql
new file mode 100644
index 0000000..c04af59
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : create a dataset using year-month-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:year-month-duration,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.2.update.aql
new file mode 100644
index 0000000..d07ed34
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using year-month-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":year-month-duration("P16Y"), "name": "John"})
+insert into dataset Employee({"id":year-month-duration("-P37M"), "name": "Alex"})
+insert into dataset Employee({"id":year-month-duration("P2013Y"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.3.query.aql
new file mode 100644
index 0000000..a25bfb8
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_0/issue_363_temporal_key_0.3.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description  : create a dataset using year-month-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.id > year-month-duration("P350M")
+return $x
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.1.ddl.aql
new file mode 100644
index 0000000..1f59a51
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : create a dataset using datetime as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:datetime,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.2.update.aql
new file mode 100644
index 0000000..0640b52
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using datetime as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":datetime("1900-01-01T00:00:00"), "name": "John"})
+insert into dataset Employee({"id":datetime("2000-01-01T00:00:00"), "name": "Alex"})
+insert into dataset Employee({"id":datetime("2013-01-01T00:00:00"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.3.query.aql
new file mode 100644
index 0000000..2b82717
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_1/issue_363_temporal_key_1.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using datetime as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.id > datetime("2007-07-07T07:07:07.777Z")
+return $x
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.1.ddl.aql
new file mode 100644
index 0000000..97c62cf
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : create a dataset using time as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:time,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.2.update.aql
new file mode 100644
index 0000000..f98a754
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using time as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":time("03:10:00.493Z"), "name": "John"})
+insert into dataset Employee({"id":time("20:37:19+08:00"), "name": "Alex"})
+insert into dataset Employee({"id":time("21:39:17.948-04:00"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.3.query.aql
new file mode 100644
index 0000000..197b461
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_2/issue_363_temporal_key_2.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using time as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.id > time("07:07:07.777Z")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.1.ddl.aql
new file mode 100644
index 0000000..5e4ae49
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : create a dataset using date as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:date,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.2.update.aql
new file mode 100644
index 0000000..624cdc8
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using date as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":date("2010-01-01"), "name": "John"})
+insert into dataset Employee({"id":date("-1912-10-11"), "name": "Alex"})
+insert into dataset Employee({"id":date("0732-02-02"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.3.query.aql
new file mode 100644
index 0000000..3f9960e
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_3/issue_363_temporal_key_3.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using date as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.id > date("2007-07-07")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.1.ddl.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.1.ddl.aql
new file mode 100644
index 0000000..9a3da89
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.1.ddl.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : create a dataset using day-time-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Emp as open {
+id:day-time-duration,
+name:string
+}
+
+create dataset Employee(Emp) primary key id;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.2.update.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.2.update.aql
new file mode 100644
index 0000000..04a35de
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.2.update.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using day-time-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+
+use dataverse test;
+
+insert into dataset Employee({"id":day-time-duration("P380DT983M"), "name": "John"})
+insert into dataset Employee({"id":day-time-duration("-P3829H849.392S"), "name": "Alex"})
+insert into dataset Employee({"id":day-time-duration("PT93847M0.392S"), "name": "Bob"})
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.3.query.aql b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.3.query.aql
new file mode 100644
index 0000000..e45250b
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/issue_363_temporal_key_4/issue_363_temporal_key_4.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : create a dataset using day-time-duration as the primary key 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * Issue        : 363
+ */
+ 
+use dataverse test;
+
+for $x in dataset('Employee')
+where $x.id > day-time-duration("P350D")
+return $x
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_0/issue363_temporal_key_0.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_0/issue363_temporal_key_0.1.adm
new file mode 100644
index 0000000..be11d3c
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_0/issue363_temporal_key_0.1.adm
@@ -0,0 +1 @@
+{ "id": year-month-duration("P2013Y"), "name": "Bob" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_1/issue363_temporal_key_1.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_1/issue363_temporal_key_1.1.adm
new file mode 100644
index 0000000..f4a131a
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_1/issue363_temporal_key_1.1.adm
@@ -0,0 +1 @@
+{ "id": datetime("2013-01-01T00:00:00.000Z"), "name": "Bob" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_2/issue363_temporal_key_2.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_2/issue363_temporal_key_2.1.adm
new file mode 100644
index 0000000..e9829f4
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_2/issue363_temporal_key_2.1.adm
@@ -0,0 +1,2 @@
+{ "id": time("12:37:19.000Z"), "name": "Alex" }
+{ "id": time("01:39:17.948Z"), "name": "Bob" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_3/issue363_temporal_key_3.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_3/issue363_temporal_key_3.1.adm
new file mode 100644
index 0000000..125c38a
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_3/issue363_temporal_key_3.1.adm
@@ -0,0 +1 @@
+{ "id": date("2010-01-01"), "name": "John" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_4/issue363_temporal_key_4.1.adm b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_4/issue363_temporal_key_4.1.adm
new file mode 100644
index 0000000..43bda78
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/results/basic/issue_363_temporal_key_4/issue363_temporal_key_4.1.adm
@@ -0,0 +1 @@
+{ "id": day-time-duration("P380DT16H23M"), "name": "John" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/results/basic/meta17/meta17.1.adm b/asterix-app/src/test/resources/metadata/results/basic/meta17/meta17.1.adm
index 2de89a6..d193dd1 100644
--- a/asterix-app/src/test/resources/metadata/results/basic/meta17/meta17.1.adm
+++ b/asterix-app/src/test/resources/metadata/results/basic/meta17/meta17.1.adm
@@ -42,6 +42,7 @@
 { "DataverseName": "Metadata", "DatatypeName": "circle", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "date", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "datetime", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
+{ "DataverseName": "Metadata", "DatatypeName": "day-time-duration", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "double", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "duration", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "float", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
@@ -58,3 +59,4 @@
 { "DataverseName": "Metadata", "DatatypeName": "rectangle", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "string", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "time", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
+{ "DataverseName": "Metadata", "DatatypeName": "year-month-duration", "Derived": null, "Timestamp": "Fri Feb 08 15:49:29 PST 2013" }
diff --git a/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm b/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
index 84e2ca8..cecdb85 100644
--- a/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
+++ b/asterix-app/src/test/resources/metadata/results/basic/metadata_datatype/metadata_datatype.1.adm
@@ -42,6 +42,7 @@
 { "DataverseName": "Metadata", "DatatypeName": "circle", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "date", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "datetime", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
+{ "DataverseName": "Metadata", "DatatypeName": "day-time-duration", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "double", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "duration", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "float", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
@@ -58,3 +59,4 @@
 { "DataverseName": "Metadata", "DatatypeName": "rectangle", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "string", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
 { "DataverseName": "Metadata", "DatatypeName": "time", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
+{ "DataverseName": "Metadata", "DatatypeName": "year-month-duration", "Derived": null, "Timestamp": "Fri Mar 29 11:19:47 PDT 2013" }
diff --git a/asterix-app/src/test/resources/metadata/testsuite.xml b/asterix-app/src/test/resources/metadata/testsuite.xml
index 47bcafa..63487d4 100644
--- a/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -150,6 +150,31 @@
         <output-dir compare="Text">issue_251_dataset_hint_4</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="basic">
+      <compilation-unit name="issue_363_temporal_key_0">
+        <output-dir compare="Text">issue_363_temporal_key_0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="basic">
+      <compilation-unit name="issue_363_temporal_key_1">
+        <output-dir compare="Text">issue_363_temporal_key_1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="basic">
+      <compilation-unit name="issue_363_temporal_key_2">
+        <output-dir compare="Text">issue_363_temporal_key_2</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="basic">
+      <compilation-unit name="issue_363_temporal_key_3">
+        <output-dir compare="Text">issue_363_temporal_key_3</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="basic">
+      <compilation-unit name="issue_363_temporal_key_4">
+        <output-dir compare="Text">issue_363_temporal_key_4</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="exception">
     <test-case FilePath="exception">
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.1.ddl.aql
new file mode 100644
index 0000000..0e39a04
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description      :   Check comparison and order-by for day-time-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.2.update.aql
new file mode 100644
index 0000000..335a24a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.2.update.aql
@@ -0,0 +1,5 @@
+/*
+ * Description      :   Check comparison and order-by for day-time-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.3.query.aql
new file mode 100644
index 0000000..69a8b28
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/day_time_duration_order/day_time_duration_order.3.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description      :   Check comparison and order-by for day-time-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
+use dataverse test;
+
+let $dr1 := day-time-duration("P439D")
+let $dr2 := day-time-duration("-PT328M")
+let $dr3 := day-time-duration("-P48DT12M43.932S")
+let $dr4 := day-time-duration("P12H")
+
+for $dr in [$dr1, $dr2, $dr3, $dr4]
+order by $dr
+return $dr
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.1.ddl.aql
new file mode 100644
index 0000000..ba511f2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for equality comparisons for non-total-ordered types
+ * Expected Res : Success
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.2.update.aql
new file mode 100644
index 0000000..dd5635c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for equality comparisons for non-total-ordered types
+ * Expected Res : Success
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.3.query.aql
new file mode 100644
index 0000000..7e898a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_equality/issue363_equality.3.query.aql
@@ -0,0 +1,54 @@
+/*
+ * Description  : a test case for equality comparisons for non-total-ordered types
+ * Expected Res : Success
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+
+let $v1 := duration("P3Y6M3DT9H5M2.348S")
+let $v2 := year-month-duration("P3Y6M")
+let $v3 := day-time-duration("P3DT9H5M2.348S")
+let $v4 := point("47.44,80.65")
+let $v5 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
+let $v6 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+let $v7 := circle("0.1234,-1.00e-10 +10.5E-2")
+let $v8 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
+let $v9 := interval-from-datetime(datetime("-1987-11-19T02:43:57.938+08:00"), datetime("19991112T124935948-0700"))
+let $dv1 := duration("P3Y6M3DT9H5M2.348S")
+let $dv2 := year-month-duration("P3Y6M")
+let $dv3 := day-time-duration("P3DT9H5M2.348S")
+let $dv4 := point("47.44,80.65")
+let $dv5 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
+let $dv6 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+let $dv7 := circle("0.1234,-1.00e-10 +10.5E-2")
+let $dv8 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
+let $dv9 := interval-from-datetime(datetime("-1987-11-19T02:43:57.938+08:00"), datetime("19991112T124935948-0700"))
+let $ndv1 := duration("P4Y6M3DT9H5M2.348S")
+let $ndv2 := year-month-duration("P3Y7M")
+let $ndv3 := day-time-duration("P3DT1H5M2.348S")
+let $ndv4 := point("47.4444,80.65")
+let $ndv5 := line("10.5678,11.1e-1 +10.2E-2,-11.22")
+let $ndv6 := polygon("-1.0,+10.5e2 -02.19E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+let $ndv7 := circle("0.5678,-1.00e-10 +10.5E-2")
+let $ndv8 := rectangle("0.5678,-1.00e-10 5.5487,0.48765")
+let $ndv9 := interval-from-datetime(datetime("-1983-11-19T02:43:57.938+08:00"), datetime("19991112T124935948-0700"))
+
+return { "duration":  $v1 = $dv1, 
+"year-month-duration":  $v2 = $dv2, 
+"day-time-duration":  $v3 = $dv3, 
+"point": $v4 = $dv4, 
+"line": $v5 = $dv5, 
+"polygon": $v6 = $dv6,
+"circle": $v7 = $dv7,
+"rectangle": $v8 = $dv8,
+"interval": $v9 = $dv9,
+"duration2":  $v1 != $ndv1, 
+"year-month-duration2": $v2 != $ndv2, 
+"day-time-duration2":  $v3 != $ndv3, 
+"point2": $v4 != $ndv4, 
+"line2": $v5 != $ndv5, 
+"polygon2": $v6 != $ndv6,
+"circle2": $v7 != $ndv7,
+"rectangle2": $v8 != $ndv8,
+"interval2": $v9 != $ndv9
+}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.1.ddl.aql
new file mode 100644
index 0000000..b05c7fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of circle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.2.update.aql
new file mode 100644
index 0000000..b05c7fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of circle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.3.query.aql
new file mode 100644
index 0000000..dc9aeb5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_circle/issue363_inequality_circle.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of circle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := circle("0.1234,-1.00e-10 +10.5E-2")
+let $dv1 := circle("0.5678,-1.00e-10 +10.5E-2")
+
+return { "circle0":  $v1 > $dv1, "circle1": $dv1 < $v1, "circle2":  $v1 >= $dv1, "circle3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.1.ddl.aql
new file mode 100644
index 0000000..6533b0d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of duration
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.2.update.aql
new file mode 100644
index 0000000..6533b0d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of duration
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.3.query.aql
new file mode 100644
index 0000000..a365aba
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_duration/issue363_inequality_duration.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of duration
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := duration("P300Y6M3DT9H5M2.348S")
+let $dv1 := duration("P3Y6M3DT9H5M2.348S")
+
+return { "duration0":  $v1 > $dv1, "duration1": $dv1 < $v1, "duration2":  $v1 >= $dv1, "duration3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.1.ddl.aql
new file mode 100644
index 0000000..ac47f3f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of interval
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.2.update.aql
new file mode 100644
index 0000000..ac47f3f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of interval
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.3.query.aql
new file mode 100644
index 0000000..36ac511
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_interval/issue363_inequality_interval.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of interval
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := interval-from-datetime(datetime("-1987-11-19T02:43:57.938+08:00"), datetime("19991112T124935948-0700"))
+let $dv1 := interval-from-datetime(datetime("-1983-11-19T02:43:57.938+08:00"), datetime("19991112T124935948-0700"))
+
+return { "interval0":  $v1 > $dv1, "interval1": $dv1 < $v1, "interval2":  $v1 >= $dv1, "interval3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.1.ddl.aql
new file mode 100644
index 0000000..3618d18
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of line
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.2.update.aql
new file mode 100644
index 0000000..3618d18
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of line
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.3.query.aql
new file mode 100644
index 0000000..d887233
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_line/issue363_inequality_line.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of line
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
+let $dv1 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
+
+return { "line0":  $v1 > $dv1, "line1": $dv1 < $v1, "line2":  $v1 >= $dv1, "line3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.1.ddl.aql
new file mode 100644
index 0000000..434dd0a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of point
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.2.update.aql
new file mode 100644
index 0000000..434dd0a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of point
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.3.query.aql
new file mode 100644
index 0000000..2199d41
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_point/issue363_inequality_point.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of point
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := point("47.44,80.65")
+let $dv1 := point("47.4444,80.65")
+
+return { "point0":  $v1 > $dv1, "point1": $dv1 < $v1, "point2":  $v1 >= $dv1, "point3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.ddl.aql
new file mode 100644
index 0000000..12e3ca6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of polygon
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.2.update.aql
new file mode 100644
index 0000000..12e3ca6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of polygon
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.3.query.aql
new file mode 100644
index 0000000..04af82a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_polygon/issue363_inequality_polygon.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of polygon
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+let $dv1 := polygon("-1.0,+10.5e2 -02.19E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
+
+return { "polygon0":  $v1 > $dv1, "polygon1": $dv1 < $v1, "polygon2":  $v1 >= $dv1, "polygon3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.ddl.aql
new file mode 100644
index 0000000..c62c7a3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.ddl.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of rectangle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.2.update.aql
new file mode 100644
index 0000000..c62c7a3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : a test case for inequality comparisons of rectangle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.3.query.aql
new file mode 100644
index 0000000..ed6770e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : a test case for inequality comparisons of rectangle
+ * Expected Res : Failure
+ * Date         : 9 May 2013
+ * Issue        : 363
+ */
+ 
+let $v1 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
+let $dv1 := rectangle("0.5678,-1.00e-10 5.5487,0.48765")
+
+return { "rectangle0":  $v1 > $dv1, "rectangle1": $dv1 < $v1, "rectangle2":  $v1 >= $dv1, "rectangle3": $dv1 <= $v1 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.1.ddl.aql
new file mode 100644
index 0000000..356810c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description      :   Check comparison and order-by for year-month-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.2.update.aql
new file mode 100644
index 0000000..65105d6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.2.update.aql
@@ -0,0 +1,5 @@
+/*
+ * Description      :   Check comparison and order-by for year-month-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.3.query.aql
new file mode 100644
index 0000000..3fbfafe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/year_month_duration_order/year_month_duration_order.3.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description      :   Check comparison and order-by for year-month-duration
+ * Expected Result  :   Success
+ * Date             :   May 18, 2013
+ */
+use dataverse test;
+
+let $dr1 := year-month-duration("P439Y")
+let $dr2 := year-month-duration("-P328M")
+let $dr3 := year-month-duration("-P48Y12M")
+let $dr4 := year-month-duration("P12M")
+
+for $dr in [$dr1, $dr2, $dr3, $dr4]
+order by $dr
+return $dr
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.1.ddl.aql
index 754ea81..84fe314 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.1.ddl.aql
@@ -1,3 +1,9 @@
+/*
+ * Description  : test duration constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ */
+
 drop dataverse test if exists;
 create dataverse test;
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.2.update.aql
index e69de29..0c32771 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.2.update.aql
@@ -0,0 +1,5 @@
+/*
+ * Description  : test duration constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
index 6db5228..898ab18 100644
--- a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
@@ -1,3 +1,9 @@
+/*
+ * Description  : test duration constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ */
+
 use dataverse test;
 
 let $c1 := duration("P30Y10M25DT13H12M50S")
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.1.ddl.aql
new file mode 100644
index 0000000..f3978bf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.1.ddl.aql
@@ -0,0 +1,10 @@
+/*
+ * Description  : test sub type duration (year-month-duration and day-time-duration) constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * issue        : 363
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.2.update.aql
new file mode 100644
index 0000000..73d2817
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description  : test sub type duration (year-month-duration and day-time-duration) constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * issue        : 363
+ */
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
new file mode 100644
index 0000000..f526bc4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Description  : test sub type duration (year-month-duration and day-time-duration) constructors 
+ * Expected Res : Success
+ * Date         : 7 May 2013
+ * issue        : 363
+ */
+
+use dataverse test;
+
+let $c1 := year-month-duration("P30Y10M")
+let $c2 := day-time-duration("P25DT13H12M50S")
+let $c3 := day-time-duration("PT13H12M50S")
+let $c4 := year-month-duration("P30Y")
+let $c5 := day-time-duration("PT13H")
+let $c6 := year-month-duration("-P30Y10M")
+let $c7 := day-time-duration("-P25DT13H12M50S")
+let $c8 := day-time-duration("-PT13H50S")
+let $c9 := day-time-duration("P120D")
+let $c10 := year-month-duration("-P28M")
+let $c11 := day-time-duration("PT29M90.937S")
+let $c12 := year-month-duration("P300Y15M")
+return {"duration1": $c1, "duration2": $c2, "duration3": $c3, "duration4": $c4, "duration5": $c5, "duration6": $c6, "duration7": $c7, "duration8": $c8, "duration9": $c9, "duration10": $c10, "duration11": $c11, "duration12": $c12}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/duration_comps/duration_comps.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_comps/duration_comps.3.query.aql
index 77fcc4f..c6fe3df 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/duration_comps/duration_comps.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_comps/duration_comps.3.query.aql
@@ -5,7 +5,7 @@
 let $dr3 := duration("P1Y")
 let $dr4 := duration("P13M")
 let $dr5 := duration("PT24H")
-let $dr6 := duration-from-months(months-of-year-month-duration($dr3))
-let $dr7 := duration-from-ms(ms-of-day-time-duration($dr1))
+let $dr6 := duration-from-months(months-from-year-month-duration(get-year-month-duration($dr3)))
+let $dr7 := duration-from-ms(ms-from-day-time-duration(get-day-time-duration($dr1)))
 
 return { "yearMonthGreaterComp" : year-month-duration-greater-than($dr4, $dr3), "dayTimeGreaterComp" : day-time-duration-greater-than($dr2, $dr1), "yearMonthLessComp" : year-month-duration-less-than($dr4, $dr3), "dayTimeLessComp" : day-time-duration-less-than($dr2, $dr1), "equal1": duration-equal($dr2, $dr5), "equal2": duration-equal($dr1, $dr5), "equal3": duration-equal($dr6, $dr3), "equal4": duration-equal($dr7, $dr1) }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.1.ddl.aql
index 0338aef..07825c7 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.1.ddl.aql
@@ -14,7 +14,9 @@
   timeField: time?,
   datetimeField: datetime?,
   durationField: duration?,
-  intervalField: interval?
+  intervalField: interval?,
+  yearMonthDurationField: year-month-duration?,
+  dayTimeDurationField: day-time-duration?
 }
 
 create external dataset testds(testtype)
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.3.query.aql
index 2defafc..de39156 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/insert_from_ext_ds/insert_from_ext_ds.3.query.aql
@@ -1,4 +1,4 @@
 use dataverse testdvt;
 
 for $r in dataset("testds") 
-return {"date": $r.dateField, "time": $r.timeField, "datetime": $r.datetimeField, "duration": $r.durationField, "interval": $r.intervalField }
\ No newline at end of file
+return {"date": $r.dateField, "time": $r.timeField, "datetime": $r.datetimeField, "duration": $r.durationField, "interval": $r.intervalField, "ymduration": $r.yearMonthDurationField, "dtduration": $r.dayTimeDurationField }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/day_time_duration_order/day_time_duration_order.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/day_time_duration_order/day_time_duration_order.1.adm
new file mode 100644
index 0000000..4c0aea9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/day_time_duration_order/day_time_duration_order.1.adm
@@ -0,0 +1,4 @@
+day-time-duration("-P48DT12M43.932S")
+day-time-duration("-PT5H28M")
+day-time-duration("P12H")
+day-time-duration("P439D")
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_equality/issue363_equality.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_equality/issue363_equality.1.adm
new file mode 100644
index 0000000..ac3caa3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_equality/issue363_equality.1.adm
@@ -0,0 +1 @@
+{ "duration": true, "year-month-duration": true, "day-time-duration": true, "point": true, "line": true, "polygon": true, "circle": true, "rectangle": true, "interval": true, "duration2": true, "year-month-duration2": true, "day-time-duration2": true, "point2": true, "line2": true, "polygon2": true, "circle2": true, "rectangle2": true, "interval2": true }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_circle/issue363_inequality_circle.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_circle/issue363_inequality_circle.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_circle/issue363_inequality_circle.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_duration/issue363_inequality_duration.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_duration/issue363_inequality_duration.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_duration/issue363_inequality_duration.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_interval/issue363_inequality_interval.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_interval/issue363_inequality_interval.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_interval/issue363_inequality_interval.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_line/issue363_inequality_line.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_line/issue363_inequality_line.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_line/issue363_inequality_line.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_point/issue363_inequality_point.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_point/issue363_inequality_point.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_point/issue363_inequality_point.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_polygon/issue363_inequality_polygon.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/issue363_inequality_rectangle/issue363_inequality_rectangle.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/year_month_duration_order/year_month_duration_order.1.adm b/asterix-app/src/test/resources/runtimets/results/comparison/year_month_duration_order/year_month_duration_order.1.adm
new file mode 100644
index 0000000..c0159ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/year_month_duration_order/year_month_duration_order.1.adm
@@ -0,0 +1,4 @@
+year-month-duration("-P49Y")
+year-month-duration("-P27Y4M")
+year-month-duration("P1Y")
+year-month-duration("P439Y")
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm b/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
new file mode 100644
index 0000000..108af42
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
@@ -0,0 +1 @@
+{ "duration1": year-month-duration("P30Y10M"), "duration2": day-time-duration("P25DT13H12M50S"), "duration3": day-time-duration("PT13H12M50S"), "duration4": year-month-duration("P30Y"), "duration5": day-time-duration("PT13H"), "duration6": year-month-duration("-P30Y10M"), "duration7": day-time-duration("-P25DT13H12M50S"), "duration8": day-time-duration("-PT13H50S"), "duration9": day-time-duration("P120D"), "duration10": year-month-duration("-P2Y4M"), "duration11": day-time-duration("PT30M30.937S"), "duration12": year-month-duration("P301Y3M") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds/insert_from_ext_ds.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds/insert_from_ext_ds.1.adm
index b087496..9573677 100644
--- a/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds/insert_from_ext_ds.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds/insert_from_ext_ds.1.adm
@@ -1,3 +1,4 @@
-{ "date": date("-2012-12-12"), "time": time("23:49:12.390Z"), "datetime": datetime("2012-12-12T00:00:00.001Z"), "duration": duration("P20Y19DT4H14M23.34S"), "interval": interval-datetime("2012-12-12T00:00:00.001Z, 2013-08-10T22:10:15.398Z") }
-{ "date": null, "time": time("04:12:12.219Z"), "datetime": datetime("1920-12-21T11:29:18.478Z"), "duration": null, "interval": interval-time("04:29:30.000Z, 07:59:59.999Z") }
-{ "date": null, "time": null, "datetime": datetime("-0290-03-22T17:59:48.999Z"), "duration": duration("-P27Y148D"), "interval": interval-date("-2012-03-17, 2013-04-01") }
\ No newline at end of file
+{ "date": date("-2012-12-12"), "time": time("23:49:12.390Z"), "datetime": datetime("2012-12-12T00:00:00.001Z"), "duration": duration("P20Y19DT4H14M23.34S"), "interval": interval-datetime("2012-12-12T00:00:00.001Z, 2013-08-10T22:10:15.398Z"), "ymduration": null, "dtduration": null }
+{ "date": null, "time": time("04:12:12.219Z"), "datetime": datetime("1920-12-21T11:29:18.478Z"), "duration": null, "interval": interval-time("04:29:30.000Z, 07:59:59.999Z"), "ymduration": null, "dtduration": null }
+{ "date": null, "time": null, "datetime": datetime("-0290-03-22T17:59:48.999Z"), "duration": duration("-P27Y148D"), "interval": interval-date("-2012-03-17, 2013-04-01"), "ymduration": null, "dtduration": null }
+{ "date": null, "time": null, "datetime": null, "duration": null, "interval": null, "ymduration": year-month-duration("P31Y2M"), "dtduration": day-time-duration("-P148D") }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 976f071..5b6d787 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -391,6 +391,11 @@
   </test-group>
   <test-group name="comparison">
     <test-case FilePath="comparison">
+      <compilation-unit name="year_month_duration_order">
+        <output-dir compare="Text">year_month_duration_order</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
       <compilation-unit name="datetime_order">
         <output-dir compare="Text">datetime_order</output-dir>
       </compilation-unit>
@@ -517,6 +522,53 @@
         <output-dir compare="Text">string_null</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_equality">
+        <output-dir compare="Text">issue363_equality</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_duration">
+        <output-dir compare="Text">issue363_inequality_duration</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_interval">
+        <output-dir compare="Text">issue363_inequality_interval</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_point">
+        <output-dir compare="Text">issue363_inequality_point</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_line">
+        <output-dir compare="Text">issue363_inequality_line</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_polygon">
+        <output-dir compare="Text">issue363_inequality_polygon</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_rectangle">
+        <output-dir compare="Text">issue363_inequality_rectangle</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
+      <compilation-unit name="issue363_inequality_circle">
+        <output-dir compare="Text">issue363_inequality_circle</output-dir>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="constructor">
     <test-case FilePath="constructor">
@@ -555,6 +607,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="constructor">
+      <compilation-unit name="duration_02">
+        <output-dir compare="Text">duration_02</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="constructor">
       <compilation-unit name="float_01">
         <output-dir compare="Text">float_01</output-dir>
       </compilation-unit>
diff --git a/asterix-aql/pom.xml b/asterix-aql/pom.xml
index 038ec62..249299c 100644
--- a/asterix-aql/pom.xml
+++ b/asterix-aql/pom.xml
@@ -41,6 +41,24 @@
 					</execution>
 				</executions>
 			</plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/javacc/</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
 		</plugins>
 		<pluginManagement>
 			<plugins>
diff --git a/asterix-common/.gitignore b/asterix-common/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/asterix-common/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/AsterixBuiltinTypeMap.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/AsterixBuiltinTypeMap.java
index 27cf542..aa8f452 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/AsterixBuiltinTypeMap.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/AsterixBuiltinTypeMap.java
@@ -40,6 +40,8 @@
         _builtinTypeMap.put("time", BuiltinType.ATIME);
         _builtinTypeMap.put("datetime", BuiltinType.ADATETIME);
         _builtinTypeMap.put("duration", BuiltinType.ADURATION);
+        _builtinTypeMap.put("year-month-duration", BuiltinType.AYEARMONTHDURATION);
+        _builtinTypeMap.put("day-time-duration", BuiltinType.ADAYTIMEDURATION);
         _builtinTypeMap.put("interval", BuiltinType.AINTERVAL);
         _builtinTypeMap.put("point", BuiltinType.APOINT);
         _builtinTypeMap.put("point3d", BuiltinType.APOINT3D);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..0c54ea1
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ACirclePartialBinaryComparatorFactory.java
@@ -0,0 +1,82 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ACircleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class ACirclePartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final ACirclePartialBinaryComparatorFactory INSTANCE = new ACirclePartialBinaryComparatorFactory();
+
+    private ACirclePartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                try {
+                    // center.x
+                    int c = Double
+                            .compare(
+                                    ADoubleSerializerDeserializer.getDouble(
+                                            b1,
+                                            s1
+                                                    + ACircleSerializerDeserializer
+                                                            .getCenterPointCoordinateOffset(Coordinate.X) - 1),
+                                    ADoubleSerializerDeserializer.getDouble(
+                                            b2,
+                                            s2
+                                                    + ACircleSerializerDeserializer
+                                                            .getCenterPointCoordinateOffset(Coordinate.X) - 1));
+                    if (c == 0) {
+                        // center.y
+                        c = Double.compare(
+                                ADoubleSerializerDeserializer.getDouble(b1,
+                                        s1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y)
+                                                - 1),
+                                ADoubleSerializerDeserializer.getDouble(b2,
+                                        s2 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y)
+                                                - 1));
+                        if (c == 0) {
+                            // radius
+                            return Double.compare(
+                                    ADoubleSerializerDeserializer.getDouble(b1,
+                                            s1 + ACircleSerializerDeserializer.getRadiusOffset() - 1),
+                                    ADoubleSerializerDeserializer.getDouble(b2,
+                                            s2 + ACircleSerializerDeserializer.getRadiusOffset() - 1));
+                        }
+                    }
+                    return c;
+                } catch (HyracksDataException hex) {
+                    throw new IllegalStateException(hex);
+                }
+            }
+        };
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateOrTimeAscBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateOrTimeAscBinaryComparatorFactory.java
deleted file mode 100644
index 464a03c..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateOrTimeAscBinaryComparatorFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2009-2011 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.dataflow.data.nontagged.comparators;
-
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-
-public class ADateOrTimeAscBinaryComparatorFactory implements IBinaryComparatorFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public static final ADateOrTimeAscBinaryComparatorFactory INSTANCE = new ADateOrTimeAscBinaryComparatorFactory();
-
-    private ADateOrTimeAscBinaryComparatorFactory() {
-    }
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
-     */
-    @Override
-    public IBinaryComparator createBinaryComparator() {
-        return new IBinaryComparator() {
-
-            @Override
-            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
-                int chrononTime1 = getInt(b1, s1);
-                int chrononTime2 = getInt(b2, s2);
-
-                if (chrononTime1 > chrononTime2) {
-                    return 1;
-                } else if (chrononTime1 < chrononTime2) {
-                    return -1;
-                } else {
-                    return 0;
-                }
-            }
-
-            private int getInt(byte[] bytes, int start) {
-                return ((bytes[start] & 0xff) << 24) + ((bytes[start + 1] & 0xff) << 16)
-                        + ((bytes[start + 2] & 0xff) << 8) + ((bytes[start + 3] & 0xff) << 0);
-            }
-        };
-    }
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateTimeAscBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateTimeAscBinaryComparatorFactory.java
deleted file mode 100644
index 2dd8785..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADateTimeAscBinaryComparatorFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package edu.uci.ics.asterix.dataflow.data.nontagged.comparators;
-
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-
-public class ADateTimeAscBinaryComparatorFactory implements IBinaryComparatorFactory {
-    private static final long serialVersionUID = 1L;
-
-    public static final ADateTimeAscBinaryComparatorFactory INSTANCE = new ADateTimeAscBinaryComparatorFactory();
-
-    private ADateTimeAscBinaryComparatorFactory() {
-    }
-
-    @Override
-    public IBinaryComparator createBinaryComparator() {
-        return new IBinaryComparator() {
-
-            @Override
-            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
-
-                long chrononTime1 = getLong(b1, s1);
-                long chrononTime2 = getLong(b2, s2);
-
-                if (chrononTime1 > chrononTime2) {
-                    return 1;
-                } else if (chrononTime1 < chrononTime2) {
-                    return -1;
-                } else {
-                    return 0;
-                }
-            }
-
-            private long getLong(byte[] bytes, int start) {
-                return (((long) (bytes[start] & 0xff)) << 56) + (((long) (bytes[start + 1] & 0xff)) << 48)
-                        + (((long) (bytes[start + 2] & 0xff)) << 40) + (((long) (bytes[start + 3] & 0xff)) << 32)
-                        + (((long) (bytes[start + 4] & 0xff)) << 24) + (((long) (bytes[start + 5] & 0xff)) << 16)
-                        + (((long) (bytes[start + 6] & 0xff)) << 8) + (((long) (bytes[start + 7] & 0xff)) << 0);
-            }
-
-        };
-    }
-
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADurationPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADurationPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..877426d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ADurationPartialBinaryComparatorFactory.java
@@ -0,0 +1,59 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+
+public class ADurationPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final ADurationPartialBinaryComparatorFactory INSTANCE = new ADurationPartialBinaryComparatorFactory();
+
+    private ADurationPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                int c = Integer.compare(
+                        AInt32SerializerDeserializer.getInt(b1,
+                                s1 + ADurationSerializerDeserializer.getYearMonthOffset()),
+                        AInt32SerializerDeserializer.getInt(b2,
+                                s2 + ADurationSerializerDeserializer.getYearMonthOffset()));
+                if (c == 0) {
+                    return Double.compare(
+                            ADoubleSerializerDeserializer.getDouble(b1,
+                                    s1 + ADurationSerializerDeserializer.getDayTimeOffset()),
+                            ADoubleSerializerDeserializer.getDouble(b2,
+                                    s2 + ADurationSerializerDeserializer.getDayTimeOffset()));
+                }
+                return c;
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..69f5051
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+
+public class AIntervalPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AIntervalPartialBinaryComparatorFactory INSTANCE = new AIntervalPartialBinaryComparatorFactory();
+
+    private AIntervalPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                int c = Double.compare(
+                        AInt64SerializerDeserializer.getLong(b1,
+                                s1 + AIntervalSerializerDeserializer.getIntervalStartOffset()),
+                        AInt64SerializerDeserializer.getLong(b2,
+                                s2 + AIntervalSerializerDeserializer.getIntervalStartOffset()));
+                if (c == 0) {
+                    c = Double.compare(
+                            AInt64SerializerDeserializer.getLong(b1,
+                                    s1 + AIntervalSerializerDeserializer.getIntervalEndOffset()),
+                            AInt64SerializerDeserializer.getLong(b2,
+                                    s2 + AIntervalSerializerDeserializer.getIntervalEndOffset()));
+                    if (c == 0) {
+                        c = Byte.compare(b1[s1 + 16], b2[s2 + 16]);
+                    }
+                }
+                return c;
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..9f0fb57
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ALinePartialBinaryComparatorFactory.java
@@ -0,0 +1,88 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ALineSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class ALinePartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final ALinePartialBinaryComparatorFactory INSTANCE = new ALinePartialBinaryComparatorFactory();
+
+    private ALinePartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                try {
+                    int c = Double.compare(
+                            ADoubleSerializerDeserializer.getDouble(b1,
+                                    s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X) - 1),
+                            ADoubleSerializerDeserializer.getDouble(b2,
+                                    s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X) - 1));
+                    if (c == 0) {
+                        c = Double.compare(
+                                ADoubleSerializerDeserializer.getDouble(b1,
+                                        s1 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y)
+                                                - 1),
+                                ADoubleSerializerDeserializer.getDouble(b2,
+                                        s2 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y)
+                                                - 1));
+                        if (c == 0) {
+                            c = Double.compare(
+                                    ADoubleSerializerDeserializer.getDouble(b1,
+                                            s1 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X)
+                                                    - 1),
+                                    ADoubleSerializerDeserializer.getDouble(b2,
+                                            s2 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X)
+                                                    - 1));
+                            if (c == 0) {
+                                return Double.compare(
+                                        ADoubleSerializerDeserializer.getDouble(
+                                                b1,
+                                                s1
+                                                        + ALineSerializerDeserializer
+                                                                .getEndPointCoordinateOffset(Coordinate.Y) - 1),
+                                        ADoubleSerializerDeserializer.getDouble(
+                                                b2,
+                                                s2
+                                                        + ALineSerializerDeserializer
+                                                                .getEndPointCoordinateOffset(Coordinate.Y) - 1));
+                            }
+                        }
+                    }
+                    return c;
+                } catch (HyracksDataException hex) {
+                    throw new IllegalStateException(hex);
+                }
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
index ca926e4..865ab94 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
@@ -32,11 +32,20 @@
                     .createBinaryComparator();
             final IBinaryComparator ascDoubleComp = new PointableBinaryComparatorFactory(DoublePointable.FACTORY)
                     .createBinaryComparator();
-            final IBinaryComparator ascRectangleComp = RectangleBinaryComparatorFactory.INSTANCE
+            final IBinaryComparator ascRectangleComp = ARectanglePartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
-            final IBinaryComparator ascDateTimeComp = ADateTimeAscBinaryComparatorFactory.INSTANCE
+            final IBinaryComparator ascCircleComp = ACirclePartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
-            final IBinaryComparator ascDateOrTimeComp = ADateOrTimeAscBinaryComparatorFactory.INSTANCE
+            final IBinaryComparator ascDurationComp = ADurationPartialBinaryComparatorFactory.INSTANCE
+                    .createBinaryComparator();
+            final IBinaryComparator ascIntervalComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+                    .createBinaryComparator();
+            final IBinaryComparator ascLineComp = ALinePartialBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+            final IBinaryComparator ascPointComp = APointPartialBinaryComparatorFactory.INSTANCE
+                    .createBinaryComparator();
+            final IBinaryComparator ascPoint3DComp = APoint3DPartialBinaryComparatorFactory.INSTANCE
+                    .createBinaryComparator();
+            final IBinaryComparator ascPolygonComp = APolygonPartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
             final IBinaryComparator rawComp = RawBinaryComparatorFactory.INSTANCE.createBinaryComparator();
 
@@ -58,9 +67,14 @@
                     case BOOLEAN: {
                         return ascBoolComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
+                    case TIME:
+                    case DATE:
+                    case YEARMONTHDURATION:
                     case INT32: {
                         return ascIntComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
+                    case DATETIME:
+                    case DAYTIMEDURATION:
                     case INT64: {
                         return ascLongComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
@@ -76,12 +90,26 @@
                     case RECTANGLE: {
                         return ascRectangleComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
-                    case DATETIME: {
-                        return ascDateTimeComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    case CIRCLE: {
+                        return ascCircleComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
-                    case TIME:
-                    case DATE: {
-                        return ascDateOrTimeComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    case POINT: {
+                        return ascPointComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    }
+                    case POINT3D: {
+                        return ascPoint3DComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    }
+                    case LINE: {
+                        return ascLineComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    }
+                    case POLYGON: {
+                        return ascPolygonComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    }
+                    case DURATION: {
+                        return ascDurationComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                    }
+                    case INTERVAL: {
+                        return ascIntervalComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
                     }
                     default: {
                         return rawComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..caf855a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APoint3DPartialBinaryComparatorFactory.java
@@ -0,0 +1,71 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APoint3DSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+
+public class APoint3DPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final APoint3DPartialBinaryComparatorFactory INSTANCE = new APoint3DPartialBinaryComparatorFactory();
+
+    private APoint3DPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                try {
+                    int c = Double.compare(
+                            ADoubleSerializerDeserializer.getDouble(b1,
+                                    s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1),
+                            ADoubleSerializerDeserializer.getDouble(b2,
+                                    s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1));
+                    if (c == 0) {
+                        c = Double.compare(
+                                ADoubleSerializerDeserializer.getDouble(b1,
+                                        s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1),
+                                ADoubleSerializerDeserializer.getDouble(b2,
+                                        s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1));
+                        if (c == 0) {
+                            return Double.compare(
+                                    ADoubleSerializerDeserializer.getDouble(b1,
+                                            s1 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z) - 1),
+                                    ADoubleSerializerDeserializer.getDouble(b2,
+                                            s2 + APoint3DSerializerDeserializer.getCoordinateOffset(Coordinate.Z) - 1));
+                        }
+                    }
+                    return c;
+                } catch (HyracksException hex) {
+                    throw new IllegalStateException(hex);
+                }
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..24d47eb
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APointPartialBinaryComparatorFactory.java
@@ -0,0 +1,61 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APointSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class APointPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public final static APointPartialBinaryComparatorFactory INSTANCE = new APointPartialBinaryComparatorFactory();
+
+    private APointPartialBinaryComparatorFactory() {
+
+    }
+
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                try {
+                    int c = Double.compare(
+                            ADoubleSerializerDeserializer.getDouble(b1,
+                                    s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1),
+                            ADoubleSerializerDeserializer.getDouble(b2,
+                                    s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X) - 1));
+                    if (c == 0) {
+                        return Double.compare(
+                                ADoubleSerializerDeserializer.getDouble(b1,
+                                        s1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1),
+                                ADoubleSerializerDeserializer.getDouble(b2,
+                                        s2 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y) - 1));
+                    }
+                    return c;
+                } catch (HyracksDataException hex) {
+                    throw new IllegalStateException(hex);
+                }
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..fec245f
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/APolygonPartialBinaryComparatorFactory.java
@@ -0,0 +1,90 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APolygonSerializerDeserializer;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
+
+public class APolygonPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public final static APolygonPartialBinaryComparatorFactory INSTANCE = new APolygonPartialBinaryComparatorFactory();
+
+    private APolygonPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                try {
+                    short pointCount1 = AInt16SerializerDeserializer.getShort(b1,
+                            s1 + APolygonSerializerDeserializer.getNumberOfPointsOffset() - 1);
+                    int c = Short.compare(
+                            pointCount1,
+                            AInt16SerializerDeserializer.getShort(b2,
+                                    s2 + APolygonSerializerDeserializer.getNumberOfPointsOffset() - 1));
+
+                    if (c == 0) {
+                        int ci = 0;
+                        for (int i = 0; i < pointCount1; i++) {
+                            ci = Double.compare(
+                                    DoubleSerializerDeserializer.getDouble(b1,
+                                            s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X)
+                                                    - 1),
+                                    DoubleSerializerDeserializer.getDouble(b2,
+                                            s1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X)
+                                                    - 1));
+                            if (ci == 0) {
+                                ci = Double.compare(
+                                        DoubleSerializerDeserializer.getDouble(
+                                                b1,
+                                                s1
+                                                        + APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                                                Coordinate.Y) - 1),
+                                        DoubleSerializerDeserializer.getDouble(
+                                                b2,
+                                                s1
+                                                        + APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                                                Coordinate.Y) - 1));
+                                if (ci == 0) {
+                                    continue;
+                                }
+                            }
+                            return ci;
+                        }
+                    }
+
+                    return c;
+                } catch (HyracksDataException hex) {
+                    throw new IllegalStateException(hex);
+                }
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/RectangleBinaryComparatorFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ARectanglePartialBinaryComparatorFactory.java
similarity index 86%
rename from asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/RectangleBinaryComparatorFactory.java
rename to asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ARectanglePartialBinaryComparatorFactory.java
index bdc8409..63d0d24 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/RectangleBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/comparators/ARectanglePartialBinaryComparatorFactory.java
@@ -4,12 +4,12 @@
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 
-public class RectangleBinaryComparatorFactory implements IBinaryComparatorFactory {
+public class ARectanglePartialBinaryComparatorFactory implements IBinaryComparatorFactory {
     private static final long serialVersionUID = 1L;
 
-    public final static RectangleBinaryComparatorFactory INSTANCE = new RectangleBinaryComparatorFactory();
+    public final static ARectanglePartialBinaryComparatorFactory INSTANCE = new ARectanglePartialBinaryComparatorFactory();
 
-    private RectangleBinaryComparatorFactory() {
+    private ARectanglePartialBinaryComparatorFactory() {
     }
 
     @Override
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
index 2d19320..495b41f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/AObjectBinaryHashFunctionFactory.java
@@ -4,6 +4,7 @@
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
 import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
 import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
@@ -33,9 +34,9 @@
 
             private IBinaryHashFunction doubleHash = DoubleBinaryHashFunctionFactory.INSTANCE
                     .createBinaryHashFunction();
-            private IBinaryHashFunction rectangleHash = RectangleBinaryHashFunctionFactory.INSTANCE
-                    .createBinaryHashFunction();
-            private IBinaryHashFunction rawHash = RawBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction();
+
+            private IBinaryHashFunction genericBinaryHash = MurmurHash3BinaryHashFunctionFamily.INSTANCE
+                    .createBinaryHashFunction(0);
 
             @Override
             public int hash(byte[] bytes, int offset, int length) {
@@ -44,9 +45,14 @@
                     case BOOLEAN: {
                         return boolHash.hash(bytes, offset + 1, length - 1);
                     }
+                    case TIME:
+                    case DATE:
+                    case YEARMONTHDURATION:
                     case INT32: {
                         return intHash.hash(bytes, offset + 1, length - 1);
                     }
+                    case DATETIME:
+                    case DAYTIMEDURATION:
                     case INT64: {
                         return longHash.hash(bytes, offset + 1, length - 1);
                     }
@@ -59,14 +65,11 @@
                     case STRING: {
                         return stringHash.hash(bytes, offset + 1, length - 1);
                     }
-                    case RECTANGLE: {
-                        return rectangleHash.hash(bytes, offset + 1, length - 1);
-                    }
                     case NULL: {
                         return 0;
                     }
                     default: {
-                        return rawHash.hash(bytes, offset + 1, length - 1);
+                        return genericBinaryHash.hash(bytes, offset + 1, length - 1);
                     }
                 }
             }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/MurmurHash3BinaryHashFunctionFamily.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/MurmurHash3BinaryHashFunctionFamily.java
deleted file mode 100644
index 83b165b..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/MurmurHash3BinaryHashFunctionFamily.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2009-2010 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.dataflow.data.nontagged.hash;
-
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFamily;
-
-/**
- * An implementation of the Murmur3 hash family. The code is implemented based
- * on the original <a
- * href=http://code.google.com/p/guava-libraries/source/browse
- * /guava/src/com/google/common/hash/Murmur3_32HashFunction.java>guava
- * implementation</a> from Google Guava library.
- */
-public class MurmurHash3BinaryHashFunctionFamily implements
-		IBinaryHashFunctionFamily {
-
-	public static final IBinaryHashFunctionFamily INSTANCE = new MurmurHash3BinaryHashFunctionFamily();
-
-	private static final long serialVersionUID = 1L;
-
-	private MurmurHash3BinaryHashFunctionFamily() {
-	}
-
-	private static final int C1 = 0xcc9e2d51;
-	private static final int C2 = 0x1b873593;
-	private static final int C3 = 5;
-	private static final int C4 = 0xe6546b64;
-	private static final int C5 = 0x85ebca6b;
-	private static final int C6 = 0xc2b2ae35;
-
-	@Override
-	public IBinaryHashFunction createBinaryHashFunction(final int seed) {
-		return new IBinaryHashFunction() {
-			@Override
-			public int hash(byte[] bytes, int offset, int length) {
-				int h = seed;
-				int p = offset;
-				int remain = length;
-				while (remain >= 4) {
-					int k = (bytes[p] & 0xff) | ((bytes[p + 1] & 0xff) << 8)
-							| ((bytes[p + 2] & 0xff) << 16)
-							| ((bytes[p + 3] & 0xff) << 24);
-					k *= C1;
-					k = Integer.rotateLeft(k, 15);
-					k *= C2;
-					h ^= k;
-					h = Integer.rotateLeft(h, 13);
-					h = h * C3 + C4;
-					p += 4;
-					remain -= 4;
-				}
-				if (remain > 0) {
-					int k = 0;
-					for (int i = 0; remain > 0; i += 8) {
-						k ^= (bytes[p++] & 0xff) << i;
-						remain--;
-					}
-					k *= C1;
-					k = Integer.rotateLeft(k, 15);
-					k *= C2;
-					h ^= k;
-				}
-				h ^= length;
-				h ^= (h >>> 16);
-				h *= C5;
-				h ^= (h >>> 13);
-				h *= C6;
-				h ^= (h >>> 16);
-				return h;
-			}
-		};
-	}
-}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RawBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RawBinaryHashFunctionFactory.java
deleted file mode 100644
index 4aeb00e..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RawBinaryHashFunctionFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.dataflow.data.nontagged.hash;
-
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
-
-public class RawBinaryHashFunctionFactory implements IBinaryHashFunctionFactory {
-    private static final long serialVersionUID = 1L;
-
-    public static IBinaryHashFunctionFactory INSTANCE = new RawBinaryHashFunctionFactory();
-
-    private RawBinaryHashFunctionFactory() {
-    }
-
-    @Override
-    public IBinaryHashFunction createBinaryHashFunction() {
-
-        return new IBinaryHashFunction() {
-            @Override
-            public int hash(byte[] bytes, int offset, int length) {
-                int value = 1;
-                int end = offset + length;
-                for (int i = offset; i < end; i++)
-                    value = value * 31 + (int) bytes[i];
-                return value;
-            }
-        };
-    }
-
-}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RectangleBinaryHashFunctionFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RectangleBinaryHashFunctionFactory.java
deleted file mode 100644
index 83bc50e..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/hash/RectangleBinaryHashFunctionFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package edu.uci.ics.asterix.dataflow.data.nontagged.hash;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
-import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
-
-public class RectangleBinaryHashFunctionFactory implements IBinaryHashFunctionFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public static final RectangleBinaryHashFunctionFactory INSTANCE = new RectangleBinaryHashFunctionFactory();
-
-    private RectangleBinaryHashFunctionFactory() {
-    }
-
-    @Override
-    public IBinaryHashFunction createBinaryHashFunction() {
-        return new IBinaryHashFunction() {
-            @Override
-            public int hash(byte[] bytes, int offset, int length) {
-                long xBits = ADoubleSerializerDeserializer.getLongBits(bytes, offset);
-                long yBits = ADoubleSerializerDeserializer.getLongBits(bytes, offset + 8);
-                return (int) ((xBits ^ (xBits >>> 32)) ^ (yBits ^ (yBits >>> 32)));
-            }
-        };
-    }
-
-}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
new file mode 100644
index 0000000..c596a8c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
@@ -0,0 +1,77 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.utils.WriteValueTools;
+
+public class ADayTimeDurationPrinter implements IPrinter {
+
+    public static final ADayTimeDurationPrinter INSTANCE = new ADayTimeDurationPrinter();
+    private static final GregorianCalendarSystem gCalInstance = GregorianCalendarSystem.getInstance();
+    
+    @Override
+    public void init() throws AlgebricksException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        boolean positive = true;
+        long milliseconds = AInt64SerializerDeserializer.getLong(b, s + 1);
+
+        // set the negative flag. "||" is necessary in case that months field is not there (so it is 0)
+        if (milliseconds < 0) {
+            milliseconds *= -1;
+            positive = false;
+        }
+
+        int millisecond = gCalInstance.getDurationMillisecond(milliseconds);
+        int second = gCalInstance.getDurationSecond(milliseconds);
+        int minute = gCalInstance.getDurationMinute(milliseconds);
+        int hour = gCalInstance.getDurationHour(milliseconds);
+        int day = gCalInstance.getDurationDay(milliseconds);
+
+        ps.print("day-time-duration(\"");
+        if (!positive) {
+            ps.print("-");
+        }
+        try {
+            ps.print("P");
+            if (day != 0) {
+                WriteValueTools.writeInt(day, ps);
+                ps.print("D");
+            }
+            if (hour != 0 || minute != 0 || second != 0 || millisecond != 0) {
+                ps.print("T");
+            }
+            if (hour != 0) {
+                WriteValueTools.writeInt(hour, ps);
+                ps.print("H");
+            }
+            if (minute != 0) {
+                WriteValueTools.writeInt(minute, ps);
+                ps.print("M");
+            }
+            if (second != 0 || millisecond != 0) {
+                WriteValueTools.writeInt(second, ps);
+            }
+            if (millisecond > 0) {
+                ps.print(".");
+                WriteValueTools.writeInt(millisecond, ps);
+            }
+            if (second != 0 || millisecond != 0) {
+                ps.print("S");
+            }
+            ps.print("\")");
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinterFactory.java
new file mode 100644
index 0000000..4817916
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.dataflow.data.nontagged.printers;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ADayTimeDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADayTimeDurationPrinterFactory INSTANCE = new ADayTimeDurationPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADayTimeDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
index 478ad2c..41fd904 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
@@ -73,6 +73,14 @@
                 ADurationPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case YEARMONTHDURATION: {
+                AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DAYTIMEDURATION: {
+                ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case INTERVAL: {
                 AIntervalPrinter.INSTANCE.print(b, s, l, ps);
                 break;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinter.java
new file mode 100644
index 0000000..29e2529
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinter.java
@@ -0,0 +1,75 @@
+/*
+ * 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.dataflow.data.nontagged.printers;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.utils.WriteValueTools;
+
+public class AYearMonthDurationPrinter implements IPrinter {
+
+    public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
+    private static final GregorianCalendarSystem gCalInstance = GregorianCalendarSystem.getInstance();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#init()
+     */
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+     */
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        boolean positive = true;
+        int months = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+        // set the negative flag. "||" is necessary in case that months field is not there (so it is 0)
+        if (months < 0) {
+            months *= -1;
+            positive = false;
+        }
+
+        int month = gCalInstance.getDurationMonth(months);
+        int year = gCalInstance.getDurationYear(months);
+
+        ps.print("year-month-duration(\"");
+        if (!positive) {
+            ps.print("-");
+        }
+        try {
+            ps.print("P");
+            if (year != 0) {
+                WriteValueTools.writeInt(year, ps);
+                ps.print("Y");
+            }
+            if (month != 0) {
+                WriteValueTools.writeInt(month, ps);
+                ps.print("M");
+            }
+            ps.print("\")");
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinterFactory.java
new file mode 100644
index 0000000..7e6111d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AYearMonthDurationPrinterFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.dataflow.data.nontagged.printers;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AYearMonthDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AYearMonthDurationPrinterFactory INSTANCE = new AYearMonthDurationPrinterFactory();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinterFactory#createPrinter()
+     */
+    @Override
+    public IPrinter createPrinter() {
+        return AYearMonthDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
new file mode 100644
index 0000000..552e8d7
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
@@ -0,0 +1,28 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADayTimeDurationPrinter implements IPrinter {
+
+    public static final ADayTimeDurationPrinter INSTANCE = new ADayTimeDurationPrinter();
+
+    @Override
+    public void init() throws AlgebricksException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long milliseconds = AInt64SerializerDeserializer.getLong(b, s + 1);
+
+        ps.print("{ day-time-duration: ");
+        ps.print(milliseconds);
+        ps.print("}");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinterFactory.java
new file mode 100644
index 0000000..bbf0a70
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ADayTimeDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADayTimeDurationPrinterFactory INSTANCE = new ADayTimeDurationPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADayTimeDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinter.java
new file mode 100644
index 0000000..c6afb74
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinter.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2009-2011 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.dataflow.data.nontagged.printers.json;
+
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AIntervalPrinter implements IPrinter {
+
+    public static final AIntervalPrinter INSTANCE = new AIntervalPrinter();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#init()
+     */
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+     */
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ interval: { start: ");
+
+        short typetag = AInt8SerializerDeserializer.getByte(b, s + 1 + 8 * 2);
+
+        IPrinter timeInstancePrinter;
+
+        if (typetag == ATypeTag.DATE.serialize()) {
+            timeInstancePrinter = ADatePrinter.INSTANCE;
+            ((ADatePrinter) timeInstancePrinter).print(b, s + 4, 4, ps);
+            ps.print(", end: ");
+            ((ADatePrinter) timeInstancePrinter).print(b, s + 12, 4, ps);
+        } else if (typetag == ATypeTag.TIME.serialize()) {
+            timeInstancePrinter = ATimePrinter.INSTANCE;
+            ((ATimePrinter) timeInstancePrinter).print(b, s + 4, 4, ps);
+            ps.print(", end: ");
+            ((ATimePrinter) timeInstancePrinter).print(b, s + 12, 4, ps);
+        } else if (typetag == ATypeTag.DATETIME.serialize()) {
+            timeInstancePrinter = ADateTimePrinter.INSTANCE;
+            ((ADateTimePrinter) timeInstancePrinter).print(b, s, 8, ps);
+            ps.print(", end: ");
+            ((ADateTimePrinter) timeInstancePrinter).print(b, s + 8, 8, ps);
+        } else {
+            throw new AlgebricksException("Unsupport internal time types in interval: " + typetag);
+        }
+
+        ps.print("}}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinterFactory.java
new file mode 100644
index 0000000..7b3c3fe
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AIntervalPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009-2011 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.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AIntervalPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AIntervalPrinterFactory INSTANCE = new AIntervalPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AIntervalPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
index 29c4ee1..3cf4ff2 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
@@ -73,6 +73,14 @@
                 ADurationPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case YEARMONTHDURATION: {
+                AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DAYTIMEDURATION: {
+                ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case POINT: {
                 APointPrinter.INSTANCE.print(b, s, l, ps);
                 break;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinter.java
new file mode 100644
index 0000000..163dc52
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinter.java
@@ -0,0 +1,47 @@
+/*
+ * 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.dataflow.data.nontagged.printers.json;
+
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AYearMonthDurationPrinter implements IPrinter {
+
+    public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#init()
+     */
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+     */
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+
+        int months = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+        ps.print("{ year-month-duration: ");
+        ps.print(months);
+        ps.print("}");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinterFactory.java
new file mode 100644
index 0000000..b32d010
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AYearMonthDurationPrinterFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AYearMonthDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AYearMonthDurationPrinterFactory INSTANCE = new AYearMonthDurationPrinterFactory();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinterFactory#createPrinter()
+     */
+    @Override
+    public IPrinter createPrinter() {
+        return AYearMonthDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
new file mode 100644
index 0000000..b016af0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADayTimeDurationSerializerDeserializer.java
@@ -0,0 +1,72 @@
+/*
+ * 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.dataflow.data.nontagged.serde;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ADayTimeDuration;
+import edu.uci.ics.asterix.om.base.AMutableDayTimeDuration;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class ADayTimeDurationSerializerDeserializer implements ISerializerDeserializer<ADayTimeDuration> {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final ADayTimeDurationSerializerDeserializer INSTNACE = new ADayTimeDurationSerializerDeserializer();
+
+    @SuppressWarnings("unchecked")
+    private static final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
+    private static final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+
+    @Override
+    public ADayTimeDuration deserialize(DataInput in) throws HyracksDataException {
+        try {
+            return new ADayTimeDuration(in.readLong());
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
+        }
+    }
+
+    @Override
+    public void serialize(ADayTimeDuration instance, DataOutput out) throws HyracksDataException {
+        try {
+            out.writeLong(instance.getMilliseconds());
+        } catch (IOException e) {
+            throw new HyracksDataException();
+        }
+    }
+
+    public static void parse(String durationString, DataOutput out) throws HyracksDataException {
+        try {
+            ADurationParserFactory.parseDuration(durationString, 0, durationString.length(), aDayTimeDuration,
+                    ADurationParseOption.All);
+            dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+        } catch (Exception e) {
+            throw new HyracksDataException(e);
+        }
+    }
+
+    public static long getDayTime(byte[] data, int offset) {
+        return AInt64SerializerDeserializer.getLong(data, offset);
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
index 6930f60..498a5b8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/ADurationSerializerDeserializer.java
@@ -8,6 +8,7 @@
 import edu.uci.ics.asterix.om.base.ADuration;
 import edu.uci.ics.asterix.om.base.AMutableDuration;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -46,7 +47,7 @@
 
     public static void parse(String duration, DataOutput out) throws HyracksDataException {
         try {
-            ADurationParserFactory.parseDuration(duration, 0, duration.length(), aDuration);
+            ADurationParserFactory.parseDuration(duration, 0, duration.length(), aDuration, ADurationParseOption.All);
             durationSerde.serialize(aDuration, out);
         } catch (Exception e) {
             throw new HyracksDataException(e);
@@ -61,7 +62,7 @@
      * @return
      */
     public static int getYearMonth(byte[] data, int offset) {
-        return AInt32SerializerDeserializer.getInt(data, offset);
+        return AInt32SerializerDeserializer.getInt(data, offset + getYearMonthOffset());
     }
 
     /**
@@ -72,6 +73,14 @@
      * @return
      */
     public static long getDayTime(byte[] data, int offset) {
-        return AInt64SerializerDeserializer.getLong(data, offset + 4);
+        return AInt64SerializerDeserializer.getLong(data, offset + getDayTimeOffset());
+    }
+
+    public static int getYearMonthOffset() {
+        return 0;
+    }
+
+    public static int getDayTimeOffset() {
+        return 4;
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
index 8c4def0..318d10e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
@@ -66,11 +66,19 @@
     }
 
     public static long getIntervalStart(byte[] data, int offset) {
-        return AInt64SerializerDeserializer.getLong(data, offset);
+        return AInt64SerializerDeserializer.getLong(data, offset + getIntervalStartOffset());
     }
 
     public static long getIntervalEnd(byte[] data, int offset) {
-        return AInt64SerializerDeserializer.getLong(data, offset + 8);
+        return AInt64SerializerDeserializer.getLong(data, offset + getIntervalEndOffset());
+    }
+
+    public static int getIntervalStartOffset() {
+        return 0;
+    }
+
+    public static int getIntervalEndOffset() {
+        return 8;
     }
 
     public static byte getIntervalTimeType(byte[] data, int offset) {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
index 2e4f72c..88aa7f4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
@@ -86,6 +86,12 @@
             case DURATION: {
                 return ADurationSerializerDeserializer.INSTANCE.deserialize(in);
             }
+            case YEARMONTHDURATION: {
+                return AYearMonthDurationerializerDeserializer.INSTANCE.deserialize(in);
+            }
+            case DAYTIMEDURATION: {
+                return ADayTimeDurationSerializerDeserializer.INSTNACE.deserialize(in);
+            }
             case INTERVAL: {
                 return AIntervalSerializerDeserializer.INSTANCE.deserialize(in);
             }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AYearMonthDurationerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AYearMonthDurationerializerDeserializer.java
new file mode 100644
index 0000000..79bf3c0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AYearMonthDurationerializerDeserializer.java
@@ -0,0 +1,73 @@
+/*
+ * 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.dataflow.data.nontagged.serde;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.AMutableYearMonthDuration;
+import edu.uci.ics.asterix.om.base.AYearMonthDuration;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class AYearMonthDurationerializerDeserializer implements ISerializerDeserializer<AYearMonthDuration> {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AYearMonthDurationerializerDeserializer INSTANCE = new AYearMonthDurationerializerDeserializer();
+
+    @SuppressWarnings("unchecked")
+    private static final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
+    private static final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
+
+    @Override
+    public AYearMonthDuration deserialize(DataInput in) throws HyracksDataException {
+        try {
+            return new AYearMonthDuration(in.readInt());
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
+        }
+    }
+
+    @Override
+    public void serialize(AYearMonthDuration instance, DataOutput out) throws HyracksDataException {
+        try {
+            out.writeInt(instance.getMonths());
+        } catch (IOException e) {
+            throw new HyracksDataException();
+        }
+    }
+
+    public static void parse(String durationString, DataOutput out) throws HyracksDataException {
+        try {
+            ADurationParserFactory.parseDuration(durationString, 0, durationString.length(), aYearMonthDuration,
+                    ADurationParseOption.All);
+            yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+        } catch (Exception e) {
+            throw new HyracksDataException(e);
+        }
+    }
+
+    public static int getYearMonth(byte[] data, int offset) {
+        return AInt32SerializerDeserializer.getInt(data, offset);
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
index 38fddb7..fb9d195 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
@@ -2,13 +2,18 @@
 
 import java.io.Serializable;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADateOrTimeAscBinaryComparatorFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADateTimeAscBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ACirclePartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADurationPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AIntervalPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ALinePartialBinaryComparatorFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AObjectAscBinaryComparatorFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AObjectDescBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APolygonPartialBinaryComparatorFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.BooleanBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ARectanglePartialBinaryComparatorFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.RawBinaryComparatorFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.RectangleBinaryComparatorFactory;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
@@ -102,9 +107,14 @@
             case INT16: {
                 return addOffset(SHORT_POINTABLE_INSTANCE, ascending);
             }
+            case DATE:
+            case TIME:
+            case YEARMONTHDURATION:
             case INT32: {
                 return addOffset(INTEGER_POINTABLE_INSTANCE, ascending);
             }
+            case DATETIME:
+            case DAYTIMEDURATION:
             case INT64: {
                 return addOffset(LONG_POINTABLE_INSTANCE, ascending);
             }
@@ -118,14 +128,28 @@
                 return addOffset(UTF8STRING_POINTABLE_INSTANCE, ascending);
             }
             case RECTANGLE: {
-                return addOffset(RectangleBinaryComparatorFactory.INSTANCE, ascending);
+                return addOffset(ARectanglePartialBinaryComparatorFactory.INSTANCE, ascending);
             }
-            case DATE:
-            case TIME: {
-                return addOffset(ADateOrTimeAscBinaryComparatorFactory.INSTANCE, ascending);
+            case CIRCLE: {
+                return addOffset(ACirclePartialBinaryComparatorFactory.INSTANCE, ascending);
             }
-            case DATETIME: {
-                return addOffset(ADateTimeAscBinaryComparatorFactory.INSTANCE, ascending);
+            case POINT: {
+                return addOffset(APointPartialBinaryComparatorFactory.INSTANCE, ascending);
+            }
+            case POINT3D: {
+                return addOffset(APoint3DPartialBinaryComparatorFactory.INSTANCE, ascending);
+            }
+            case LINE: {
+                return addOffset(ALinePartialBinaryComparatorFactory.INSTANCE, ascending);
+            }
+            case POLYGON: {
+                return addOffset(APolygonPartialBinaryComparatorFactory.INSTANCE, ascending);
+            }
+            case DURATION: {
+                return addOffset(ADurationPartialBinaryComparatorFactory.INSTANCE, ascending);
+            }
+            case INTERVAL: {
+                return addOffset(AIntervalPartialBinaryComparatorFactory.INSTANCE, ascending);
             }
             default: {
                 return addOffset(RawBinaryComparatorFactory.INSTANCE, ascending);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
index 5498374..33698bd 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
@@ -6,12 +6,11 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.hash.BooleanBinaryHashFunctionFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.hash.DoubleBinaryHashFunctionFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.hash.LongBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.RawBinaryHashFunctionFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.RectangleBinaryHashFunctionFactory;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
 import edu.uci.ics.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.data.std.primitive.DoublePointable;
 import edu.uci.ics.hyracks.data.std.primitive.FloatPointable;
@@ -69,9 +68,14 @@
             case BOOLEAN: {
                 return addOffset(BooleanBinaryHashFunctionFactory.INSTANCE);
             }
+            case DATE:
+            case TIME:
+            case YEARMONTHDURATION:
             case INT32: {
                 return addOffset(new PointableBinaryHashFunctionFactory(IntegerPointable.FACTORY));
             }
+            case DAYTIMEDURATION:
+            case DATETIME:
             case INT64: {
                 return addOffset(LongBinaryHashFunctionFactory.INSTANCE);
             }
@@ -84,11 +88,8 @@
             case STRING: {
                 return addOffset(new PointableBinaryHashFunctionFactory(UTF8StringPointable.FACTORY));
             }
-            case RECTANGLE: {
-                return addOffset(RectangleBinaryHashFunctionFactory.INSTANCE);
-            }
             default: {
-                return addOffset(RawBinaryHashFunctionFactory.INSTANCE);
+                return addOffsetForGenericBinaryHash();
             }
         }
     }
@@ -112,4 +113,16 @@
         };
     }
 
+    private IBinaryHashFunctionFactory addOffsetForGenericBinaryHash() {
+        return new IBinaryHashFunctionFactory() {
+
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IBinaryHashFunction createBinaryHashFunction() {
+                return MurmurHash3BinaryHashFunctionFamily.INSTANCE.createBinaryHashFunction(0);
+            }
+        };
+    }
+
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java
index bc7ba26..61ac6fa 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlBinaryHashFunctionFamilyProvider.java
@@ -17,8 +17,8 @@
 
 import java.io.Serializable;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.hash.MurmurHash3BinaryHashFunctionFamily;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
 import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFamilyProvider;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFamily;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
index b8c6ab0..842a6e8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
@@ -14,11 +14,11 @@
  */
 package edu.uci.ics.asterix.formats.nontagged;
 
-
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABooleanPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ACirclePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADatePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADateTimePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADayTimeDurationPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADoublePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADurationPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AFloatPrinterFactory;
@@ -40,6 +40,8 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ATimePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AUnionPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AUnorderedlistPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AYearMonthDurationPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AYearMonthDurationPrinterFactory;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
 import edu.uci.ics.asterix.om.types.ARecordType;
 import edu.uci.ics.asterix.om.types.AUnionType;
@@ -63,8 +65,8 @@
 
         if (aqlType != null) {
             switch (aqlType.getTypeTag()) {
-                // case ANYTYPE:
-                // return AAnyTypePrinterFactory.INSTANCE;
+            // case ANYTYPE:
+            // return AAnyTypePrinterFactory.INSTANCE;
                 case INT8:
                     return AInt8PrinterFactory.INSTANCE;
                 case INT16:
@@ -89,6 +91,10 @@
                     return ADateTimePrinterFactory.INSTANCE;
                 case DURATION:
                     return ADurationPrinterFactory.INSTANCE;
+                case YEARMONTHDURATION:
+                    return AYearMonthDurationPrinterFactory.INSTANCE;
+                case DAYTIMEDURATION:
+                    return ADayTimeDurationPrinterFactory.INSTANCE;
                 case POINT:
                     return APointPrinterFactory.INSTANCE;
                 case POINT3D:
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java
index 23306ed..b4a1fd8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlNormalizedKeyComputerFactoryProvider.java
@@ -23,9 +23,14 @@
         IAType aqlType = (IAType) type;
         if (ascending) {
             switch (aqlType.getTypeTag()) {
+                case DATE:
+                case TIME:
+                case YEARMONTHDURATION:
                 case INT32: {
                     return new AWrappedAscNormalizedKeyComputerFactory(new IntegerNormalizedKeyComputerFactory());
                 }
+                case DATETIME:
+                case DAYTIMEDURATION:
                 case INT64: {
                     return new AWrappedAscNormalizedKeyComputerFactory(new Integer64NormalizedKeyComputerFactory());
                 }
@@ -44,9 +49,14 @@
             }
         } else {
             switch (aqlType.getTypeTag()) {
+                case DATE:
+                case TIME:
+                case YEARMONTHDURATION:
                 case INT32: {
                     return new AWrappedDescNormalizedKeyComputerFactory(new IntegerNormalizedKeyComputerFactory());
                 }
+                case DATETIME:
+                case DAYTIMEDURATION:
                 case INT64: {
                     return new AWrappedDescNormalizedKeyComputerFactory(new Integer64NormalizedKeyComputerFactory());
                 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
index 29e33fd..92cfc5b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
@@ -9,6 +9,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ACircleSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
@@ -29,6 +30,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.SerializerDeserializerUtil;
 import edu.uci.ics.asterix.om.base.IAObject;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
@@ -112,6 +114,12 @@
             case DURATION: {
                 return ADurationSerializerDeserializer.INSTANCE;
             }
+            case YEARMONTHDURATION: {
+                return AYearMonthDurationerializerDeserializer.INSTANCE;
+            }
+            case DAYTIMEDURATION: {
+                return ADayTimeDurationSerializerDeserializer.INSTNACE;
+            }
             case INTERVAL: {
                 return AIntervalSerializerDeserializer.INSTANCE;
             }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/ADayTimeDuration.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/ADayTimeDuration.java
new file mode 100644
index 0000000..03a9627
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/ADayTimeDuration.java
@@ -0,0 +1,94 @@
+/*
+ * 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.om.base;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.visitors.IOMVisitor;
+
+public class ADayTimeDuration implements IAObject {
+
+    protected long chrononInMillisecond;
+
+    public ADayTimeDuration(long millisecond) {
+        this.chrononInMillisecond = millisecond;
+    }
+
+    public long getMilliseconds() {
+        return chrononInMillisecond;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.JSONSerializable#toJSON()
+     */
+    @Override
+    public JSONObject toJSON() throws JSONException {
+        JSONObject json = new JSONObject();
+
+        JSONObject duration = new JSONObject();
+        duration.put("milliseconds", chrononInMillisecond);
+        json.put("ADuration", duration);
+
+        return json;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#getType()
+     */
+    @Override
+    public IAType getType() {
+        return BuiltinType.ADAYTIMEDURATION;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#accept(edu.uci.ics.asterix.om.visitors.IOMVisitor)
+     */
+    @Override
+    public void accept(IOMVisitor visitor) throws AsterixException {
+        visitor.visitADayTimeDuration(this);
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#deepEqual(edu.uci.ics.asterix.om.base.IAObject)
+     */
+    @Override
+    public boolean deepEqual(IAObject obj) {
+        return equals(obj);
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#hash()
+     */
+    @Override
+    public int hash() {
+        return hashCode();
+    }
+
+    public boolean equals(Object o) {
+        if (o instanceof ADayTimeDuration) {
+            return ((ADayTimeDuration) o).chrononInMillisecond == chrononInMillisecond;
+        }
+        return false;
+    }
+
+    public int hashCode() {
+        return (int) (chrononInMillisecond ^ (chrononInMillisecond >>> 32));
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableDayTimeDuration.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableDayTimeDuration.java
new file mode 100644
index 0000000..ebd0a18
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableDayTimeDuration.java
@@ -0,0 +1,27 @@
+/*
+ * 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.om.base;
+
+public class AMutableDayTimeDuration extends ADayTimeDuration {
+
+    public AMutableDayTimeDuration(long milliseconds) {
+        super(milliseconds);
+    }
+
+    public void setMilliseconds(long milliseconds) {
+        this.chrononInMillisecond = milliseconds;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableYearMonthDuration.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableYearMonthDuration.java
new file mode 100644
index 0000000..3a21144
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableYearMonthDuration.java
@@ -0,0 +1,27 @@
+/*
+ * 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.om.base;
+
+public class AMutableYearMonthDuration extends AYearMonthDuration {
+
+    public AMutableYearMonthDuration(int months) {
+        super(months);
+    }
+
+    public void setMonths(int months) {
+        this.chrononInMonth = months;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AYearMonthDuration.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AYearMonthDuration.java
new file mode 100644
index 0000000..1714bb0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AYearMonthDuration.java
@@ -0,0 +1,102 @@
+/*
+ * 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.om.base;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.visitors.IOMVisitor;
+
+/**
+ * AYearMonthDuration represents the duration in the unit of months.
+ * <p/>
+ * An AYearMonthDuration may contain the following two fields:<br/>
+ * - year;<br/>
+ * - month.
+ * <p/>
+ */
+public class AYearMonthDuration implements IAObject {
+
+    protected int chrononInMonth;
+
+    public AYearMonthDuration(int months) {
+        this.chrononInMonth = months;
+    }
+
+    public int getMonths() {
+        return chrononInMonth;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.api.dataflow.value.JSONSerializable#toJSON()
+     */
+    @Override
+    public JSONObject toJSON() throws JSONException {
+        JSONObject json = new JSONObject();
+
+        JSONObject duration = new JSONObject();
+        duration.put("months", chrononInMonth);
+        json.put("ADuration", duration);
+
+        return json;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#getType()
+     */
+    @Override
+    public IAType getType() {
+        return BuiltinType.AYEARMONTHDURATION;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#accept(edu.uci.ics.asterix.om.visitors.IOMVisitor)
+     */
+    @Override
+    public void accept(IOMVisitor visitor) throws AsterixException {
+        visitor.visitAYearMonthDuration(this);
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#deepEqual(edu.uci.ics.asterix.om.base.IAObject)
+     */
+    @Override
+    public boolean deepEqual(IAObject obj) {
+        return equals(obj);
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.base.IAObject#hash()
+     */
+    @Override
+    public int hash() {
+        return hashCode();
+    }
+
+    public boolean equals(Object o) {
+        if (o instanceof AYearMonthDuration) {
+            return ((AYearMonthDuration) o).chrononInMonth == chrononInMonth;
+        }
+        return false;
+    }
+
+    public int hashCode() {
+        return chrononInMonth;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
index de5a6a1..84e2386 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/ADurationParserFactory.java
@@ -17,7 +17,10 @@
 import java.io.DataOutput;
 import java.io.IOException;
 
+import edu.uci.ics.asterix.om.base.AMutableDayTimeDuration;
 import edu.uci.ics.asterix.om.base.AMutableDuration;
+import edu.uci.ics.asterix.om.base.AMutableYearMonthDuration;
+import edu.uci.ics.asterix.om.base.IAObject;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.dataflow.common.data.parsers.IValueParser;
 import edu.uci.ics.hyracks.dataflow.common.data.parsers.IValueParserFactory;
@@ -28,7 +31,11 @@
 
     private static final long serialVersionUID = 1L;
 
-    private static final String durationErrorMessage = "Wrong Input Format for a Duration Value";
+    private static final String durationErrorMessage = "Wrong Input Format for a duration/year-month-duration/day-time-duration Value";
+    private static final String onlyYearMonthErrorMessage = "Only year-month fields are allowed";
+    private static final String onlyDayTimeErrorMessage = "Only day-time fields are allowed";
+
+    private static final int DECIMAL_UNIT = 10;
 
     private ADurationParserFactory() {
 
@@ -41,7 +48,7 @@
 
             @Override
             public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException {
-                parseDuration(buffer, start, length, aMutableDuration);
+                parseDuration(buffer, start, length, aMutableDuration, ADurationParseOption.All);
                 try {
                     out.writeInt(aMutableDuration.getMonths());
                     out.writeLong(aMutableDuration.getMilliseconds());
@@ -64,299 +71,75 @@
         SEC;
     };
 
-    public static void parseDuration(String durationString, int start, int length, AMutableDuration aDuration)
-            throws HyracksDataException {
-
-        boolean positive = true;
-        int offset = 0;
-        int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
-        State state = State.NOTHING_READ;
-
-        if (durationString.charAt(start + offset) == '-') {
-            offset++;
-            positive = false;
-        }
-
-        if (durationString.charAt(start + offset) != 'P') {
-            throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
-        }
-
-        offset++;
-
-        for (; offset < length; offset++) {
-            if (durationString.charAt(start + offset) >= '0' && durationString.charAt(start + offset) <= '9') {
-                // accumulate the digit fields
-                value = value * 10 + durationString.charAt(start + offset) - '0';
-            } else {
-                switch (durationString.charAt(start + offset)) {
-                    case 'Y':
-                        if (state.compareTo(State.YEAR) < 0) {
-                            year = value;
-                            state = State.YEAR;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong YEAR feild.");
-                        }
-                        break;
-                    case 'M':
-                        if (state.compareTo(State.TIME) < 0) {
-                            if (state.compareTo(State.MONTH) < 0) {
-                                month = value;
-                                state = State.MONTH;
-                            } else {
-                                throw new HyracksDataException(durationErrorMessage + ": wrong MONTH field.");
-                            }
-                        } else if (state.compareTo(State.MIN) < 0) {
-                            minute = value;
-                            state = State.MIN;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong MIN field.");
-                        }
-                        break;
-                    case 'D':
-                        if (state.compareTo(State.DAY) < 0) {
-                            day = value;
-                            state = State.DAY;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong DAY field");
-                        }
-                        break;
-                    case 'T':
-                        if (state.compareTo(State.TIME) < 0) {
-                            state = State.TIME;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong TIME field.");
-                        }
-                        break;
-
-                    case 'H':
-                        if (state.compareTo(State.HOUR) < 0) {
-                            hour = value;
-                            state = State.HOUR;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong HOUR field.");
-                        }
-                        break;
-                    case '.':
-                        if (state.compareTo(State.MILLISEC) < 0) {
-                            int i = 1;
-                            for (; offset + i < length; i++) {
-                                if (durationString.charAt(start + offset + i) >= '0'
-                                        && durationString.charAt(start + offset + i) <= '9') {
-                                    if (i < 4) {
-                                        millisecond = millisecond * 10
-                                                + (durationString.charAt(start + offset + i) - '0');
-                                    } else {
-                                        throw new HyracksDataException(durationErrorMessage
-                                                + ": wrong MILLISECOND field.");
-                                    }
-                                } else {
-                                    break;
-                                }
-                            }
-                            offset += i;
-                            state = State.MILLISEC;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong MILLISECOND field.");
-                        }
-                    case 'S':
-                        if (state.compareTo(State.SEC) < 0) {
-                            second = value;
-                            state = State.SEC;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong SECOND field.");
-                        }
-                        break;
-                    default:
-                        throw new HyracksDataException(durationErrorMessage + ": wrong format for duration.");
-
-                }
-                value = 0;
-            }
-        }
-
-        if (state.compareTo(State.TIME) == 0) {
-            throw new HyracksDataException(durationErrorMessage + ": no time fields after time separator.");
-        }
-
-        short temp = 1;
-        if (!positive) {
-            temp = -1;
-        }
-
-        aDuration.setValue(temp * (year * 12 + month), temp
-                * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
-
+    public enum ADurationParseOption {
+        YEAR_MONTH,
+        DAY_TIME,
+        All
     }
 
-    /**
-     * Copy-and-paste the code in {@link #parseDuration(String, int, int, AMutableDuration)} in order to eliminate
-     * object creation.
-     * 
-     * @param charAccessor
-     * @param start
-     * @param length
-     * @param aDuration
-     * @throws HyracksDataException
-     */
-    public static void parseDuration(char[] charAccessor, int start, int length, AMutableDuration aDuration)
-            throws HyracksDataException {
-
-        boolean positive = true;
-        int offset = 0;
-        int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
-        State state = State.NOTHING_READ;
-
-        if (charAccessor[start + offset] == '-') {
-            offset++;
-            positive = false;
-        }
-
-        if (charAccessor[start + offset] != 'P') {
-            throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
-        }
-
-        offset++;
-
-        for (; offset < length; offset++) {
-            if (charAccessor[start + offset] >= '0' && charAccessor[start + offset] <= '9') {
-                // accumulate the digit fields
-                value = value * 10 + charAccessor[start + offset] - '0';
-            } else {
-                switch (charAccessor[start + offset]) {
-                    case 'Y':
-                        if (state.compareTo(State.YEAR) < 0) {
-                            year = value;
-                            state = State.YEAR;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong YEAR feild.");
-                        }
-                        break;
-                    case 'M':
-                        if (state.compareTo(State.TIME) < 0) {
-                            if (state.compareTo(State.MONTH) < 0) {
-                                month = value;
-                                state = State.MONTH;
-                            } else {
-                                throw new HyracksDataException(durationErrorMessage + ": wrong MONTH field.");
-                            }
-                        } else if (state.compareTo(State.MIN) < 0) {
-                            minute = value;
-                            state = State.MIN;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong MIN field.");
-                        }
-                        break;
-                    case 'D':
-                        if (state.compareTo(State.DAY) < 0) {
-                            day = value;
-                            state = State.DAY;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong DAY field");
-                        }
-                        break;
-                    case 'T':
-                        if (state.compareTo(State.TIME) < 0) {
-                            state = State.TIME;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong TIME field.");
-                        }
-                        break;
-
-                    case 'H':
-                        if (state.compareTo(State.HOUR) < 0) {
-                            hour = value;
-                            state = State.HOUR;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong HOUR field.");
-                        }
-                        break;
-                    case '.':
-                        if (state.compareTo(State.MILLISEC) < 0) {
-                            int i = 1;
-                            for (; offset + i < length; i++) {
-                                if (charAccessor[start + offset + i] >= '0' && charAccessor[start + offset + i] <= '9') {
-                                    if (i < 4) {
-                                        millisecond = millisecond * 10 + (charAccessor[start + offset + i] - '0');
-                                    } else {
-                                        throw new HyracksDataException(durationErrorMessage
-                                                + ": wrong MILLISECOND field.");
-                                    }
-                                } else {
-                                    break;
-                                }
-                            }
-                            offset += i;
-                            state = State.MILLISEC;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong MILLISECOND field.");
-                        }
-                    case 'S':
-                        if (state.compareTo(State.SEC) < 0) {
-                            second = value;
-                            state = State.SEC;
-                        } else {
-                            throw new HyracksDataException(durationErrorMessage + ": wrong SECOND field.");
-                        }
-                        break;
-                    default:
-                        throw new HyracksDataException(durationErrorMessage + ": wrong format for duration.");
-
-                }
-                value = 0;
-            }
-        }
-
-        if (state.compareTo(State.TIME) == 0) {
-            throw new HyracksDataException(durationErrorMessage + ": no time fields after time separator.");
-        }
-
-        short temp = 1;
-        if (!positive) {
-            temp = -1;
-        }
-
-        aDuration.setValue(temp * (year * 12 + month), temp
-                * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
-
+    interface IStringAccessor {
+        char getCharAt(int index);
     }
 
-    /**
-     * Copy-and-paste the code in {@link #parseDuration(String, int, int, AMutableDuration)} in order to eliminate
-     * object creation.
-     * 
-     * @param charAccessor
-     * @param start
-     * @param length
-     * @param aDuration
-     * @throws HyracksDataException
-     */
-    public static void parseDuration(byte[] charAccessor, int start, int length, AMutableDuration aDuration)
-            throws HyracksDataException {
+    public static void parseDuration(final Object durationString, final int start, int length, IAObject mutableObject,
+            ADurationParseOption parseOption) throws HyracksDataException {
 
-        boolean positive = true;
         int offset = 0;
         int value = 0, hour = 0, minute = 0, second = 0, millisecond = 0, year = 0, month = 0, day = 0;
         State state = State.NOTHING_READ;
 
-        if (charAccessor[start + offset] == '-') {
-            offset++;
-            positive = false;
+        IStringAccessor charAccessor;
+
+        if (durationString instanceof char[]) {
+            charAccessor = new IStringAccessor() {
+                @Override
+                public char getCharAt(int index) {
+                    return ((char[]) durationString)[start + index];
+                }
+            };
+        } else if (durationString instanceof byte[]) {
+            charAccessor = new IStringAccessor() {
+
+                @Override
+                public char getCharAt(int index) {
+                    return (char) (((byte[]) durationString)[start + index]);
+                }
+            };
+        } else if (durationString instanceof String) {
+            charAccessor = new IStringAccessor() {
+
+                @Override
+                public char getCharAt(int index) {
+                    return ((String) durationString).charAt(start + index);
+                }
+            };
+        } else {
+            throw new HyracksDataException(durationErrorMessage);
         }
 
-        if (charAccessor[start + offset] != 'P') {
+        short sign = 1;
+        if (charAccessor.getCharAt(offset) == '-') {
+            offset++;
+            sign = -1;
+        }
+
+        if (charAccessor.getCharAt(offset) != 'P') {
             throw new HyracksDataException(durationErrorMessage + ": Missing leading 'P'.");
         }
 
         offset++;
 
         for (; offset < length; offset++) {
-            if (charAccessor[start + offset] >= '0' && charAccessor[start + offset] <= '9') {
+            if (charAccessor.getCharAt(offset) >= '0' && charAccessor.getCharAt(offset) <= '9') {
                 // accumulate the digit fields
-                value = value * 10 + charAccessor[start + offset] - '0';
+                value = value * DECIMAL_UNIT + charAccessor.getCharAt(offset) - '0';
             } else {
-                switch (charAccessor[start + offset]) {
+                switch (charAccessor.getCharAt(offset)) {
                     case 'Y':
                         if (state.compareTo(State.YEAR) < 0) {
+                            if (parseOption == ADurationParseOption.DAY_TIME) {
+                                throw new HyracksDataException(onlyDayTimeErrorMessage);
+                            }
                             year = value;
                             state = State.YEAR;
                         } else {
@@ -366,12 +149,18 @@
                     case 'M':
                         if (state.compareTo(State.TIME) < 0) {
                             if (state.compareTo(State.MONTH) < 0) {
+                                if (parseOption == ADurationParseOption.DAY_TIME) {
+                                    throw new HyracksDataException(onlyDayTimeErrorMessage);
+                                }
                                 month = value;
                                 state = State.MONTH;
                             } else {
                                 throw new HyracksDataException(durationErrorMessage + ": wrong MONTH field.");
                             }
                         } else if (state.compareTo(State.MIN) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             minute = value;
                             state = State.MIN;
                         } else {
@@ -380,6 +169,9 @@
                         break;
                     case 'D':
                         if (state.compareTo(State.DAY) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             day = value;
                             state = State.DAY;
                         } else {
@@ -388,6 +180,9 @@
                         break;
                     case 'T':
                         if (state.compareTo(State.TIME) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             state = State.TIME;
                         } else {
                             throw new HyracksDataException(durationErrorMessage + ": wrong TIME field.");
@@ -396,6 +191,9 @@
 
                     case 'H':
                         if (state.compareTo(State.HOUR) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             hour = value;
                             state = State.HOUR;
                         } else {
@@ -404,11 +202,16 @@
                         break;
                     case '.':
                         if (state.compareTo(State.MILLISEC) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             int i = 1;
                             for (; offset + i < length; i++) {
-                                if (charAccessor[start + offset + i] >= '0' && charAccessor[start + offset + i] <= '9') {
+                                if (charAccessor.getCharAt(offset + i) >= '0'
+                                        && charAccessor.getCharAt(offset + i) <= '9') {
                                     if (i < 4) {
-                                        millisecond = millisecond * 10 + (charAccessor[start + offset + i] - '0');
+                                        millisecond = millisecond * DECIMAL_UNIT
+                                                + (charAccessor.getCharAt(offset + i) - '0');
                                     } else {
                                         throw new HyracksDataException(durationErrorMessage
                                                 + ": wrong MILLISECOND field.");
@@ -424,6 +227,9 @@
                         }
                     case 'S':
                         if (state.compareTo(State.SEC) < 0) {
+                            if (parseOption == ADurationParseOption.YEAR_MONTH) {
+                                throw new HyracksDataException(onlyYearMonthErrorMessage);
+                            }
                             second = value;
                             state = State.SEC;
                         } else {
@@ -442,13 +248,18 @@
             throw new HyracksDataException(durationErrorMessage + ": no time fields after time separator.");
         }
 
-        short temp = 1;
-        if (!positive) {
-            temp = -1;
+        if (mutableObject instanceof AMutableDuration) {
+            ((AMutableDuration) mutableObject)
+                    .setValue(sign * (year * 12 + month),
+                            sign
+                                    * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second
+                                            * 1000L + millisecond));
+        } else if (mutableObject instanceof AMutableYearMonthDuration) {
+            ((AMutableYearMonthDuration) mutableObject).setMonths(sign * (year * 12 + month));
+        } else if (mutableObject instanceof AMutableDayTimeDuration) {
+            ((AMutableDayTimeDuration) mutableObject)
+                    .setMilliseconds(sign
+                            * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
         }
-
-        aDuration.setValue(temp * (year * 12 + month), temp
-                * (day * 24 * 3600 * 1000L + 3600 * 1000L * hour + 60 * minute * 1000L + second * 1000L + millisecond));
-
     }
 }
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 bea62dc..d0bdd16 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
@@ -48,6 +48,7 @@
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalACircleTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalADateTimeTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalADateTypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.OptionalADayTimeDurationTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalADoubleTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalADurationTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalAFloatTypeComputer;
@@ -64,6 +65,7 @@
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalAStringTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalATemporalInstanceTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OptionalATimeTypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.OptionalAYearMonthDurationTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListConstructorResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAInt32TypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAPointTypeComputer;
@@ -372,6 +374,10 @@
             "datetime", 1);
     public final static FunctionIdentifier DURATION_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "duration", 1);
+    public final static FunctionIdentifier YEAR_MONTH_DURATION_CONSTRUCTOR = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "year-month-duration", 1);
+    public final static FunctionIdentifier DAY_TIME_DURATION_CONSTRUCTOR = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "day-time-duration", 1);
     public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_DATE = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "interval-from-date", 2);
     public final static FunctionIdentifier INTERVAL_CONSTRUCTOR_TIME = new FunctionIdentifier(
@@ -427,12 +433,16 @@
             FunctionConstants.ASTERIX_NS, "day-time-duration-less-than", 2);
     public final static FunctionIdentifier DURATION_FROM_MONTHS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "duration-from-months", 1);
-    public final static FunctionIdentifier MONTHS_OF_YEAR_MONTH_DURATION = new FunctionIdentifier(
-            FunctionConstants.ASTERIX_NS, "months-of-year-month-duration", 1);
+    public final static FunctionIdentifier MONTHS_FROM_YEAR_MONTH_DURATION = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "months-from-year-month-duration", 1);
     public final static FunctionIdentifier DURATION_FROM_MILLISECONDS = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "duration-from-ms", 1);
-    public final static FunctionIdentifier MILLISECONDS_OF_DAY_TIME_DURATION = new FunctionIdentifier(
-            FunctionConstants.ASTERIX_NS, "ms-of-day-time-duration", 1);
+    public final static FunctionIdentifier MILLISECONDS_FROM_DAY_TIME_DURATION = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "ms-from-day-time-duration", 1);
+    public final static FunctionIdentifier GET_YEAR_MONTH_DURATION = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-year-month-duration", 1);
+    public final static FunctionIdentifier GET_DAY_TIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "get-day-time-duration", 1);
 
     // spatial
     public final static FunctionIdentifier CREATE_POINT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -612,6 +622,8 @@
         add(DATETIME_CONSTRUCTOR, OptionalADateTimeTypeComputer.INSTANCE);
         add(DOUBLE_CONSTRUCTOR, OptionalADoubleTypeComputer.INSTANCE);
         add(DURATION_CONSTRUCTOR, OptionalADurationTypeComputer.INSTANCE);
+        add(YEAR_MONTH_DURATION_CONSTRUCTOR, OptionalAYearMonthDurationTypeComputer.INSTANCE);
+        add(DAY_TIME_DURATION_CONSTRUCTOR, OptionalADayTimeDurationTypeComputer.INSTANCE);
         add(EDIT_DISTANCE, AInt32TypeComputer.INSTANCE);
         add(EDIT_DISTANCE_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
         add(EDIT_DISTANCE_STRING_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE);
@@ -844,8 +856,10 @@
         add(DURATION_EQUAL, OptionalABooleanTypeComputer.INSTANCE);
         add(DURATION_FROM_MONTHS, OptionalADurationTypeComputer.INSTANCE);
         add(DURATION_FROM_MILLISECONDS, OptionalADurationTypeComputer.INSTANCE);
-        add(MONTHS_OF_YEAR_MONTH_DURATION, OptionalAInt32TypeComputer.INSTANCE);
-        add(MILLISECONDS_OF_DAY_TIME_DURATION, OptionalAInt64TypeComputer.INSTANCE);
+        add(MONTHS_FROM_YEAR_MONTH_DURATION, OptionalAInt32TypeComputer.INSTANCE);
+        add(MILLISECONDS_FROM_DAY_TIME_DURATION, OptionalAInt64TypeComputer.INSTANCE);
+        add(GET_DAY_TIME_DURATION, OptionalADayTimeDurationTypeComputer.INSTANCE);
+        add(GET_YEAR_MONTH_DURATION, OptionalAYearMonthDurationTypeComputer.INSTANCE);
 
         // interval constructors
         add(INTERVAL_CONSTRUCTOR_DATE, OptionalAIntervalTypeComputer.INSTANCE);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
index b78308d..cdbf5ca 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
@@ -24,6 +24,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ACirclePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADatePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADateTimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADayTimeDurationPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADoublePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADurationPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AFloatPrinter;
@@ -40,6 +41,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ARectanglePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ATimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
 import edu.uci.ics.asterix.om.pointables.AListPointable;
 import edu.uci.ics.asterix.om.pointables.ARecordPointable;
@@ -146,6 +148,14 @@
                     ADurationPrinter.INSTANCE.print(b, s, l, ps);
                     break;
                 }
+                case YEARMONTHDURATION: {
+                    AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DAYTIMEDURATION: {
+                    ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
                 case POINT: {
                     APointPrinter.INSTANCE.print(b, s, l, ps);
                     break;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
index b2d5339..e88ed7e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
@@ -24,6 +24,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ACirclePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADatePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADateTimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADayTimeDurationPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADoublePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADurationPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AFloatPrinter;
@@ -39,6 +40,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ARectanglePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ATimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
 import edu.uci.ics.asterix.om.pointables.AListPointable;
 import edu.uci.ics.asterix.om.pointables.ARecordPointable;
@@ -173,6 +175,14 @@
                     AStringPrinter.INSTANCE.print(b, s, l, ps);
                     break;
                 }
+                case YEARMONTHDURATION: {
+                    AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DAYTIMEDURATION: {
+                    ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
                 default: {
                     throw new NotImplementedException("No printer for type " + typeTag);
                 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
new file mode 100644
index 0000000..38f76e3
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.om.typecomputer.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class OptionalADayTimeDurationTypeComputer implements IResultTypeComputer {
+
+    public static final OptionalADayTimeDurationTypeComputer INSTANCE = new OptionalADayTimeDurationTypeComputer();
+
+    private OptionalADayTimeDurationTypeComputer() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer#computeType(edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression, edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment, edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider)
+     */
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        List<IAType> unionList = new ArrayList<IAType>();
+        unionList.add(BuiltinType.ANULL);
+        unionList.add(BuiltinType.ADAYTIMEDURATION);
+        return new AUnionType(unionList, "OptionalDayTimeDuration");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
new file mode 100644
index 0000000..4c08142
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.om.typecomputer.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class OptionalAYearMonthDurationTypeComputer implements IResultTypeComputer {
+
+    public static final OptionalAYearMonthDurationTypeComputer INSTANCE = new OptionalAYearMonthDurationTypeComputer();
+
+    private OptionalAYearMonthDurationTypeComputer() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer#computeType(edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression, edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment, edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider)
+     */
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        List<IAType> unionList = new ArrayList<IAType>();
+        unionList.add(BuiltinType.ANULL);
+        unionList.add(BuiltinType.AYEARMONTHDURATION);
+        return new AUnionType(unionList, "OptionalYearMonthDuration");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index ca7bc24..037cd29 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -259,6 +259,11 @@
                 case FLOAT:
                 case DOUBLE:
                 case STRING:
+                case DATE:
+                case TIME:
+                case DATETIME:
+                case YEARMONTHDURATION:
+                case DAYTIMEDURATION:
                     break;
                 case UNION:
                     throw new AlgebricksException("The partitioning key \"" + fieldName + "\" cannot be nullable");
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
index a0ad3e1..e88596d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ATypeTag.java
@@ -1,6 +1,4 @@
-/**
- * 
- */
+
 package edu.uci.ics.asterix.om.types;
 
 /**
@@ -44,7 +42,9 @@
     CIRCLE(32),
     RECTANGLE(33),
     INTERVAL(34),
-    SYSTEM_NULL(35);
+    SYSTEM_NULL(35),
+    YEARMONTHDURATION(36),
+    DAYTIMEDURATION(37);
 
     private byte value;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
index a70f15b..17d98d4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/BuiltinType.java
@@ -431,6 +431,60 @@
         }
     };
 
+    public final static BuiltinType AYEARMONTHDURATION = new LowerCaseConstructorType() {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public String getDisplayName() {
+            return "AYearMonthDuration";
+        }
+
+        @Override
+        public ATypeTag getTypeTag() {
+            return ATypeTag.YEARMONTHDURATION;
+        }
+
+        @Override
+        public String getTypeName() {
+            return "year-month-duration";
+        }
+
+        @Override
+        public JSONObject toJSON() throws JSONException {
+            JSONObject type = new JSONObject();
+            type.put("type", "AYearMonthDuration");
+            return type;
+        }
+    };
+
+    public final static BuiltinType ADAYTIMEDURATION = new LowerCaseConstructorType() {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public String getDisplayName() {
+            return "ADayTimeDuration";
+        }
+
+        @Override
+        public ATypeTag getTypeTag() {
+            return ATypeTag.DAYTIMEDURATION;
+        }
+
+        @Override
+        public String getTypeName() {
+            return "day-time-duration";
+        }
+
+        @Override
+        public JSONObject toJSON() throws JSONException {
+            JSONObject type = new JSONObject();
+            type.put("type", "ADayTimeDuration");
+            return type;
+        }
+    };
+
     public final static BuiltinType AINTERVAL = new LowerCaseConstructorType() {
 
         private static final long serialVersionUID = 1L;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
index 047c459..b4cd23c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
@@ -95,12 +95,14 @@
             case INT32:
             case FLOAT:
             case DATE:
+            case YEARMONTHDURATION:
                 return 4;
             case TIME:
                 return 4;
             case INT64:
             case DOUBLE:
             case DATETIME:
+            case DAYTIMEDURATION:
                 return 8;
             case DURATION:
                 return 12;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/IOMVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/IOMVisitor.java
index 703b792..d83f72d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/IOMVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/IOMVisitor.java
@@ -7,6 +7,7 @@
 import edu.uci.ics.asterix.om.base.ACircle;
 import edu.uci.ics.asterix.om.base.ADate;
 import edu.uci.ics.asterix.om.base.ADateTime;
+import edu.uci.ics.asterix.om.base.ADayTimeDuration;
 import edu.uci.ics.asterix.om.base.ADouble;
 import edu.uci.ics.asterix.om.base.ADuration;
 import edu.uci.ics.asterix.om.base.AFloat;
@@ -26,6 +27,7 @@
 import edu.uci.ics.asterix.om.base.AString;
 import edu.uci.ics.asterix.om.base.ATime;
 import edu.uci.ics.asterix.om.base.AUnorderedList;
+import edu.uci.ics.asterix.om.base.AYearMonthDuration;
 import edu.uci.ics.asterix.om.types.IAType;
 
 public interface IOMVisitor {
@@ -47,6 +49,10 @@
 
     public void visitADuration(ADuration obj) throws AsterixException;
 
+    public void visitAYearMonthDuration(AYearMonthDuration obj) throws AsterixException;
+
+    public void visitADayTimeDuration(ADayTimeDuration obj) throws AsterixException;
+
     public void visitAInterval(AInterval obj) throws AsterixException;
 
     public void visitADate(ADate obj) throws AsterixException;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/OMPrintToStringVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/OMPrintToStringVisitor.java
index e7856f0..60c8700 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/OMPrintToStringVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/visitors/OMPrintToStringVisitor.java
@@ -8,6 +8,7 @@
 import edu.uci.ics.asterix.om.base.ACollectionCursor;
 import edu.uci.ics.asterix.om.base.ADate;
 import edu.uci.ics.asterix.om.base.ADateTime;
+import edu.uci.ics.asterix.om.base.ADayTimeDuration;
 import edu.uci.ics.asterix.om.base.ADouble;
 import edu.uci.ics.asterix.om.base.ADuration;
 import edu.uci.ics.asterix.om.base.AFloat;
@@ -27,6 +28,7 @@
 import edu.uci.ics.asterix.om.base.AString;
 import edu.uci.ics.asterix.om.base.ATime;
 import edu.uci.ics.asterix.om.base.AUnorderedList;
+import edu.uci.ics.asterix.om.base.AYearMonthDuration;
 import edu.uci.ics.asterix.om.base.IACursor;
 import edu.uci.ics.asterix.om.base.IAObject;
 import edu.uci.ics.asterix.om.types.ARecordType;
@@ -252,4 +254,16 @@
         }
     }
 
+    @Override
+    public void visitAYearMonthDuration(AYearMonthDuration obj) throws AsterixException {
+        // TODO Auto-generated method stub
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void visitADayTimeDuration(ADayTimeDuration obj) throws AsterixException {
+        // TODO Auto-generated method stub
+        throw new NotImplementedException();
+    }
+
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index 1565cb9..06a7823 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -2,8 +2,14 @@
 
 import java.io.DataOutput;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADateOrTimeAscBinaryComparatorFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADateTimeAscBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ACirclePartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ADurationPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AIntervalPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ALinePartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.APolygonPartialBinaryComparatorFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.ARectanglePartialBinaryComparatorFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
@@ -49,9 +55,21 @@
             .getSerializerDeserializer(BuiltinType.ANULL);
     protected IBinaryComparator strBinaryComp = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
             .createBinaryComparator();
-    protected IBinaryComparator dateTimeBinaryComp = ADateTimeAscBinaryComparatorFactory.INSTANCE
+    protected IBinaryComparator circleBinaryComp = ACirclePartialBinaryComparatorFactory.INSTANCE
             .createBinaryComparator();
-    protected IBinaryComparator dateOrTimeBinaryComp = ADateOrTimeAscBinaryComparatorFactory.INSTANCE
+    protected IBinaryComparator durationBinaryComp = ADurationPartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator intervalBinaryComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator lineBinaryComparator = ALinePartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator pointBinaryComparator = APointPartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator point3DBinaryComparator = APoint3DPartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator polygonBinaryComparator = APolygonPartialBinaryComparatorFactory.INSTANCE
+            .createBinaryComparator();
+    protected IBinaryComparator rectangleBinaryComparator = ARectanglePartialBinaryComparatorFactory.INSTANCE
             .createBinaryComparator();
 
     public AbstractComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
@@ -68,6 +86,25 @@
         evalRight.evaluate(tuple);
     }
 
+    protected void checkComparable() throws AlgebricksException {
+        if (outLeft.getLength() != 0) {
+            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outLeft.getByteArray()[0]);
+            switch (typeTag) {
+                case DURATION:
+                case INTERVAL:
+                case LINE:
+                case POINT:
+                case POINT3D:
+                case POLYGON:
+                case CIRCLE:
+                case RECTANGLE:
+                    throw new AlgebricksException("Inequality comparison for " + typeTag + " is not defined.");
+                default:
+                    return;
+            }
+        }
+    }
+
     protected ComparisonResult compareResults() throws AlgebricksException {
         boolean isLeftNull = false;
         boolean isRightNull = false;
@@ -119,50 +156,73 @@
             case BOOLEAN: {
                 return compareBooleanWithArg(typeTag2);
             }
-            case DATETIME: {
-                return compareDateTimeWithArg(typeTag2);
-            }
-            case DATE:
-            case TIME: {
-                return compareDateOrTimeWithArg(typeTag2);
-            }
+
             default: {
-                throw new AlgebricksException("Comparison is undefined between types " + typeTag1 + " and " + typeTag2
-                        + " .");
+                return compareStrongTypedWithArg(typeTag1, typeTag2);
             }
         }
     }
 
-    private ComparisonResult compareDateOrTimeWithArg(ATypeTag typeTag2) throws AlgebricksException {
-        if (typeTag2 == ATypeTag.NULL) {
-            return ComparisonResult.GREATER_THAN;
-        } else if (typeTag2 == ATypeTag.DATE || typeTag2 == ATypeTag.TIME) {
-            int result = dateOrTimeBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                    outRight.getByteArray(), 1, outRight.getLength() - 1);
-            if (result == 0)
-                return ComparisonResult.EQUAL;
-            else if (result < 0)
-                return ComparisonResult.LESS_THAN;
-            else
-                return ComparisonResult.GREATER_THAN;
+    private ComparisonResult compareStrongTypedWithArg(ATypeTag expectedTypeTag, ATypeTag actualTypeTag)
+            throws AlgebricksException {
+        if (expectedTypeTag != actualTypeTag) {
+            throw new AlgebricksException("Comparison is undefined between " + expectedTypeTag + " and "
+                    + actualTypeTag + ".");
         }
-        throw new AlgebricksException("Comparison is undefined between types Date/Time and " + typeTag2 + " .");
-    }
-
-    private ComparisonResult compareDateTimeWithArg(ATypeTag typeTag2) throws AlgebricksException {
-        if (typeTag2 == ATypeTag.NULL) {
-            return ComparisonResult.GREATER_THAN;
-        } else if (typeTag2 == ATypeTag.DATETIME) {
-            int result = dateTimeBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                    outRight.getByteArray(), 1, outRight.getLength() - 1);
-            if (result == 0)
-                return ComparisonResult.EQUAL;
-            else if (result < 0)
-                return ComparisonResult.LESS_THAN;
-            else
-                return ComparisonResult.GREATER_THAN;
+        int result = 0;
+        switch (actualTypeTag) {
+            case YEARMONTHDURATION:
+            case TIME:
+            case DATE:
+                result = Integer.compare(AInt32SerializerDeserializer.getInt(outLeft.getByteArray(), 1),
+                        AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1));
+                break;
+            case DAYTIMEDURATION:
+            case DATETIME:
+                result = Long.compare(AInt64SerializerDeserializer.getLong(outLeft.getByteArray(), 1),
+                        AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1));
+                break;
+            case CIRCLE:
+                result = circleBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case LINE:
+                result = lineBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case POINT:
+                result = pointBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case POINT3D:
+                result = point3DBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case POLYGON:
+                result = polygonBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case DURATION:
+                result = durationBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case INTERVAL:
+                result = intervalBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            case RECTANGLE:
+                result = rectangleBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
+                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                break;
+            default:
+                throw new AlgebricksException("Comparison for " + actualTypeTag + " is not supported.");
         }
-        throw new AlgebricksException("Comparison is undefined between types Datetime and " + typeTag2 + " .");
+        if (result == 0)
+            return ComparisonResult.EQUAL;
+        else if (result < 0)
+            return ComparisonResult.LESS_THAN;
+        else
+            return ComparisonResult.GREATER_THAN;
     }
 
     private ComparisonResult compareBooleanWithArg(ATypeTag typeTag2) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
index ed77276..8d57c2e 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
@@ -121,6 +121,7 @@
         @Override
         public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
             evalInputs(tuple);
+            checkComparable();
             ComparisonResult r = compareResults();
             if (r == ComparisonResult.UNKNOWN) {
                 try {
@@ -150,6 +151,7 @@
         @Override
         public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
             evalInputs(tuple);
+            checkComparable();
             ComparisonResult r = compareResults();
             if (r == ComparisonResult.UNKNOWN) {
                 try {
@@ -178,6 +180,7 @@
         @Override
         public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
             evalInputs(tuple);
+            checkComparable();
             ComparisonResult r = compareResults();
             if (r == ComparisonResult.UNKNOWN) {
                 try {
@@ -207,6 +210,7 @@
         @Override
         public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
             evalInputs(tuple);
+            checkComparable();
             ComparisonResult r = compareResults();
             if (r == ComparisonResult.UNKNOWN) {
                 try {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
new file mode 100644
index 0000000..0d43c3d
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
@@ -0,0 +1,114 @@
+/*
+ * 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 edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ADayTimeDuration;
+import edu.uci.ics.asterix.om.base.AMutableDayTimeDuration;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
+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;
+
+public class ADayTimeDurationConstructorDescriptor 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() {
+
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new ADayTimeDurationConstructorDescriptor();
+        }
+    };
+
+    @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 day-time-duration";
+                    private AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+                    @SuppressWarnings("unchecked")
+                    private ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
+                    @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) {
+
+                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+
+                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDayTimeDuration,
+                                        ADurationParseOption.DAY_TIME);
+
+                                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                            } else if (serString[0] == SER_NULL_TYPE_TAG) {
+                                nullSerde.serialize(ANull.NULL, out);
+                            } else {
+                                throw new AlgebricksException(errorMessage);
+                            }
+                        } catch (Exception e1) {
+                            throw new AlgebricksException(e1);
+                        }
+                    }
+
+                };
+            }
+        };
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor#getIdentifier()
+     */
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
+    }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index a84ae1d..669c4f7 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -21,6 +21,7 @@
 import edu.uci.ics.asterix.om.base.AMutableDuration;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -82,7 +83,8 @@
 
                                 int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
 
-                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDuration);
+                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDuration,
+                                        ADurationParseOption.All);
 
                                 durationSerde.serialize(aDuration, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG) {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
index 7ea8e90..f753ba6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
@@ -27,6 +27,7 @@
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.base.temporal.ADateParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -128,8 +129,8 @@
                                 int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                ADurationParserFactory
-                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
+                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
+                                        aDuration, ADurationParseOption.All);
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds());
                             } else {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
index f16dccb..332158b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
@@ -29,6 +29,7 @@
 import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -141,8 +142,8 @@
                                 int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                ADurationParserFactory
-                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
+                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
+                                        aDuration, ADurationParseOption.All);
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds());
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
index 35bfe17..89d1694 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
@@ -29,6 +29,7 @@
 import edu.uci.ics.asterix.om.base.temporal.ATimeParserFactory;
 import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -138,8 +139,8 @@
                                 int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
                                         + (argOut1.getByteArray()[2] & 0xff << 0);
 
-                                ADurationParserFactory
-                                        .parseDuration(argOut1.getByteArray(), 3, stringLength, aDuration);
+                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
+                                        aDuration, ADurationParseOption.All);
 
                                 if (aDuration.getMonths() != 0) {
                                     throw new AlgebricksException(FID.getName()
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
new file mode 100644
index 0000000..bc6099c
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
@@ -0,0 +1,114 @@
+/*
+ * 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 edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.AMutableYearMonthDuration;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.AYearMonthDuration;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory;
+import edu.uci.ics.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
+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;
+
+public class AYearMonthDurationConstructorDescriptor 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() {
+
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new AYearMonthDurationConstructorDescriptor();
+        }
+    };
+
+    @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 year-month-duration";
+                    private AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
+                    @SuppressWarnings("unchecked")
+                    private ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
+                    @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) {
+
+                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+
+                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aYearMonthDuration,
+                                        ADurationParseOption.YEAR_MONTH);
+
+                                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                            } else if (serString[0] == SER_NULL_TYPE_TAG) {
+                                nullSerde.serialize(ANull.NULL, out);
+                            } else {
+                                throw new AlgebricksException(errorMessage);
+                            }
+                        } catch (Exception e1) {
+                            throw new AlgebricksException(e1);
+                        }
+                    }
+
+                };
+            }
+        };
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor#getIdentifier()
+     */
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
+    }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
similarity index 84%
copy from asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
copy to asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
index 97fa94a..17c6ba9 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
@@ -18,8 +18,8 @@
 
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.AInt64;
-import edu.uci.ics.asterix.om.base.AMutableInt64;
+import edu.uci.ics.asterix.om.base.ADayTimeDuration;
+import edu.uci.ics.asterix.om.base.AMutableDayTimeDuration;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
@@ -38,10 +38,10 @@
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class MillisecondsOfDayTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+public class GetDayTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MILLISECONDS_OF_DAY_TIME_DURATION;
+    private static final long serialVersionUID = 1L;
+    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.GET_DAY_TIME_DURATION;
 
     // allowed input types
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -51,7 +51,7 @@
 
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
-            return new MillisecondsOfDayTimeDurationDescriptor();
+            return new GetDayTimeDurationDescriptor();
         }
     };
 
@@ -74,10 +74,10 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AInt64> int64Serde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AINT64);
+                    private ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
 
-                    AMutableInt64 aInt64 = new AMutableInt64(0);
+                    AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -95,9 +95,10 @@
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
                             }
 
-                            aInt64.setValue(ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
+                            aDayTimeDuration.setMilliseconds(ADurationSerializerDeserializer.getDayTime(
+                                    argOut0.getByteArray(), 1));
 
-                            int64Serde.serialize(aInt64, out);
+                            dayTimeDurationSerde.serialize(aDayTimeDuration, out);
 
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
similarity index 84%
copy from asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
copy to asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
index 97fa94a..b7b4278 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
@@ -18,9 +18,9 @@
 
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.AInt64;
-import edu.uci.ics.asterix.om.base.AMutableInt64;
+import edu.uci.ics.asterix.om.base.AMutableYearMonthDuration;
 import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.AYearMonthDuration;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -38,10 +38,10 @@
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class MillisecondsOfDayTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+public class GetYearMonthDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MILLISECONDS_OF_DAY_TIME_DURATION;
+    private static final long serialVersionUID = 1L;
+    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.GET_YEAR_MONTH_DURATION;
 
     // allowed input types
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
@@ -51,7 +51,7 @@
 
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
-            return new MillisecondsOfDayTimeDurationDescriptor();
+            return new GetYearMonthDurationDescriptor();
         }
     };
 
@@ -74,10 +74,10 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AInt64> int64Serde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AINT64);
+                    private ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
 
-                    AMutableInt64 aInt64 = new AMutableInt64(0);
+                    AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -95,9 +95,10 @@
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
                             }
 
-                            aInt64.setValue(ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
+                            aYearMonthDuration.setMonths(ADurationSerializerDeserializer.getYearMonth(
+                                    argOut0.getByteArray(), 1));
 
-                            int64Serde.serialize(aInt64, out);
+                            yearMonthDurationSerde.serialize(aYearMonthDuration, out);
 
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
similarity index 88%
rename from asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
rename to asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
index 97fa94a..14e16c6 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsOfDayTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
@@ -16,7 +16,7 @@
 
 import java.io.DataOutput;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.AInt64;
 import edu.uci.ics.asterix.om.base.AMutableInt64;
@@ -38,20 +38,20 @@
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class MillisecondsOfDayTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+public class MillisecondsFromDayTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MILLISECONDS_OF_DAY_TIME_DURATION;
+    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MILLISECONDS_FROM_DAY_TIME_DURATION;
 
     // allowed input types
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DURATION_TYPE_TAG = ATypeTag.DURATION.serialize();
+    private final static byte SER_DAY_TIME_DURATION_TYPE_TAG = ATypeTag.DAYTIMEDURATION.serialize();
 
     public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
 
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
-            return new MillisecondsOfDayTimeDurationDescriptor();
+            return new MillisecondsFromDayTimeDurationDescriptor();
         }
     };
 
@@ -90,12 +90,12 @@
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName() + ": expects NULL/DURATION, but got "
+                            if (argOut0.getByteArray()[0] != SER_DAY_TIME_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(FID.getName() + ": expects NULL/DAY-TIME-DURATION, but got "
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
                             }
 
-                            aInt64.setValue(ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
+                            aInt64.setValue(ADayTimeDurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
 
                             int64Serde.serialize(aInt64, out);
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsOfYearMonthDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
similarity index 87%
rename from asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsOfYearMonthDurationDescriptor.java
rename to asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
index 55173a5..9a66d45 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsOfYearMonthDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
@@ -16,7 +16,7 @@
 
 import java.io.DataOutput;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.AInt32;
 import edu.uci.ics.asterix.om.base.AMutableInt32;
@@ -38,20 +38,20 @@
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class MonthsOfYearMonthDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+public class MonthsFromYearMonthDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MONTHS_OF_YEAR_MONTH_DURATION;
+    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.MONTHS_FROM_YEAR_MONTH_DURATION;
 
     // allowed input types
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DURATION_TYPE_TAG = ATypeTag.DURATION.serialize();
+    private final static byte SER_YEARMONTHDURATION_TYPE_TAG = ATypeTag.YEARMONTHDURATION.serialize();
 
     public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
 
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
-            return new MonthsOfYearMonthDurationDescriptor();
+            return new MonthsFromYearMonthDurationDescriptor();
         }
     };
 
@@ -90,12 +90,14 @@
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName() + ": expects NULL/DURATION, but got "
+                            if (argOut0.getByteArray()[0] != SER_YEARMONTHDURATION_TYPE_TAG) {
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/YEAR-MONTH-DURATION, but got "
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
                             }
 
-                            aInt32.setValue(ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1));
+                            aInt32.setValue(AYearMonthDurationerializerDeserializer.getYearMonth(
+                                    argOut0.getByteArray(), 1));
 
                             int32Serde.serialize(aInt32, out);
 
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 8bc792c..2c81b7c 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
@@ -90,6 +90,7 @@
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ACircleConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ADateConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ADateTimeConstructorDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.constructors.ADayTimeDurationConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ADoubleConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ADurationConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.AFloatConstructorDescriptor;
@@ -111,6 +112,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.AYearMonthDurationConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.AndDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.AnyCollectionMemberDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.CastListDescriptor;
@@ -210,6 +212,8 @@
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.DurationEqualDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.DurationFromMillisecondsDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.DurationFromMonthsDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.GetDayTimeDurationDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.GetYearMonthDurationDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalAfterDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalBeforeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalCoveredByDescriptor;
@@ -218,12 +222,15 @@
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalEndsDecriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalMeetsDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalMetByDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MillisecondsFromDayTimeDurationDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MonthsFromYearMonthDurationDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.OverlapDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalOverlappedByDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalOverlapsDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalStartedByDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalStartsDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MillisecondsOfDayTimeDurationDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MonthsOfYearMonthDurationDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MillisecondsFromDayTimeDurationDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.MonthsFromYearMonthDurationDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.OverlapDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.SubtractDateDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.SubtractDatetimeDescriptor;
@@ -419,6 +426,8 @@
         temp.add(ADateConstructorDescriptor.FACTORY);
         temp.add(ADateTimeConstructorDescriptor.FACTORY);
         temp.add(ADurationConstructorDescriptor.FACTORY);
+        temp.add(AYearMonthDurationConstructorDescriptor.FACTORY);
+        temp.add(ADayTimeDurationConstructorDescriptor.FACTORY);
 
         // Spatial
         temp.add(CreatePointDescriptor.FACTORY);
@@ -519,9 +528,11 @@
         temp.add(YearMonthDurationComparatorDecriptor.LESS_THAN_FACTORY);
         temp.add(DayTimeDurationComparatorDescriptor.GREATER_THAN_FACTORY);
         temp.add(DayTimeDurationComparatorDescriptor.LESS_THAN_FACTORY);
-        temp.add(MonthsOfYearMonthDurationDescriptor.FACTORY);
-        temp.add(MillisecondsOfDayTimeDurationDescriptor.FACTORY);
+        temp.add(MonthsFromYearMonthDurationDescriptor.FACTORY);
+        temp.add(MillisecondsFromDayTimeDurationDescriptor.FACTORY);
         temp.add(DurationEqualDescriptor.FACTORY);
+        temp.add(GetYearMonthDurationDescriptor.FACTORY);
+        temp.add(GetDayTimeDurationDescriptor.FACTORY);
 
         // Interval constructor
         temp.add(AIntervalFromDateConstructorDescriptor.FACTORY);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index b32110b..35c0529 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -33,6 +33,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ACircleSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ALineSerializerDeserializer;
@@ -41,6 +42,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.APolygonSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARectangleSerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationerializerDeserializer;
 import edu.uci.ics.asterix.om.base.ABoolean;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
@@ -288,6 +290,14 @@
                 parseConstructor(ATypeTag.DURATION, objectType, out);
                 break;
             }
+            case AdmLexer.TOKEN_YEAR_MONTH_DURATION_CONS: {
+                parseConstructor(ATypeTag.YEARMONTHDURATION, objectType, out);
+                break;
+            }
+            case AdmLexer.TOKEN_DAY_TIME_DURATION_CONS: {
+                parseConstructor(ATypeTag.DAYTIMEDURATION, objectType, out);
+                break;
+            }
             case AdmLexer.TOKEN_POINT_CONS: {
                 parseConstructor(ATypeTag.POINT, objectType, out);
                 break;
@@ -363,6 +373,22 @@
 
     }
 
+    private void parseYearMonthDuration(String duration, DataOutput out) throws AsterixException {
+        try {
+            AYearMonthDurationerializerDeserializer.parse(duration, out);
+        } catch (HyracksDataException e) {
+            throw new AsterixException(e);
+        }
+    }
+
+    private void parseDayTimeDuration(String duration, DataOutput out) throws AsterixException {
+        try {
+            ADayTimeDurationSerializerDeserializer.parse(duration, out);
+        } catch (HyracksDataException e) {
+            throw new AsterixException(e);
+        }
+    }
+
     private IAType getComplexType(IAType aObjectType, ATypeTag tag) {
 
         if (aObjectType == null) {
@@ -762,6 +788,16 @@
                                         admLexer.getLastTokenImage().substring(1,
                                                 admLexer.getLastTokenImage().length() - 1), out);
                                 break;
+                            case DAYTIMEDURATION:
+                                parseDayTimeDuration(
+                                        admLexer.getLastTokenImage().substring(1,
+                                                admLexer.getLastTokenImage().length() - 1), out);
+                                break;
+                            case YEARMONTHDURATION:
+                                parseYearMonthDuration(
+                                        admLexer.getLastTokenImage().substring(1,
+                                                admLexer.getLastTokenImage().length() - 1), out);
+                                break;
                             case POINT:
                                 parsePoint(
                                         admLexer.getLastTokenImage().substring(1,
diff --git a/asterix-runtime/src/main/resources/adm.grammar b/asterix-runtime/src/main/resources/adm.grammar
index 4d4158f..80e2cd4 100644
--- a/asterix-runtime/src/main/resources/adm.grammar
+++ b/asterix-runtime/src/main/resources/adm.grammar
@@ -29,6 +29,8 @@
 INTERVAL_TIME_CONS      = string(interval-time)
 INTERVAL_DATE_CONS      = string(interval-date)
 INTERVAL_DATETIME_CONS  = string(interval-datetime)
+YEAR_MONTH_DURATION_CONS = string(year-month-duration)
+DAY_TIME_DURATION_CONS   = string(day-time-duration) 
 
 NULL_LITERAL   = string(null)
 TRUE_LITERAL   = string(true)
diff --git a/asterix-test-framework/.gitignore b/asterix-test-framework/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/asterix-test-framework/.gitignore
@@ -0,0 +1 @@
+/target