Merge branch 'master' into jarodwen/hotfix/postbeta
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.1.ddl.aql
new file mode 100644
index 0000000..04c1e6f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.1.ddl.aql
@@ -0,0 +1,18 @@
+/**
+ * issue531_string_min_max
+ * 
+ * Purpose: test the support of string values for min and max aggregation function
+ * Result: success
+ * 
+ */
+ 
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open{
+id:int32,
+name:string
+}
+
+create dataset t1(TestType) primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.2.update.aql
new file mode 100644
index 0000000..2e0bb6c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.2.update.aql
@@ -0,0 +1,18 @@
+/**
+ * issue531_string_min_max
+ * 
+ * Purpose: test the support of string values for min and max aggregation function
+ * Result: success
+ * 
+ */
+
+use dataverse test;
+
+insert into dataset t1({"id":5,"name":"Smith"});
+insert into dataset t1({"id":12,"name":"Roger"});
+insert into dataset t1({"id":67,"name":"Kevin"});
+insert into dataset t1({"id":32,"name":"Bob"});
+insert into dataset t1({"id":89,"name":"John"});
+insert into dataset t1({"id":10,"name":"Alex"});
+insert into dataset t1({"id":37,"name":"Calvin"});
+insert into dataset t1({"id":98,"name":"Susan"});
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.aql
new file mode 100644
index 0000000..1fa706c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/issue531_string_min_max/issue531_string_min_max.3.query.aql
@@ -0,0 +1,13 @@
+/**
+ * issue531_string_min_max
+ * 
+ * Purpose: test the support of string values for min and max aggregation function
+ * Result: success
+ * 
+ */
+
+use dataverse test;
+
+{"min": min(for $l in dataset t1
+return $l.name), "max": max(for $l in dataset t1
+return $l.name)}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/boolean/and_null/and_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/boolean/and_null/and_null.3.query.aql
index 830ffe9..f49dbd7 100644
--- a/asterix-app/src/test/resources/runtimets/queries/boolean/and_null/and_null.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/boolean/and_null/and_null.3.query.aql
@@ -1,5 +1,5 @@
 use dataverse test;
 
-let $x := boolean("true")
+let $x := true
 let $y := null
 return $x and $y
diff --git a/asterix-app/src/test/resources/runtimets/queries/boolean/and_null_false/and_null_false.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/boolean/and_null_false/and_null_false.3.query.aql
index 5e646a8..371246d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/boolean/and_null_false/and_null_false.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/boolean/and_null_false/and_null_false.3.query.aql
@@ -1,5 +1,5 @@
 use dataverse test;
 
-let $x := boolean("false")
+let $x := false
 let $y := null
 return $x and $y
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-insert2/opentype-insert2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-insert2/opentype-insert2.2.update.aql
index ec357bf..be95b39 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/opentype-insert2/opentype-insert2.2.update.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/opentype-insert2/opentype-insert2.2.update.aql
@@ -7,5 +7,5 @@
 
 use dataverse test;
 
-insert into dataset testds( for $i in range(1,10) return { "id":$i,"name":"John Doe" });
+insert into dataset testds( for $i in range(1, 10) return { "id":$i,"name":"John Doe" });
 
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.1.ddl.aql
deleted file mode 100644
index 754ea81..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.1.ddl.aql
+++ /dev/null
@@ -1,3 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.2.update.aql
deleted file mode 100644
index e69de29..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.2.update.aql
+++ /dev/null
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.3.query.aql
deleted file mode 100644
index 169ca39..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_double_01/unary-minus_double_01.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-let $c1 := double("-20.56e-30")
-let $c2 := double("NaN")
-let $c3 := double("INF")
-let $c4 := double("-INF")
-return {"double1": numeric-unary-minus($c1),"double2": numeric-unary-minus($c2),"double3": numeric-unary-minus($c3),"double4": numeric-unary-minus($c4)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.1.ddl.aql
deleted file mode 100644
index 754ea81..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.1.ddl.aql
+++ /dev/null
@@ -1,3 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.2.update.aql
deleted file mode 100644
index e69de29..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.2.update.aql
+++ /dev/null
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.3.query.aql
deleted file mode 100644
index e5e0071..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_float_01/unary-minus_float_01.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-let $c1 := float("-80.20f")
-let $c2 := float("NaN")
-let $c3 := float("INF")
-let $c4 := float("-INF")
-return {"float1": numeric-unary-minus($c1),"float2": numeric-unary-minus($c2),"float3": numeric-unary-minus($c3),"float4": numeric-unary-minus($c4)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.1.ddl.aql
deleted file mode 100644
index 754ea81..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.1.ddl.aql
+++ /dev/null
@@ -1,3 +0,0 @@
-drop dataverse test if exists;
-create dataverse test;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.2.update.aql
deleted file mode 100644
index e69de29..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.2.update.aql
+++ /dev/null
diff --git a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.3.query.aql
deleted file mode 100644
index 660e55f..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/numeric/unary-minus_int_01/unary-minus_int_01.3.query.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse test;
-
-let $c1 := int8("+80")
-let $c2 := int16("160")
-let $c3 := int32("+320")
-let $c4 := int64("-640")
-return {"int8": numeric-unary-minus($c1),"int16": numeric-unary-minus($c2),"int32": numeric-unary-minus($c3),"int64": numeric-unary-minus($c4)}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration/calendar_duration.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration/calendar_duration.3.query.aql
index 016f3b3..b1c3a20 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration/calendar_duration.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/calendar_duration/calendar_duration.3.query.aql
@@ -8,36 +8,36 @@
 let $dr3 := duration("P1Y90M")
 let $dr4 := duration("-P3Y89M4089DT47382.983S")
 let $cdr1 := calendar-duration-from-datetime($t1, $dr1)
-let $dt1 := add-datetime-duration($t1, $dr1)
-let $dtt1 := add-datetime-duration($t1, $cdr1)
+let $dt1 := $t1 + $dr1
+let $dtt1 := $t1 + $cdr1
 let $c1 := $dt1 = $dtt1
 let $cdr2 := calendar-duration-from-datetime($t1, $dr2)
-let $dt2 := add-datetime-duration($t1, $dr2)
-let $dtt2 := add-datetime-duration($t1, $cdr2)
+let $dt2 := $t1 + $dr2
+let $dtt2 := $t1 + $cdr2
 let $c2 := $dt2 = $dtt2
 let $cdr3 := calendar-duration-from-datetime($t1, $dr3)
-let $dt3 := add-datetime-duration($t1, $dr3)
-let $dtt3 := add-datetime-duration($t1, $cdr3)
+let $dt3 := $t1 + $dr3
+let $dtt3 := $t1 + $cdr3
 let $c3 := $dt3 = $dtt3
 let $cdr4 := calendar-duration-from-datetime($t1, $dr4)
-let $dt4 := add-datetime-duration($t1, $dr4)
-let $dtt4 := add-datetime-duration($t1, $cdr4)
+let $dt4 := $t1 + $dr4
+let $dtt4 := $t1 + $cdr4
 let $c4 := $dt4 = $dtt4
 let $cdr5 := calendar-duration-from-date($t2, $dr1)
-let $dt5 := add-date-duration($t2, $dr1)
-let $dtt5 := add-date-duration($t2, $cdr5)
+let $dt5 := $t2 + $dr1
+let $dtt5 := $t2 + $cdr5
 let $c5 := $dt5 = $dtt5
 let $cdr6 := calendar-duration-from-date($t2, $dr2)
-let $dt6 := add-date-duration($t2, $dr2)
-let $dtt6 := add-date-duration($t2, $cdr6)
+let $dt6 := $t2 + $dr2
+let $dtt6 := $t2 + $cdr6
 let $c6 := $dt6 = $dtt6
 let $cdr7 := calendar-duration-from-date($t2, $dr3)
-let $dt7 := add-date-duration($t2, $dr3)
-let $dtt7 := add-date-duration($t2, $cdr7)
+let $dt7 := $t2 + $dr3
+let $dtt7 := $t2 + $cdr7
 let $c7 := $dt7 = $dtt7
 let $cdr8 := calendar-duration-from-date($t2, $dr4)
-let $dt8 := add-date-duration($t2, $dr4)
-let $dtt8 := add-date-duration($t2, $cdr8)
+let $dt8 := $t2 + $dr4
+let $dtt8 := $t2 + $cdr8
 let $c8 := $dt8 = $dtt8
 
 return { "cduration1":$cdr1, "c1":$c1, "cduration2":$cdr2, "c2":$c2, "cduration3":$cdr3, "c3":$c3, "cduration4":$cdr4, "c4":$c4, "cduration5":$cdr5, "c5":$c5, "cduration6":$cdr6, "c6":$c6, "cduration7":$cdr7, "c7":$c7, "cduration8":$cdr8, "c8":$c8, "cduration-null-1": calendar-duration-from-datetime(null, $dr1), "cduration-null-2": calendar-duration-from-datetime($t1, null), "cduration-null-3": calendar-duration-from-date(null, $dr1), "cduration-null-4": calendar-duration-from-date($t2, null) }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions/date_functions.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions/date_functions.3.query.aql
index 3927f72..e540817 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions/date_functions.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/date_functions/date_functions.3.query.aql
@@ -9,16 +9,16 @@
 let $dt2 := datetime("2012-10-11T02:30:23+03:00")
 let $d3 := get-date-from-datetime($dt2)
 let $dr1 := duration("-P2Y1M90DT30H")
-let $d4 := add-date-duration($d1, $dr1)
-let $null3 := add-date-duration(null, $dr1)
-let $null4 := add-date-duration($d1, null)
-let $c1 := $d1 = add-date-duration($d4, subtract-date($d1, $d4))
+let $d4 := $d1 + $dr1
+let $null3 := null + $dr1
+let $null4 := $d1 + null
+let $c1 := ($d1 = ($d4 + ($d1 - $d4)))
 let $dr2 := duration("P300Y900MT360000M")
-let $d5 := add-date-duration($d2, $dr2)
-let $c2 := $d2 = add-date-duration($d5, subtract-date($d2, $d5))
-let $dr3 := subtract-date($d5, $d2)
-let $dr4 := subtract-date($d4, $d1)
-let $null5 := subtract-date(null, $d2)
-let $null6 := subtract-date($d5, null)
+let $d5 := $d2 + $dr2
+let $c2 := ($d2 = ($d5 + ($d2 - $d5)))
+let $dr3 := $d5 - $d2
+let $dr4 := $d4 - $d1
+let $null5 := null - $d2
+let $null6 := $d5 - null
 
 return { "date1": $d1, "date2": $d2, "date3": $d3, "date4": $d4, "date5": $d5, "duration1": $dr3, "duration2": $dr4, "c1": $c1, "c2": $c2, "null1": $null1, "null2": $null2, "null3": $null3, "null4": $null4, "null5": $null5, "null6": $null6 }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions/datetime_functions.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions/datetime_functions.3.query.aql
index 3d24549..fe0c099 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions/datetime_functions.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/datetime_functions/datetime_functions.3.query.aql
@@ -8,12 +8,12 @@
 let $dt2 := datetime-from-date-time($d1, $t1)
 let $null2 := datetime-from-date-time(null, $t1)
 let $null3 := datetime-from-date-time($d1, null)
-let $dr1 := subtract-datetime($dt2, $dt1)
-let $null4 := subtract-datetime(null, $dt1)
-let $null5 := subtract-datetime($dt2, null)
-let $dt3 := add-datetime-duration($dt1, $dr1)
-let $null6 := add-datetime-duration(null, $dr1)
-let $null7 := add-datetime-duration($dt1, null)
-let $c1 := $dt1 = add-datetime-duration($dt3, subtract-datetime($dt1, $dt3))
+let $dr1 := $dt2 - $dt1
+let $null4 := null - $dt1
+let $null5 := $dt2 - null
+let $dt3 := $dt1 + $dr1
+let $null6 := null + $dr1
+let $null7 := $dt1 + null
+let $c1 := $dt1 = ($dt1 - $dt3) + $dt3
 
 return { "datetime1" : $dt1, "datetime2" : $dt2, "datetime3" : $dt3, "duration1" : $dr1, "c1" : $c1, "null1" : $null1, "null2" : $null2, "null3" : $null3, "null4" : $null4, "null5" : $null5, "null6" : $null6, "null7" : $null7 }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.1.ddl.aql
new file mode 100644
index 0000000..57b3b28
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.1.ddl.aql
@@ -0,0 +1,7 @@
+/**
+ * Interval_bin test case: test the interval-bin function
+ * Expected result: success
+ **/
+
+drop dataverse test if exists;
+create dataverse test;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.2.update.aql
new file mode 100644
index 0000000..e2e3afb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.2.update.aql
@@ -0,0 +1,4 @@
+/**
+ * Interval_bin test case: test the interval-bin function
+ * Expected result: success
+ **/
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.3.query.aql
new file mode 100644
index 0000000..adbb2a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin/interval_bin.3.query.aql
@@ -0,0 +1,19 @@
+/**
+ * Interval_bin test case: test the interval-bin function
+ * Expected result: success
+ **/
+
+use dataverse test;
+
+let $c1 := date("2010-10-30")
+let $c2 := datetime("-1987-11-19T23:49:23.938")
+let $c3 := time("12:23:34.930+07:00")
+
+return { "bin1": interval-bin($c1, date("1990-01-01"), year-month-duration("P1Y")), 
+         "bin2": interval-bin($c1, date("-1990-01-01"), year-month-duration("P1Y")),
+         "bin3": interval-bin($c2, datetime("1990-01-01T00:00:00.000Z"), year-month-duration("P6M")),
+         "bin4": interval-bin($c2, datetime("-1990-01-01T00:00:00.000Z"), day-time-duration("PT12H")),
+         "bin5": interval-bin($c3, time("12:00:00"), day-time-duration("PT2H")),
+         "bin6": interval-bin(null, date("-0023-01-01"), year-month-duration("P6M")),
+         "bin7": interval-bin($c1, null, year-month-duration("P6M")),
+         "bin8": interval-bin($c1, date("-0023-01-01"), null)  }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.1.ddl.aql
new file mode 100644
index 0000000..841d8da
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.1.ddl.aql
@@ -0,0 +1,16 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Schema as closed{
+id: int32,
+timestamp: datetime
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.2.update.aql
new file mode 100644
index 0000000..b1119e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.2.update.aql
@@ -0,0 +1,18 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+use dataverse test;
+ 
+insert into dataset tsdata({"id": 1, "timestamp": datetime("-1987-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 2, "timestamp": datetime("-1987-11-20T00:27:13.432")}) 
+insert into dataset tsdata({"id": 3, "timestamp": datetime("-1987-11-18T18:00:00")}) 
+insert into dataset tsdata({"id": 4, "timestamp": datetime("19871119T234923938")}) 
+insert into dataset tsdata({"id": 5, "timestamp": datetime("1987-11-19T23:58:17.038")}) 
+insert into dataset tsdata({"id": 6, "timestamp": datetime("1987-11-19T23:30:00")}) 
+insert into dataset tsdata({"id": 7, "timestamp": datetime("1987-11-19T23:22:38")}) 
+insert into dataset tsdata({"id": 8, "timestamp": datetime("1988-01-21T17:28:13.900")}) 
+insert into dataset tsdata({"id": 9, "timestamp": datetime("-1987-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 10, "timestamp": datetime("-0987-07-01T09:35:28.039")}) 
+insert into dataset tsdata({"id": 11, "timestamp": datetime("2012-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 12, "timestamp": datetime("2013-11-19T23:49:23.938")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.3.query.aql
new file mode 100644
index 0000000..776493f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_0/interval_bin_gby_0.3.query.aql
@@ -0,0 +1,11 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+use dataverse test;
+
+for $i in dataset tsdata
+group by $d := interval-bin($i.timestamp, datetime("1990-01-01T00:00:00.000Z"), year-month-duration("P20Y")) with $i 
+order by get-interval-start($d)
+return { "tbin": $d, "count": count($i)}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.1.ddl.aql
new file mode 100644
index 0000000..841d8da
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.1.ddl.aql
@@ -0,0 +1,16 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Schema as closed{
+id: int32,
+timestamp: datetime
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.2.update.aql
new file mode 100644
index 0000000..b1119e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.2.update.aql
@@ -0,0 +1,18 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+use dataverse test;
+ 
+insert into dataset tsdata({"id": 1, "timestamp": datetime("-1987-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 2, "timestamp": datetime("-1987-11-20T00:27:13.432")}) 
+insert into dataset tsdata({"id": 3, "timestamp": datetime("-1987-11-18T18:00:00")}) 
+insert into dataset tsdata({"id": 4, "timestamp": datetime("19871119T234923938")}) 
+insert into dataset tsdata({"id": 5, "timestamp": datetime("1987-11-19T23:58:17.038")}) 
+insert into dataset tsdata({"id": 6, "timestamp": datetime("1987-11-19T23:30:00")}) 
+insert into dataset tsdata({"id": 7, "timestamp": datetime("1987-11-19T23:22:38")}) 
+insert into dataset tsdata({"id": 8, "timestamp": datetime("1988-01-21T17:28:13.900")}) 
+insert into dataset tsdata({"id": 9, "timestamp": datetime("-1987-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 10, "timestamp": datetime("-0987-07-01T09:35:28.039")}) 
+insert into dataset tsdata({"id": 11, "timestamp": datetime("2012-11-19T23:49:23.938")}) 
+insert into dataset tsdata({"id": 12, "timestamp": datetime("2013-11-19T23:49:23.938")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.3.query.aql
new file mode 100644
index 0000000..61a4c5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/interval_bin_gby_1/interval_bin_gby_1.3.query.aql
@@ -0,0 +1,11 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+use dataverse test;
+
+for $i in dataset tsdata
+group by $d := interval-bin(get-time-from-datetime($i.timestamp), time("00:00:00.000Z"), day-time-duration("PT10M")) with $i 
+order by get-interval-start($d)
+return { "tbin": $d, "count": count($i)}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions/time_functions.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions/time_functions.3.query.aql
index d2befcc..09e1aa9 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions/time_functions.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/time_functions/time_functions.3.query.aql
@@ -8,18 +8,18 @@
 let $null2 := get-time-from-datetime(null)
 let $dt2 := datetime("2012-10-11T02:30:23+03:00")
 let $t3 := get-time-from-datetime($dt2)
-let $dr1 := duration("-PT30H")
-let $t4 := add-time-duration($t1, $dr1)
-let $null3 := add-time-duration(null, $dr1)
-let $null4 := add-time-duration($t1, null)
-let $c1 := $t1 = add-time-duration($t4, subtract-time($t1, $t4))
-let $dr2 := duration("PT36M")
-let $t5 := add-time-duration($t2, $dr2)
-let $c2 := $t2 = add-time-duration($t5, subtract-time($t2, $t5))
-let $dr3 := subtract-time($t5, $t2)
-let $dr4 := subtract-time($t4, $t1)
-let $null5 := subtract-time(null, $t1)
-let $null6 := subtract-time($t4, null)
+let $dr1 := day-time-duration("-PT30H")
+let $t4 := $t1 + $dr1
+let $null3 := null + $dr1
+let $null4 := $t1 + null
+let $c1 := $t1 = ($t1 - $t4) + $t4
+let $dr2 := day-time-duration("PT36M")
+let $t5 := $t2 + $dr2
+let $c2 := $t2 = $t5 + ($t2 - $t5)
+let $dr3 := $t5 - $t2
+let $dr4 := $t4 - $t1
+let $null5 := null - $t1
+let $null6 := $t4 - null
 let $ct := current-time()
 let $cd := current-date()
 let $cdt := current-datetime()
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/issue531_string_min_max/issue531_string_min_max.1.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/issue531_string_min_max/issue531_string_min_max.1.adm
new file mode 100644
index 0000000..9f575f1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/issue531_string_min_max/issue531_string_min_max.1.adm
@@ -0,0 +1 @@
+{ "min": "Alex", "max": "Susan" }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_01/unary-minus_double_01.1.adm b/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_01/unary-minus_double_01.1.adm
deleted file mode 100644
index 3a72bb8..0000000
--- a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_double_01/unary-minus_double_01.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "double1": 2.056E-29d, "double2": NaNd, "double3": -Infinityd, "double4": Infinityd }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_01/unary-minus_float_01.1.adm b/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_01/unary-minus_float_01.1.adm
deleted file mode 100644
index e6541ae..0000000
--- a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_float_01/unary-minus_float_01.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "float1": 80.2f, "float2": NaNf, "float3": -Infinityf, "float4": Infinityf }
diff --git a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_int_01/unary-minus_int_01.1.adm b/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_int_01/unary-minus_int_01.1.adm
deleted file mode 100644
index 4ecc59b..0000000
--- a/asterix-app/src/test/resources/runtimets/results/numeric/unary-minus_int_01/unary-minus_int_01.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "int8": -80i8, "int16": -160i16, "int32": -320, "int64": 640i64 }
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin/interval_bin.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin/interval_bin.1.adm
new file mode 100644
index 0000000..3ba93a5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin/interval_bin.1.adm
@@ -0,0 +1 @@
+{ "bin1": interval-date("2010-01-01, 2011-01-01"), "bin2": interval-date("2010-01-01, 2011-01-01"), "bin3": interval-datetime("-1987-07-01T00:00:00.000Z, -1986-01-01T00:00:00.000Z"), "bin4": interval-datetime("-1987-11-19T12:00:00.000Z, -1987-11-20T00:00:00.000Z"), "bin5": interval-time("04:00:00.000Z, 06:00:00.000Z"), "bin6": null, "bin7": null, "bin8": null }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_0/interval_bin_gby_0.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_0/interval_bin_gby_0.1.adm
new file mode 100644
index 0000000..c21626b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_0/interval_bin_gby_0.1.adm
@@ -0,0 +1,4 @@
+{ "tbin": interval-datetime("-1990-01-01T00:00:00.000Z, -1970-01-01T00:00:00.000Z"), "count": 4i64 }
+{ "tbin": interval-datetime("-0990-01-01T00:00:00.000Z, -0970-01-01T00:00:00.000Z"), "count": 1i64 }
+{ "tbin": interval-datetime("1970-01-01T00:00:00.000Z, 1990-01-01T00:00:00.000Z"), "count": 5i64 }
+{ "tbin": interval-datetime("2010-01-01T00:00:00.000Z, 2030-01-01T00:00:00.000Z"), "count": 2i64 }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_1/interval_bin_gby_1.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_1/interval_bin_gby_1.1.adm
new file mode 100644
index 0000000..b67989d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/interval_bin_gby_1/interval_bin_gby_1.1.adm
@@ -0,0 +1,8 @@
+{ "tbin": interval-time("00:20:00.000Z, 00:30:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("09:30:00.000Z, 09:40:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("17:20:00.000Z, 17:30:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("18:00:00.000Z, 18:10:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("23:20:00.000Z, 23:30:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("23:30:00.000Z, 23:40:00.000Z"), "count": 1i64 }
+{ "tbin": interval-time("23:40:00.000Z, 23:50:00.000Z"), "count": 5i64 }
+{ "tbin": interval-time("23:50:00.000Z, 00:00:00.000Z"), "count": 1i64 }
\ 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 5c56084..50948f2 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -15,6 +15,11 @@
 <test-suite xmlns="urn:xml.testframework.asterix.ics.uci.edu" ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
   <test-group name="aggregate">
     <test-case FilePath="aggregate">
+      <compilation-unit name="issue531_string_min_max">
+        <output-dir compare="Text">issue531_string_min_max</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="agg_null">
         <output-dir compare="Text">agg_null</output-dir>
       </compilation-unit>
@@ -2532,31 +2537,16 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
-      <compilation-unit name="unary-minus_double_01">
-        <output-dir compare="Text">unary-minus_double_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="numeric">
       <compilation-unit name="unary-minus_double_02">
         <output-dir compare="Text">unary-minus_double_02</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
-      <compilation-unit name="unary-minus_float_01">
-        <output-dir compare="Text">unary-minus_float_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="numeric">
       <compilation-unit name="unary-minus_float_02">
         <output-dir compare="Text">unary-minus_float_02</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="numeric">
-      <compilation-unit name="unary-minus_int_01">
-        <output-dir compare="Text">unary-minus_int_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="numeric">
       <compilation-unit name="unary-minus_int_02">
         <output-dir compare="Text">unary-minus_int_02</output-dir>
       </compilation-unit>
@@ -4353,6 +4343,21 @@
     </test-case>
   </test-group>
   <test-group name="temporal">
+  <test-case FilePath="temporal">
+     <compilation-unit name="interval_bin">
+        <output-dir compare="Text">interval_bin</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="temporal">
+     <compilation-unit name="interval_bin_gby_0">
+        <output-dir compare="Text">interval_bin_gby_0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="temporal">
+     <compilation-unit name="interval_bin_gby_1">
+        <output-dir compare="Text">interval_bin_gby_1</output-dir>
+      </compilation-unit>
+    </test-case>
     <test-case FilePath="temporal">
   	  <compilation-unit name="accessors">
         <output-dir compare="Text">accessors</output-dir>
diff --git a/asterix-installer/ittest/asterix-lifecycle_backupRestore.adm b/asterix-installer/ittest/asterix-lifecycle_backupRestore.adm
new file mode 100644
index 0000000..7ab7c16
--- /dev/null
+++ b/asterix-installer/ittest/asterix-lifecycle_backupRestore.adm
@@ -0,0 +1 @@
+{ "DataverseName": "backupDataverse", "DataFormat": "edu.uci.ics.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Mon Jul 01 12:16:23 PDT 2013", "PendingOp": 0 }
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 486f271..379f99f 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
@@ -101,7 +101,7 @@
                 return ADurationSerializerDeserializer.INSTANCE.deserialize(in);
             }
             case YEARMONTHDURATION: {
-                return AYearMonthDurationerializerDeserializer.INSTANCE.deserialize(in);
+                return AYearMonthDurationSerializerDeserializer.INSTANCE.deserialize(in);
             }
             case DAYTIMEDURATION: {
                 return ADayTimeDurationSerializerDeserializer.INSTNACE.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/AYearMonthDurationSerializerDeserializer.java
similarity index 92%
rename from asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AYearMonthDurationerializerDeserializer.java
rename to asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AYearMonthDurationSerializerDeserializer.java
index 79bf3c0..e0e1259 100644
--- 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/AYearMonthDurationSerializerDeserializer.java
@@ -27,11 +27,11 @@
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
-public class AYearMonthDurationerializerDeserializer implements ISerializerDeserializer<AYearMonthDuration> {
+public class AYearMonthDurationSerializerDeserializer implements ISerializerDeserializer<AYearMonthDuration> {
 
     private static final long serialVersionUID = 1L;
 
-    public static final AYearMonthDurationerializerDeserializer INSTANCE = new AYearMonthDurationerializerDeserializer();
+    public static final AYearMonthDurationSerializerDeserializer INSTANCE = new AYearMonthDurationSerializerDeserializer();
 
     @SuppressWarnings("unchecked")
     private static final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde = AqlSerializerDeserializerProvider.INSTANCE
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 ff1a14c..cfc1004 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
@@ -44,7 +44,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.AYearMonthDurationSerializerDeserializer;
 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;
@@ -129,7 +129,7 @@
                 return ADurationSerializerDeserializer.INSTANCE;
             }
             case YEARMONTHDURATION: {
-                return AYearMonthDurationerializerDeserializer.INSTANCE;
+                return AYearMonthDurationSerializerDeserializer.INSTANCE;
             }
             case DAYTIMEDURATION: {
                 return ADayTimeDurationSerializerDeserializer.INSTNACE;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/DurationArithmeticOperations.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/DurationArithmeticOperations.java
index e9271e5..193592d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/DurationArithmeticOperations.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/DurationArithmeticOperations.java
@@ -26,9 +26,7 @@
      * <a
      * href="http://www.w3.org/TR/xmlschema-2/#adding-durations-to-dateTimes">"XML: adding durations to dateTimes"</a>.
      * <p/>
-     * The basic algorithm is like this: duration is applied to the time point as two separated fields: year-month field
-     * and day-time field. Year-month field is applied firstly by reserving the correct day within the month's range
-     * (for example add 1M to 03-31 will return 04-30). Then day-time field is applied.
+     * The basic algorithm is like this: duration is applied to the time point as two separated fields: year-month field and day-time field. Year-month field is applied firstly by reserving the correct day within the month's range (for example add 1M to 03-31 will return 04-30). Then day-time field is applied.
      * <p/>
      * 
      * @param pointChronon
@@ -36,7 +34,16 @@
      * @param dayTimeDuration
      * @return
      */
-    public static long addDuration(long pointChronon, int yearMonthDuration, long dayTimeDuration) {
+    public static long addDuration(long pointChronon, int yearMonthDuration, long dayTimeDuration, boolean isTimeOnly) {
+
+        if (isTimeOnly) {
+            int rtnChronon = (int) ((pointChronon + dayTimeDuration) % GregorianCalendarSystem.CHRONON_OF_DAY);
+            if (rtnChronon < 0) {
+                rtnChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
+            }
+
+            return rtnChronon;
+        }
 
         int year = calSystem.getYear(pointChronon);
         int month = calSystem.getMonthOfYear(pointChronon, year);
@@ -75,13 +82,4 @@
         return calSystem.getChronon(year, month, day, hour, min, sec, ms, 0) + dayTimeDuration;
     }
 
-    public static int addDuration(int pointChronon, long dayTimeDuration) {
-        int rtnChronon = (int) ((pointChronon + dayTimeDuration) % GregorianCalendarSystem.CHRONON_OF_DAY);
-        if (rtnChronon < 0) {
-            rtnChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
-        }
-
-        return rtnChronon;
-    }
-
 }
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 4728f162..7734d57 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
@@ -54,10 +54,11 @@
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedFieldAccessByNameResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedGetItemResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedLocalAvgTypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedMinMaxAggTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedNumericAddSubMulDivTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedNumericRoundHalfToEven2TypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedNumericUnaryFunctionTypeComputer;
-import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedSumTypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedNumericAggTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedSwitchCaseComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedUnaryMinusTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NotNullTypeComputer;
@@ -193,8 +194,7 @@
             "numeric-idiv", 2);
     public final static FunctionIdentifier CARET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "caret", 2);
 
-    public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "abs", 1);
+    public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "abs", 1);
     public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "ceiling", 1);
     public final static FunctionIdentifier NUMERIC_FLOOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -423,7 +423,8 @@
             "interval-overlaps", 2);
     public final static FunctionIdentifier INTERVAL_OVERLAPPED_BY = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "interval-overlapped-by", 2);
-    public final static FunctionIdentifier OVERLAP = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval-overlapping", 2);
+    public final static FunctionIdentifier OVERLAP = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "interval-overlapping", 2);
     public final static FunctionIdentifier INTERVAL_STARTS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "interval-starts", 2);
     public final static FunctionIdentifier INTERVAL_STARTED_BY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -517,32 +518,22 @@
             FunctionConstants.ASTERIX_NS, "get-interval-start", 1);
     public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_END = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "get-interval-end", 1);
+    public static final FunctionIdentifier INTERVAL_BIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "interval-bin", 3);
 
     // Temporal functions
     public static final FunctionIdentifier DATE_FROM_UNIX_TIME_IN_DAYS = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "date-from-unix-time-in-days", 1);
     public static final FunctionIdentifier DATE_FROM_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "get-date-from-datetime", 1);
-    public final static FunctionIdentifier ADD_DATE_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "add-date-duration", 2);
-    public final static FunctionIdentifier SUBTRACT_DATE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "subtract-date", 2);
     public final static FunctionIdentifier TIME_FROM_UNIX_TIME_IN_MS = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "time-from-unix-time-in-ms", 1);
     public final static FunctionIdentifier TIME_FROM_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "get-time-from-datetime", 1);
-    public final static FunctionIdentifier SUBTRACT_TIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "subtract-time", 2);
-    public final static FunctionIdentifier ADD_TIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "add-time-duration", 2);
     public final static FunctionIdentifier DATETIME_FROM_UNIX_TIME_IN_MS = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "datetime-from-unix-time-in-ms", 1);
     public final static FunctionIdentifier DATETIME_FROM_DATE_TIME = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "datetime-from-date-time", 2);
-    public final static FunctionIdentifier SUBTRACT_DATETIME = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "subtract-datetime", 2);
-    public final static FunctionIdentifier ADD_DATETIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "add-datetime-duration", 2);
     public final static FunctionIdentifier CALENDAR_DURATION_FROM_DATETIME = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "calendar-duration-from-datetime", 2);
     public final static FunctionIdentifier CALENDAR_DURATION_FROM_DATE = new FunctionIdentifier(
@@ -611,20 +602,20 @@
         // and then, Asterix builtin functions
         addPrivateFunction(NOT_NULL, NotNullTypeComputer.INSTANCE);
         addPrivateFunction(ANY_COLLECTION_MEMBER, NonTaggedCollectionMemberResultType.INSTANCE);
-        addPrivateFunction(AVG, OptionalADoubleTypeComputer.INSTANCE);
+        addFunction(AVG, OptionalADoubleTypeComputer.INSTANCE);
         addFunction(BOOLEAN_CONSTRUCTOR, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE);
-        addFunction(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+        addPrivateFunction(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
         addFunction(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE);
         addPrivateFunction(CLOSED_RECORD_CONSTRUCTOR, ClosedRecordConstructorResultType.INSTANCE);
         addPrivateFunction(CONCAT_NON_NULL, ConcatNonNullTypeComputer.INSTANCE);
 
         addFunction(CONTAINS, ABooleanTypeComputer.INSTANCE);
-        addPrivateFunction(COUNT, AInt64TypeComputer.INSTANCE);
-        addFunction(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+        addFunction(COUNT, AInt64TypeComputer.INSTANCE);
+        addPrivateFunction(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
         addPrivateFunction(COUNTHASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
         addFunction(CREATE_CIRCLE, ACircleTypeComputer.INSTANCE);
         addFunction(CREATE_LINE, ALineTypeComputer.INSTANCE);
-        addFunction(CREATE_MBR, ADoubleTypeComputer.INSTANCE);
+        addPrivateFunction(CREATE_MBR, ADoubleTypeComputer.INSTANCE);
         addFunction(CREATE_POINT, APointTypeComputer.INSTANCE);
         addFunction(CREATE_POLYGON, APolygonTypeComputer.INSTANCE);
         addFunction(CREATE_RECTANGLE, ARectangleTypeComputer.INSTANCE);
@@ -659,7 +650,7 @@
         addPrivateFunction(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
         addPrivateFunction(GRAM_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE);
         addFunction(GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
-        addFunction(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
+        addPrivateFunction(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
         addPrivateFunction(HASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE);
         addPrivateFunction(INDEX_SEARCH, new IResultTypeComputer() {
 
@@ -680,18 +671,18 @@
         addPrivateFunction(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
         addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, null); // TODO
         addPrivateFunction(MAKE_FIELD_NAME_HANDLE, null); // TODO
-        addPrivateFunction(MAX, NonTaggedSumTypeComputer.INSTANCE);
-        addPrivateFunction(LOCAL_MAX, NonTaggedSumTypeComputer.INSTANCE);
-        addPrivateFunction(MIN, NonTaggedSumTypeComputer.INSTANCE);
-        addPrivateFunction(LOCAL_MIN, NonTaggedSumTypeComputer.INSTANCE);
+        addFunction(MAX, NonTaggedMinMaxAggTypeComputer.INSTANCE);
+        addPrivateFunction(LOCAL_MAX, NonTaggedMinMaxAggTypeComputer.INSTANCE);
+        addFunction(MIN, NonTaggedMinMaxAggTypeComputer.INSTANCE);
+        addPrivateFunction(LOCAL_MIN, NonTaggedMinMaxAggTypeComputer.INSTANCE);
         addPrivateFunction(NON_EMPTY_STREAM, ABooleanTypeComputer.INSTANCE);
         addFunction(NULL_CONSTRUCTOR, ANullTypeComputer.INSTANCE);
-        addFunction(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE);
-        addFunction(NUMERIC_SUBTRACT, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
-        addFunction(NUMERIC_MULTIPLY, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
-        addFunction(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
-        addFunction(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
-        addFunction(NUMERIC_IDIV, AInt32TypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_SUBTRACT, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_MULTIPLY, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
+        addPrivateFunction(NUMERIC_IDIV, AInt32TypeComputer.INSTANCE);
 
         addFunction(NUMERIC_ABS, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         addFunction(NUMERIC_CEILING, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
@@ -725,7 +716,7 @@
         addPrivateFunction(PREFIX_LEN_JACCARD, AInt32TypeComputer.INSTANCE);
         addFunction(RANGE, AInt32TypeComputer.INSTANCE);
         addFunction(RECTANGLE_CONSTRUCTOR, OptionalARectangleTypeComputer.INSTANCE);
-        // add(RECORD_TYPE_CONSTRUCTOR, null);
+        // addPrivateFunction(RECORD_TYPE_CONSTRUCTOR, null); TODO
 
         addFunction(SCALAR_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
         addFunction(SCALAR_COUNT, AInt64TypeComputer.INSTANCE);
@@ -739,8 +730,8 @@
         addPrivateFunction(SERIAL_COUNT, AInt64TypeComputer.INSTANCE);
         addPrivateFunction(SERIAL_GLOBAL_AVG, OptionalADoubleTypeComputer.INSTANCE);
         addPrivateFunction(SERIAL_LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE);
-        addPrivateFunction(SERIAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
-        addPrivateFunction(SERIAL_LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
+        addPrivateFunction(SERIAL_SUM, NonTaggedNumericAggTypeComputer.INSTANCE);
+        addPrivateFunction(SERIAL_LOCAL_SUM, NonTaggedNumericAggTypeComputer.INSTANCE);
         addFunction(SIMILARITY_JACCARD, AFloatTypeComputer.INSTANCE);
         addFunction(SIMILARITY_JACCARD_CHECK, OrderedListOfAnyTypeComputer.INSTANCE);
         addPrivateFunction(SIMILARITY_JACCARD_SORTED, AFloatTypeComputer.INSTANCE);
@@ -796,8 +787,8 @@
             }
         });
         addFunction(SUBSTRING, SubstringTypeComputer.INSTANCE);
-        addPrivateFunction(SUM, NonTaggedSumTypeComputer.INSTANCE);
-        addPrivateFunction(LOCAL_SUM, NonTaggedSumTypeComputer.INSTANCE);
+        addFunction(SUM, NonTaggedNumericAggTypeComputer.INSTANCE);
+        addPrivateFunction(LOCAL_SUM, NonTaggedNumericAggTypeComputer.INSTANCE);
         addFunction(SWITCH_CASE, NonTaggedSwitchCaseComputer.INSTANCE);
         addPrivateFunction(REG_EXP, ABooleanTypeComputer.INSTANCE);
         addFunction(INJECT_FAILURE, InjectFailureTypeComputer.INSTANCE);
@@ -806,7 +797,7 @@
 
         addFunction(TID, AInt32TypeComputer.INSTANCE);
         addFunction(TIME_CONSTRUCTOR, OptionalATimeTypeComputer.INSTANCE);
-        addFunction(TYPE_OF, null); // TODO
+        addPrivateFunction(TYPE_OF, null); // TODO
         addPrivateFunction(UNORDERED_LIST_CONSTRUCTOR, UnorderedListConstructorResultType.INSTANCE);
         addFunction(WORD_TOKENS, new IResultTypeComputer() {
 
@@ -831,16 +822,10 @@
         // temporal functions
         addFunction(DATE_FROM_UNIX_TIME_IN_DAYS, OptionalADateTypeComputer.INSTANCE);
         addFunction(DATE_FROM_DATETIME, OptionalADateTypeComputer.INSTANCE);
-        addFunction(ADD_DATE_DURATION, OptionalADateTypeComputer.INSTANCE);
-        addFunction(SUBTRACT_DATE, OptionalADurationTypeComputer.INSTANCE);
         addFunction(TIME_FROM_UNIX_TIME_IN_MS, OptionalATimeTypeComputer.INSTANCE);
         addFunction(TIME_FROM_DATETIME, OptionalATimeTypeComputer.INSTANCE);
-        addFunction(SUBTRACT_TIME, OptionalADurationTypeComputer.INSTANCE);
-        addFunction(ADD_TIME_DURATION, OptionalATimeTypeComputer.INSTANCE);
         addFunction(DATETIME_FROM_DATE_TIME, OptionalADateTimeTypeComputer.INSTANCE);
         addFunction(DATETIME_FROM_UNIX_TIME_IN_MS, OptionalADateTimeTypeComputer.INSTANCE);
-        addFunction(SUBTRACT_DATETIME, OptionalADurationTypeComputer.INSTANCE);
-        addFunction(ADD_DATETIME_DURATION, OptionalADateTimeTypeComputer.INSTANCE);
         addFunction(CALENDAR_DURATION_FROM_DATETIME, OptionalADurationTypeComputer.INSTANCE);
         addFunction(CALENDAR_DURATION_FROM_DATE, OptionalADurationTypeComputer.INSTANCE);
         addFunction(ADJUST_DATETIME_FOR_TIMEZONE, OptionalAStringTypeComputer.INSTANCE);
@@ -872,6 +857,7 @@
         addFunction(MILLISECONDS_FROM_DAY_TIME_DURATION, OptionalAInt64TypeComputer.INSTANCE);
         addFunction(GET_DAY_TIME_DURATION, OptionalADayTimeDurationTypeComputer.INSTANCE);
         addFunction(GET_YEAR_MONTH_DURATION, OptionalAYearMonthDurationTypeComputer.INSTANCE);
+        addFunction(INTERVAL_BIN, OptionalAIntervalTypeComputer.INSTANCE);
 
         // interval constructors
         addFunction(INTERVAL_CONSTRUCTOR_DATE, OptionalAIntervalTypeComputer.INSTANCE);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
similarity index 88%
copy from asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java
copy to asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
index 2437da4..a6c39b6 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
@@ -30,13 +30,12 @@
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
 
-public class NonTaggedSumTypeComputer implements IResultTypeComputer {
+public class NonTaggedMinMaxAggTypeComputer implements IResultTypeComputer {
+    private static final String errMsg = "Aggregator is not implemented for ";
 
-    private static final String errMsg = "Sum aggregator is not implemented for ";
+    public static final NonTaggedMinMaxAggTypeComputer INSTANCE = new NonTaggedMinMaxAggTypeComputer();
 
-    public static final NonTaggedSumTypeComputer INSTANCE = new NonTaggedSumTypeComputer();
-
-    private NonTaggedSumTypeComputer() {
+    private NonTaggedMinMaxAggTypeComputer() {
     }
 
     @Override
@@ -79,6 +78,9 @@
             case INT8:
                 unionList.add(BuiltinType.AINT8);
                 break;
+            case STRING:
+                unionList.add(BuiltinType.ASTRING);
+                break;
             case ANY:
                 return BuiltinType.ANY;
             default: {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAddSubMulDivTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAddSubMulDivTypeComputer.java
index 6c46f3a..154ce65 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAddSubMulDivTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAddSubMulDivTypeComputer.java
@@ -231,6 +231,111 @@
                     }
                 }
             }
+            case DATE: {
+                switch (tag2) {
+                    case DATE:
+                        unionList.add(BuiltinType.ADURATION);
+                        break;
+                    case YEARMONTHDURATION:
+                    case DAYTIMEDURATION:
+                    case DURATION:
+                        unionList.add(BuiltinType.ADATE);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
+            case TIME: {
+                switch (tag2) {
+                    case TIME:
+                        unionList.add(BuiltinType.ADURATION);
+                        break;
+                    case YEARMONTHDURATION:
+                    case DAYTIMEDURATION:
+                    case DURATION:
+                        unionList.add(BuiltinType.ATIME);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
+            case DATETIME: {
+                switch (tag2) {
+                    case DATETIME:
+                        unionList.add(BuiltinType.ADURATION);
+                        break;
+                    case YEARMONTHDURATION:
+                    case DAYTIMEDURATION:
+                    case DURATION:
+                        unionList.add(BuiltinType.ADATETIME);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
+            case DURATION: {
+                switch(tag2){
+                    case DATE:
+                        unionList.add(BuiltinType.ADATE);
+                        break;
+                    case TIME:
+                        unionList.add(BuiltinType.ATIME);
+                        break;
+                    case DATETIME:
+                        unionList.add(BuiltinType.ADATETIME);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
+            case YEARMONTHDURATION: {
+                switch(tag2){
+                    case DATE:
+                        unionList.add(BuiltinType.ADATE);
+                        break;
+                    case TIME:
+                        unionList.add(BuiltinType.ATIME);
+                        break;
+                    case DATETIME:
+                        unionList.add(BuiltinType.ADATETIME);
+                        break;
+                    case YEARMONTHDURATION:
+                        unionList.add(BuiltinType.AYEARMONTHDURATION);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
+            case DAYTIMEDURATION: {
+                switch(tag2){
+                    case DATE:
+                        unionList.add(BuiltinType.ADATE);
+                        break;
+                    case TIME:
+                        unionList.add(BuiltinType.ATIME);
+                        break;
+                    case DATETIME:
+                        unionList.add(BuiltinType.ADATETIME);
+                        break;
+                    case DAYTIMEDURATION:
+                        unionList.add(BuiltinType.ADAYTIMEDURATION);
+                        break;
+                    default: {
+                        throw new NotImplementedException(errMsg + tag2);
+                    }
+                }
+                break;
+            }
             default: {
                 throw new NotImplementedException(errMsg + tag1);
             }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAggTypeComputer.java
similarity index 91%
rename from asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java
rename to asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAggTypeComputer.java
index 2437da4..7582785 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedSumTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedNumericAggTypeComputer.java
@@ -30,13 +30,13 @@
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
 
-public class NonTaggedSumTypeComputer implements IResultTypeComputer {
+public class NonTaggedNumericAggTypeComputer implements IResultTypeComputer {
 
-    private static final String errMsg = "Sum aggregator is not implemented for ";
+    private static final String errMsg = "Aggregator is not implemented for ";
 
-    public static final NonTaggedSumTypeComputer INSTANCE = new NonTaggedSumTypeComputer();
+    public static final NonTaggedNumericAggTypeComputer INSTANCE = new NonTaggedNumericAggTypeComputer();
 
-    private NonTaggedSumTypeComputer() {
+    private NonTaggedNumericAggTypeComputer() {
     }
 
     @Override
diff --git a/asterix-runtime/pom.xml b/asterix-runtime/pom.xml
index 4a3ece9..3d76f92 100644
--- a/asterix-runtime/pom.xml
+++ b/asterix-runtime/pom.xml
@@ -90,7 +90,7 @@
 											lexer-generator-maven-plugin
 										</artifactId>
 										<versionRange>
-											[0.1,)
+											[0.0,0)
 										</versionRange>
 										<goals>
 											<goal>generate-lexer</goal>
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 eb33cc4..9b17c90 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
@@ -122,7 +122,7 @@
                             if (argOut1.getByteArray()[0] == SER_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1),
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1));
+                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // duration
                                 int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
@@ -131,7 +131,7 @@
                                 ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
                                         aDuration, ADurationParseOption.All);
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        aDuration.getMonths(), aDuration.getMilliseconds());
+                                        aDuration.getMonths(), aDuration.getMilliseconds(), false);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DURATION for the second argument, but got "
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 f7b4cdd..ce4681a 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
@@ -134,7 +134,7 @@
                             if (argOut1.getByteArray()[0] == SER_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1),
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1));
+                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
 
                                 // duration
@@ -145,7 +145,7 @@
                                         aDuration, ADurationParseOption.All);
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        aDuration.getMonths(), aDuration.getMilliseconds());
+                                        aDuration.getMonths(), aDuration.getMilliseconds(), false);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DURATION for the second argument but got "
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 3f8e5a8..d4168e1 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
@@ -130,7 +130,7 @@
                                 }
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1));
+                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
 
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // duration
@@ -147,7 +147,7 @@
                                 }
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        aDuration.getMilliseconds());
+                                        aDuration.getMilliseconds(), false);
                             } else {
                                 throw new AlgebricksException("Wrong format for interval constructor from dates.");
                             }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
index 379b934..84b9a32 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
@@ -16,20 +16,31 @@
 
 import java.io.DataOutput;
 
+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;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.AMutableDate;
+import edu.uci.ics.asterix.om.base.AMutableDateTime;
 import edu.uci.ics.asterix.om.base.AMutableDouble;
+import edu.uci.ics.asterix.om.base.AMutableDuration;
 import edu.uci.ics.asterix.om.base.AMutableFloat;
 import edu.uci.ics.asterix.om.base.AMutableInt16;
 import edu.uci.ics.asterix.om.base.AMutableInt32;
 import edu.uci.ics.asterix.om.base.AMutableInt64;
 import edu.uci.ics.asterix.om.base.AMutableInt8;
+import edu.uci.ics.asterix.om.base.AMutableTime;
 import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -51,6 +62,29 @@
 
     abstract protected double evaluateDouble(double lhs, double rhs) throws HyracksDataException;
 
+    /**
+     * abstract method for arithmetic operation between a time instance (date/time/datetime)
+     * and a duration (duration/year-month-duration/day-time-duration)
+     * 
+     * @param chronon
+     * @param yearMonth
+     * @param dayTime
+     * @return
+     * @throws HyracksDataException
+     */
+    abstract protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException;
+
+    /**
+     * abstract method for arithmetic operation between two time instances (date/time/datetime)
+     * 
+     * @param chronon0
+     * @param chronon1
+     * @return
+     * @throws HyracksDataException
+     */
+    abstract protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException;
+
     @Override
     public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
@@ -62,9 +96,10 @@
                 return new ICopyEvaluator() {
                     private DataOutput out = output.getDataOutput();
                     // one temp. buffer re-used by both children
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
+                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
+                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
+                    private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut0);
+                    private ICopyEvaluator evalRight = args[1].createEvaluator(argOut1);
                     private double[] operandsFloating = new double[args.length];
                     private long[] operandsInteger = new long[args.length];
                     private int resultType;
@@ -81,6 +116,12 @@
                     protected AMutableInt32 aInt32 = new AMutableInt32(0);
                     protected AMutableInt16 aInt16 = new AMutableInt16((short) 0);
                     protected AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
+
+                    protected AMutableDuration aDuration = new AMutableDuration(0, 0);
+                    protected AMutableDate aDate = new AMutableDate(0);
+                    protected AMutableTime aTime = new AMutableTime(0);
+                    protected AMutableDateTime aDatetime = new AMutableDateTime(0);
+
                     private ATypeTag typeTag;
                     @SuppressWarnings("rawtypes")
                     private ISerializerDeserializer serde;
@@ -93,11 +134,16 @@
                             resultType = 0;
                             int currentType = 0;
                             for (int i = 0; i < args.length; i++) {
-                                argOut.reset();
-                                if (i == 0)
+                                ArrayBackedValueStorage argOut;
+                                if (i == 0) {
+                                    argOut0.reset();
                                     evalLeft.evaluate(tuple);
-                                else
+                                    argOut = argOut0;
+                                } else {
+                                    argOut1.reset();
                                     evalRight.evaluate(tuple);
+                                    argOut = argOut1;
+                                }
                                 typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
                                 switch (typeTag) {
                                     case INT8: {
@@ -144,6 +190,14 @@
                                                 argOut.getByteArray(), 1);
                                         break;
                                     }
+                                    case DATE:
+                                    case TIME:
+                                    case DATETIME:
+                                    case DURATION:
+                                    case YEARMONTHDURATION:
+                                    case DAYTIMEDURATION:
+                                        evaluateTemporalArthmeticOperation(typeTag, tuple);
+                                        return;
                                     case NULL: {
                                         serde = AqlSerializerDeserializerProvider.INSTANCE
                                                 .getSerializerDeserializer(BuiltinType.ANULL);
@@ -237,9 +291,236 @@
                             throw new AlgebricksException(hde);
                         }
                     }
+
+                    @SuppressWarnings("unchecked")
+                    private void evaluateTemporalArthmeticOperation(ATypeTag leftType, IFrameTupleReference tuple)
+                            throws HyracksDataException, AlgebricksException {
+                        argOut1.reset();
+                        evalRight.evaluate(tuple);
+                        ATypeTag rightType = EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(argOut1.getByteArray()[0]);
+
+                        if (leftType == ATypeTag.NULL || rightType == ATypeTag.NULL) {
+                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                    .getSerializerDeserializer(BuiltinType.ANULL);
+                            serde.serialize(ANull.NULL, out);
+                            return;
+                        }
+
+                        if (rightType == leftType) {
+
+                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                    .getSerializerDeserializer(BuiltinType.ADURATION);
+
+                            long leftChronon = 0, rightChronon = 0, dayTime = 0;
+
+                            int yearMonth = 0;
+
+                            switch (leftType) {
+                                case DATE:
+                                    leftChronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                            * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                    rightChronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                            * GregorianCalendarSystem.CHRONON_OF_DAY;
+
+                                    break;
+                                case TIME:
+                                    leftChronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                    rightChronon = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                    break;
+                                case DATETIME:
+                                    leftChronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                    rightChronon = ADateTimeSerializerDeserializer
+                                            .getChronon(argOut1.getByteArray(), 1);
+                                    break;
+                                case YEARMONTHDURATION:
+                                    yearMonth = (int) evaluateTimeInstanceArithmetic(
+                                            AYearMonthDurationSerializerDeserializer.getYearMonth(
+                                                    argOut0.getByteArray(), 1),
+                                            AYearMonthDurationSerializerDeserializer.getYearMonth(
+                                                    argOut1.getByteArray(), 1));
+                                    break;
+                                case DAYTIMEDURATION:
+                                    leftChronon = ADayTimeDurationSerializerDeserializer.getDayTime(
+                                            argOut0.getByteArray(), 1);
+                                    rightChronon = ADayTimeDurationSerializerDeserializer.getDayTime(
+                                            argOut1.getByteArray(), 1);
+                                    break;
+                                default:
+                                    throw new NotImplementedException();
+                            }
+
+                            dayTime = evaluateTimeInstanceArithmetic(leftChronon, rightChronon);
+
+                            aDuration.setValue(yearMonth, dayTime);
+
+                            serde.serialize(aDuration, out);
+
+                        } else {
+                            long chronon = 0, dayTime = 0;
+                            int yearMonth = 0;
+                            ATypeTag resultType = null;
+
+                            boolean isTimeOnly = false;
+
+                            switch (leftType) {
+                                case TIME:
+                                    serde = AqlSerializerDeserializerProvider.INSTANCE
+                                            .getSerializerDeserializer(BuiltinType.ATIME);
+                                    chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                    isTimeOnly = true;
+                                    resultType = ATypeTag.TIME;
+                                    switch (rightType) {
+                                        case DAYTIMEDURATION:
+                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        case DURATION:
+                                            dayTime = ADurationSerializerDeserializer.getDayTime(
+                                                    argOut1.getByteArray(), 1);
+                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        default:
+                                            throw new NotImplementedException(getIdentifier().getName()
+                                                    + ": arithmetic operation between " + leftType + " and a "
+                                                    + rightType + " value is not supported.");
+                                    }
+                                    break;
+                                case DATE:
+                                    serde = AqlSerializerDeserializerProvider.INSTANCE
+                                            .getSerializerDeserializer(BuiltinType.ADATE);
+                                    resultType = ATypeTag.DATE;
+                                    chronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                            * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                case DATETIME:
+                                    if (leftType == ATypeTag.DATETIME) {
+                                        serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                .getSerializerDeserializer(BuiltinType.ADATETIME);
+                                        resultType = ATypeTag.DATETIME;
+                                        chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                    }
+                                    switch (rightType) {
+                                        case DURATION:
+                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(
+                                                    argOut1.getByteArray(), 1);
+                                            dayTime = ADurationSerializerDeserializer.getDayTime(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        case YEARMONTHDURATION:
+                                            yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        case DAYTIMEDURATION:
+                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        default:
+                                            throw new NotImplementedException(getIdentifier().getName()
+                                                    + ": arithmetic operation between " + leftType + " and a "
+                                                    + rightType + " value is not supported.");
+                                    }
+                                    break;
+                                case YEARMONTHDURATION:
+                                    yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(
+                                            argOut0.getByteArray(), 1);
+                                    switch (rightType) {
+                                        case DATETIME:
+                                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                    .getSerializerDeserializer(BuiltinType.ADATETIME);
+                                            resultType = ATypeTag.DATETIME;
+                                            chronon = ADateTimeSerializerDeserializer.getChronon(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        case DATE:
+                                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                    .getSerializerDeserializer(BuiltinType.ADATE);
+                                            resultType = ATypeTag.DATE;
+                                            chronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                                    * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                            break;
+                                        default:
+                                            throw new NotImplementedException(getIdentifier().getName()
+                                                    + ": arithmetic operation between " + leftType + " and a "
+                                                    + rightType + " value is not supported.");
+                                    }
+                                    break;
+                                case DURATION:
+                                    yearMonth = ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1);
+                                    dayTime = ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1);
+                                case DAYTIMEDURATION:
+                                    if (leftType == ATypeTag.DAYTIMEDURATION) {
+                                        dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
+                                                argOut0.getByteArray(), 1);
+                                    }
+                                    switch (rightType) {
+                                        case DATETIME:
+                                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                    .getSerializerDeserializer(BuiltinType.ADATETIME);
+                                            resultType = ATypeTag.DATETIME;
+                                            chronon = ADateTimeSerializerDeserializer.getChronon(
+                                                    argOut1.getByteArray(), 1);
+                                            break;
+                                        case DATE:
+                                            serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                    .getSerializerDeserializer(BuiltinType.ADATE);
+                                            resultType = ATypeTag.DATE;
+                                            chronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                                    * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                            break;
+                                        case TIME:
+                                            if (yearMonth == 0) {
+                                                serde = AqlSerializerDeserializerProvider.INSTANCE
+                                                        .getSerializerDeserializer(BuiltinType.ATIME);
+                                                resultType = ATypeTag.TIME;
+                                                chronon = ATimeSerializerDeserializer.getChronon(
+                                                        argOut1.getByteArray(), 1);
+                                                isTimeOnly = true;
+                                                break;
+                                            }
+                                        default:
+                                            throw new NotImplementedException(getIdentifier().getName()
+                                                    + ": arithmetic operation between " + leftType + " and a "
+                                                    + rightType + " value is not supported.");
+                                    }
+                                    break;
+                                default:
+                                    throw new NotImplementedException(getIdentifier().getName()
+                                            + ": arithmetic operation between " + leftType + " and a " + rightType
+                                            + " value is not supported.");
+                            }
+
+                            chronon = evaluateTimeDurationArithmetic(chronon, yearMonth, dayTime, isTimeOnly);
+
+                            switch (resultType) {
+                                case DATE:
+
+                                    if (chronon < 0 && chronon % GregorianCalendarSystem.CHRONON_OF_DAY != 0) {
+                                        chronon = chronon / GregorianCalendarSystem.CHRONON_OF_DAY - 1;
+                                    } else {
+                                        chronon = chronon / GregorianCalendarSystem.CHRONON_OF_DAY;
+                                    }
+                                    aDate.setValue((int) chronon);
+                                    serde.serialize(aDate, out);
+                                    break;
+                                case TIME:
+                                    aTime.setValue((int) chronon);
+                                    serde.serialize(aTime, out);
+                                    break;
+                                case DATETIME:
+                                    aDatetime.setValue(chronon);
+                                    serde.serialize(aDatetime, out);
+                                    break;
+                                default:
+                                    throw new NotImplementedException(getIdentifier().getName()
+                                            + ": arithmetic operation between " + leftType + " and a " + rightType
+                                            + " value is not supported.");
+
+                            }
+                        }
+                    }
                 };
             }
         };
     }
-
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
index bb63d27..7cd96fa 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericAddDescriptor.java
@@ -14,6 +14,7 @@
  */
 package edu.uci.ics.asterix.runtime.evaluators.functions;
 
+import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -49,4 +50,15 @@
     protected double evaluateDouble(double lhs, double rhs) throws HyracksDataException {
         return lhs + rhs;
     }
+
+    @Override
+    protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException {
+        return DurationArithmeticOperations.addDuration(chronon, yearMonth, dayTime, isTimeOnly);
+    }
+
+    @Override
+    protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException {
+        throw new HyracksDataException("Undefined addition operation between two time instances.");
+    }
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java
index 208c454..502c013 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericCaretDescriptor.java
@@ -17,6 +17,7 @@
 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.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
@@ -61,4 +62,15 @@
         return AsterixBuiltinFunctions.CARET;
     }
 
+    @Override
+    protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException {
+        throw new NotImplementedException("Caret operation is not defined for temporal types");
+    }
+
+    @Override
+    protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException {
+        throw new NotImplementedException("Caret operation is not defined for temporal types");
+    }
+
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
index 9b3b0e9..069007c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericDivideDescriptor.java
@@ -17,6 +17,7 @@
 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.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
@@ -45,4 +46,15 @@
     protected double evaluateDouble(double lhs, double rhs) {
         return lhs / rhs;
     }
+
+    @Override
+    protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException {
+        throw new NotImplementedException("Divide operation is not defined for temporal types");
+    }
+
+    @Override
+    protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException {
+        throw new NotImplementedException("Divide operation is not defined for temporal types");
+    }
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
index a95c693..92f15b4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericMultiplyDescriptor.java
@@ -17,6 +17,7 @@
 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.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
@@ -57,4 +58,15 @@
 
         return lhs * rhs;
     }
+
+    @Override
+    protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException {
+        throw new NotImplementedException("Multiply operation is not defined for temporal types");
+    }
+
+    @Override
+    protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException {
+        throw new NotImplementedException("Multiply operation is not defined for temporal types");
+    }
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubDescriptor.java
new file mode 100644
index 0000000..84c308f
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/NumericSubDescriptor.java
@@ -0,0 +1,77 @@
+/*
+ * 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.functions;
+
+import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
+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.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class NumericSubDescriptor extends AbstractNumericArithmeticEval {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new NumericSubDescriptor();
+        }
+    };
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.NUMERIC_SUBTRACT;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateInteger(long, long)
+     */
+    @Override
+    protected long evaluateInteger(long lhs, long rhs) throws HyracksDataException {
+        long res = lhs - rhs;
+        if (lhs > 0) {
+            if (rhs < 0 && res < 0)
+                throw new HyracksDataException("Overflow adding " + lhs + " + " + rhs);
+        } else if (rhs > 0 && res > 0)
+            throw new HyracksDataException("Underflow adding " + lhs + " + " + rhs);
+        return res;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateDouble(double, double)
+     */
+    @Override
+    protected double evaluateDouble(double lhs, double rhs) throws HyracksDataException {
+        return lhs - rhs;
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateTimeDurationArithmetic(long, int, long, boolean)
+     */
+    @Override
+    protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
+            throws HyracksDataException {
+        return DurationArithmeticOperations.addDuration(chronon, -1 * yearMonth, -1 * dayTime, isTimeOnly);
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.runtime.evaluators.functions.AbstractNumericArithmeticEval#evaluateTimeInstanceArithmetic(long, long)
+     */
+    @Override
+    protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException {
+        return evaluateInteger(chronon0, chronon1);
+    }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java
deleted file mode 100644
index eccee9d..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDateDurationDescriptor.java
+++ /dev/null
@@ -1,148 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
-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.ADate;
-import edu.uci.ics.asterix.om.base.AMutableDate;
-import edu.uci.ics.asterix.om.base.ANull;
-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.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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 AddDateDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_DATE_DURATION;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DATE_TYPE_TAG = ATypeTag.DATE.serialize();
-    private final static byte SER_DURATION_TYPE_TAG = ATypeTag.DURATION.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new AddDateDurationDescriptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADate> dateSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADATE);
-
-                    private AMutableDate aDate = new AMutableDate(0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DATE/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
-                            }
-
-                            if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DURATION/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
-                            }
-
-                            // get duration fields: yearMonth field and dayTime field
-                            int yearMonth = ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1);
-                            long dayTime = ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1);
-
-                            // get date fields
-                            long datetimeChronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
-                                    * GregorianCalendarSystem.CHRONON_OF_DAY;
-
-                            datetimeChronon = DurationArithmeticOperations.addDuration(datetimeChronon, yearMonth,
-                                    dayTime);
-
-                            int dateChrononInDays = (int) (datetimeChronon / GregorianCalendarSystem.CHRONON_OF_DAY);
-                            if (dateChrononInDays < 0 && datetimeChronon % GregorianCalendarSystem.CHRONON_OF_DAY != 0) {
-                                dateChrononInDays -= 1;
-                            }
-
-                            aDate.setValue(dateChrononInDays);
-
-                            dateSerde.serialize(aDate, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java
deleted file mode 100644
index 0037b38..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddDatetimeDurationDescriptor.java
+++ /dev/null
@@ -1,148 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
-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.ADateTime;
-import edu.uci.ics.asterix.om.base.AMutableDateTime;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
-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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 AddDatetimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_DATETIME_DURATION;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DATETIME_TYPE_TAG = ATypeTag.DATETIME.serialize();
-    private final static byte SER_DURATION_TYPE_TAG = ATypeTag.DURATION.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new AddDatetimeDurationDescriptor();
-        }
-    };
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
-     */
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADateTime> datetimeSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADATETIME);
-
-                    private AMutableDateTime aDatetime = new AMutableDateTime(0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DATETIME/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
-                            }
-
-                            if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DURATION/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
-                            }
-
-                            // get duration fields: yearMonth field and dayTime field
-                            int yearMonth = ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1);
-                            long dayTime = ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1);
-
-                            // get date fields
-                            long datetimeChronon = ADateTimeSerializerDeserializer
-                                    .getChronon(argOut0.getByteArray(), 1);
-
-                            datetimeChronon = DurationArithmeticOperations.addDuration(datetimeChronon, yearMonth,
-                                    dayTime);
-
-                            aDatetime.setValue(datetimeChronon);
-
-                            datetimeSerde.serialize(aDatetime, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.om.functions.IFunctionDescriptor#getIdentifier()
-     */
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java
deleted file mode 100644
index ca86379..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/AddTimeDurationDescriptor.java
+++ /dev/null
@@ -1,153 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.AMutableTime;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.base.ATime;
-import edu.uci.ics.asterix.om.base.temporal.DurationArithmeticOperations;
-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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 AddTimeDurationDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.ADD_TIME_DURATION;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_TIME_TYPE_TAG = ATypeTag.TIME.serialize();
-    private final static byte SER_DURATION_TYPE_TAG = ATypeTag.DURATION.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new AddTimeDurationDescriptor();
-        }
-    };
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
-     */
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ATime> timeSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ATIME);
-
-                    private AMutableTime aTime = new AMutableTime(0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type TIME/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
-                            }
-
-                            if (argOut1.getByteArray()[0] != SER_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DURATION/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
-                            }
-
-                            // get duration fields: yearMonth field and dayTime field
-                            int yearMonth = ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1);
-
-                            // cannot add a year-month duration to a time value
-                            if (yearMonth != 0) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": a TIME value cannot be added by a DURATION value with year-month field.");
-                            }
-
-                            long dayTime = ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1);
-
-                            // get time fields
-                            int timeChronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-
-                            timeChronon = DurationArithmeticOperations.addDuration(timeChronon, dayTime);
-
-                            aTime.setValue(timeChronon);
-
-                            timeSerde.serialize(aTime, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.om.functions.IFunctionDescriptor#getIdentifier()
-     */
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
index 9e603ed..9ef3f58 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
@@ -127,7 +127,7 @@
                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
 
                             long endingTimePoint = DurationArithmeticOperations.addDuration(startingTimePoint,
-                                    yearMonthDurationInMonths, dayTimeDurationInMs);
+                                    yearMonthDurationInMonths, dayTimeDurationInMs, false);
 
                             if (startingTimePoint == endingTimePoint) {
                                 aDuration.setValue(0, 0);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
index 10cc1c0..da5f195 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
@@ -141,7 +141,7 @@
                                     1);
 
                             long endingTimePoint = DurationArithmeticOperations.addDuration(startingTimePoint,
-                                    yearMonthDurationInMonths, dayTimeDurationInMs);
+                                    yearMonthDurationInMonths, dayTimeDurationInMs, false);
 
                             if (startingTimePoint == endingTimePoint) {
                                 aDuration.setValue(0, 0);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java
new file mode 100644
index 0000000..98c1d16
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java
@@ -0,0 +1,282 @@
+/*
+ * 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.functions.temporal;
+
+import java.io.DataOutput;
+
+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.ATimeSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.AInterval;
+import edu.uci.ics.asterix.om.base.AMutableInterval;
+import edu.uci.ics.asterix.om.base.ANull;
+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.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.om.types.EnumDeserializer;
+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.api.exceptions.HyracksDataException;
+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 IntervalBinDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new IntervalBinDescriptor();
+        }
+    };
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+        return new ICopyEvaluatorFactory() {
+
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+                return new ICopyEvaluator() {
+
+                    private final DataOutput out = output.getDataOutput();
+
+                    private final ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
+                    private final ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
+                    private final ArrayBackedValueStorage argOut2 = new ArrayBackedValueStorage();
+
+                    private final ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private final ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private final ICopyEvaluator eval2 = args[2].createEvaluator(argOut2);
+
+                    private final AMutableInterval aInterval = new AMutableInterval(0, 0, (byte) -1);
+
+                    @SuppressWarnings("unchecked")
+                    private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.ANULL);
+                    @SuppressWarnings("unchecked")
+                    private final ISerializerDeserializer<AInterval> intervalSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.AINTERVAL);
+
+                    private final GregorianCalendarSystem GREG_CAL = GregorianCalendarSystem.getInstance();
+
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                        argOut0.reset();
+                        eval0.evaluate(tuple);
+
+                        ATypeTag type0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]);
+
+                        long chrononToBin = 0;
+                        switch (type0) {
+                            case DATE:
+                                chrononToBin = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                        * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                break;
+                            case TIME:
+                                chrononToBin = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                break;
+                            case DATETIME:
+                                chrononToBin = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                break;
+                            case NULL:
+                                try {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                } catch (HyracksDataException e) {
+                                    throw new AlgebricksException(e);
+                                }
+                                return;
+                            default:
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": the first argument should be DATE/TIME/DATETIME/NULL but got " + type0);
+
+                        }
+
+                        argOut1.reset();
+                        eval1.evaluate(tuple);
+
+                        ATypeTag type1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]);
+
+                        if (type0 != type1) {
+                            if (type0 != ATypeTag.NULL && type1 != ATypeTag.NULL)
+                                throw new AlgebricksException(getIdentifier().getName() + ": expecting " + type0
+                                        + " for the second argument but got " + type1);
+                        }
+
+                        long chrononToStart = 0;
+                        switch (type1) {
+                            case DATE:
+                                chrononToStart = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                        * GregorianCalendarSystem.CHRONON_OF_DAY;
+                                break;
+                            case TIME:
+                                chrononToStart = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                break;
+                            case DATETIME:
+                                chrononToStart = ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                break;
+                            case NULL:
+                                try {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                } catch (HyracksDataException e) {
+                                    throw new AlgebricksException(e);
+                                }
+                                return;
+                            default:
+                                throw new AlgebricksException(getIdentifier().getName() + ": expecting " + type0
+                                        + " for the second argument but got " + type1);
+                        }
+
+                        argOut2.reset();
+                        eval2.evaluate(tuple);
+
+                        ATypeTag type2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut2.getByteArray()[0]);
+
+                        int yearMonth = 0;
+                        long dayTime = 0;
+                        long binIndex, binStartChronon, binEndChronon;
+                        switch (type2) {
+                            case YEARMONTHDURATION:
+
+                                yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(
+                                        argOut2.getByteArray(), 1);
+
+                                int yearStart = GREG_CAL.getYear(chrononToStart);
+                                int monthStart = GREG_CAL.getMonthOfYear(chrononToStart, yearStart);
+                                int yearToBin = GREG_CAL.getYear(chrononToBin);
+                                int monthToBin = GREG_CAL.getMonthOfYear(chrononToBin, yearToBin);
+
+                                int totalMonths = (yearToBin - yearStart) * 12 + (monthToBin - monthStart);
+
+                                binIndex = totalMonths / yearMonth
+                                        + ((totalMonths < 0 && totalMonths % yearMonth != 0) ? -1 : 0);
+
+                                if (binIndex > Integer.MAX_VALUE) {
+                                    throw new AlgebricksException(getIdentifier().getName()
+                                            + ": Overflowing time value to be binned!");
+                                }
+
+                                if (binIndex < Integer.MIN_VALUE) {
+                                    throw new AlgebricksException(getIdentifier().getName()
+                                            + ": Underflowing time value to be binned!");
+                                }
+
+                                break;
+
+                            case DAYTIMEDURATION:
+                                dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(argOut2.getByteArray(), 1);
+
+                                long totalChronon = chrononToBin - chrononToStart;
+
+                                binIndex = totalChronon / dayTime
+                                        + ((totalChronon < 0 && totalChronon % dayTime != 0) ? -1 : 0);
+
+                                break;
+                            case NULL:
+                                try {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                } catch (HyracksDataException e) {
+                                    throw new AlgebricksException(e);
+                                }
+                                return;
+                            default:
+                                throw new AlgebricksException(
+                                        getIdentifier().getName()
+                                                + ": expecting YEARMONTHDURATION/DAYTIMEDURATION for the thrid argument but got "
+                                                + type2);
+                        }
+
+                        switch (type0) {
+                            case DATE:
+                                binStartChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * (int) binIndex, dayTime * binIndex, false);
+                                binEndChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * ((int) binIndex + 1), dayTime * (binIndex + 1), false);
+
+                                binStartChronon = binStartChronon
+                                        / GregorianCalendarSystem.CHRONON_OF_DAY
+                                        + ((binStartChronon < 0 && binStartChronon
+                                                % GregorianCalendarSystem.CHRONON_OF_DAY != 0) ? -1 : 0);
+                                binEndChronon = binEndChronon
+                                        / GregorianCalendarSystem.CHRONON_OF_DAY
+                                        + ((binEndChronon < 0 && binEndChronon % GregorianCalendarSystem.CHRONON_OF_DAY != 0) ? -1
+                                                : 0);
+                                break;
+                            case TIME:
+                                if (yearMonth != 0) {
+                                    throw new AlgebricksException(getIdentifier().getName()
+                                            + ": cannot create year-month bin for a time value");
+                                }
+                                binStartChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * (int) binIndex, dayTime * binIndex, true);
+                                binEndChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * ((int) binIndex + 1), dayTime * (binIndex + 1), true);
+                                break;
+                            case DATETIME:
+                                binStartChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * (int) binIndex, dayTime * binIndex, false);
+                                binEndChronon = DurationArithmeticOperations.addDuration(chrononToStart, yearMonth
+                                        * ((int) binIndex + 1), dayTime * (binIndex + 1), false);
+                                break;
+                            case NULL:
+                                try {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                } catch (HyracksDataException e) {
+                                    throw new AlgebricksException(e);
+                                }
+                                return;
+                            default:
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": the first argument should be DATE/TIME/DATETIME/NULL but got " + type0);
+
+                        }
+                        aInterval.setValue(binStartChronon, binEndChronon, type0.serialize());
+                        try {
+                            intervalSerde.serialize(aInterval, out);
+                            return;
+                        } catch (HyracksDataException ex) {
+                            throw new AlgebricksException(ex);
+                        }
+
+                    }
+                };
+            }
+
+        };
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor#getIdentifier()
+     */
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.INTERVAL_BIN;
+    }
+
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
index 9a66d45..d2f2b07 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.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.AYearMonthDurationerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.AInt32;
 import edu.uci.ics.asterix.om.base.AMutableInt32;
@@ -96,7 +96,7 @@
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
                             }
 
-                            aInt32.setValue(AYearMonthDurationerializerDeserializer.getYearMonth(
+                            aInt32.setValue(AYearMonthDurationSerializerDeserializer.getYearMonth(
                                     argOut0.getByteArray(), 1));
 
                             int32Serde.serialize(aInt32, out);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java
deleted file mode 100644
index eaaf900..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDateDescriptor.java
+++ /dev/null
@@ -1,130 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ADuration;
-import edu.uci.ics.asterix.om.base.AMutableDuration;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.base.temporal.GregorianCalendarSystem;
-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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 SubtractDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_DATE;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DATE_TYPE_TAG = ATypeTag.DATE.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubtractDateDescriptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADuration> durationSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADURATION);
-
-                    private AMutableDuration aDuration = new AMutableDuration(0, 0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_DATE_TYPE_TAG
-                                    && argOut1.getByteArray()[0] != SER_DATE_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects input type (DATE/NULL, DATE/NULL) but got ("
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
-                                        + ", "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
-                                        + ").");
-                            }
-
-                            long durationChronon = (ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1) - ADateSerializerDeserializer
-                                    .getChronon(argOut1.getByteArray(), 1)) * GregorianCalendarSystem.CHRONON_OF_DAY;
-
-                            aDuration.setValue(0, durationChronon);
-
-                            durationSerde.serialize(aDuration, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java
deleted file mode 100644
index b43892d..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractDatetimeDescriptor.java
+++ /dev/null
@@ -1,136 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ADuration;
-import edu.uci.ics.asterix.om.base.AMutableDuration;
-import edu.uci.ics.asterix.om.base.ANull;
-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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 SubtractDatetimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_DATETIME;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_DATETIME_TYPE_TAG = ATypeTag.DATETIME.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubtractDatetimeDescriptor();
-        }
-    };
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
-     */
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADuration> durationSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADURATION);
-
-                    private AMutableDuration aDuration = new AMutableDuration(0, 0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_DATETIME_TYPE_TAG
-                                    && argOut1.getByteArray()[0] != SER_DATETIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects input type (DATETIME/NULL, DATETIME/NULL) but got ("
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
-                                        + ", "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
-                                        + ").");
-                            }
-
-                            long durationChronon = ADateTimeSerializerDeserializer
-                                    .getChronon(argOut0.getByteArray(), 1)
-                                    - ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
-
-                            aDuration.setValue(0, durationChronon);
-
-                            durationSerde.serialize(aDuration, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.om.functions.IFunctionDescriptor#getIdentifier()
-     */
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java
deleted file mode 100644
index 24edca6..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/temporal/SubtractTimeDescriptor.java
+++ /dev/null
@@ -1,135 +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.runtime.evaluators.functions.temporal;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ADuration;
-import edu.uci.ics.asterix.om.base.AMutableDuration;
-import edu.uci.ics.asterix.om.base.ANull;
-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.om.types.EnumDeserializer;
-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.api.exceptions.HyracksDataException;
-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 SubtractTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private final static long serialVersionUID = 1L;
-    public final static FunctionIdentifier FID = AsterixBuiltinFunctions.SUBTRACT_TIME;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_TIME_TYPE_TAG = ATypeTag.TIME.serialize();
-
-    public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubtractTimeDescriptor();
-        }
-    };
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
-     */
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        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 argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-
-                    // possible output types
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADuration> durationSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADURATION);
-
-                    private AMutableDuration aDuration = new AMutableDuration(0, 0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        try {
-                            if (argOut0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
-                                return;
-                            }
-
-                            if (argOut0.getByteArray()[0] != SER_TIME_TYPE_TAG
-                                    && argOut1.getByteArray()[0] != SER_TIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects input type (TIME/NULL, TIME/NULL) but got ("
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0])
-                                        + ", "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
-                                        + ").");
-                            }
-
-                            int durationChronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
-                                    - ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
-
-                            aDuration.setValue(0, durationChronon);
-
-                            durationSerde.serialize(aDuration, out);
-
-                        } catch (HyracksDataException hex) {
-                            throw new AlgebricksException(hex);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    /* (non-Javadoc)
-     * @see edu.uci.ics.asterix.om.functions.IFunctionDescriptor#getIdentifier()
-     */
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return FID;
-    }
-
-}
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 ecea27a..47555bd 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
@@ -173,6 +173,7 @@
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericRoundDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericRoundHalfToEven2Descriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericRoundHalfToEvenDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.NumericSubDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericSubtractDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericUnaryMinusDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.OpenRecordConstructorDescriptor;
@@ -210,9 +211,6 @@
 import edu.uci.ics.asterix.runtime.evaluators.functions.SwitchCaseDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.UnorderedListConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.WordTokensDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AddDateDurationDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AddDatetimeDurationDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AddTimeDurationDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AdjustDateTimeForTimeZoneDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AdjustTimeForTimeZoneDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.CalendarDuartionFromDateDescriptor;
@@ -232,6 +230,7 @@
 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.IntervalBinDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalCoveredByDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalCoversDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.IntervalEndedByDescriptor;
@@ -245,12 +244,6 @@
 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.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;
-import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.SubtractTimeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.TimeFromDatetimeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.TimeFromUnixTimeInMsDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.YearMonthDurationComparatorDecriptor;
@@ -362,7 +355,7 @@
         temp.add(NumericAddDescriptor.FACTORY);
         temp.add(NumericDivideDescriptor.FACTORY);
         temp.add(NumericMultiplyDescriptor.FACTORY);
-        temp.add(NumericSubtractDescriptor.FACTORY);
+        temp.add(NumericSubDescriptor.FACTORY);
         temp.add(NumericModuloDescriptor.FACTORY);
         temp.add(NumericCaretDescriptor.FACTORY);
         temp.add(IsNullDescriptor.FACTORY);
@@ -510,16 +503,10 @@
         // Temporal functions
         temp.add(DateFromUnixTimeInDaysDescriptor.FACTORY);
         temp.add(DateFromDatetimeDescriptor.FACTORY);
-        temp.add(AddDateDurationDescriptor.FACTORY);
-        temp.add(SubtractDateDescriptor.FACTORY);
         temp.add(TimeFromUnixTimeInMsDescriptor.FACTORY);
         temp.add(TimeFromDatetimeDescriptor.FACTORY);
-        temp.add(SubtractTimeDescriptor.FACTORY);
-        temp.add(AddTimeDurationDescriptor.FACTORY);
         temp.add(DatetimeFromUnixTimeInMsDescriptor.FACTORY);
         temp.add(DatetimeFromDateAndTimeDescriptor.FACTORY);
-        temp.add(SubtractDatetimeDescriptor.FACTORY);
-        temp.add(AddDatetimeDurationDescriptor.FACTORY);
         temp.add(CalendarDurationFromDateTimeDescriptor.FACTORY);
         temp.add(CalendarDuartionFromDateDescriptor.FACTORY);
         temp.add(AdjustDateTimeForTimeZoneDescriptor.FACTORY);
@@ -551,6 +538,7 @@
         temp.add(DurationEqualDescriptor.FACTORY);
         temp.add(GetYearMonthDurationDescriptor.FACTORY);
         temp.add(GetDayTimeDurationDescriptor.FACTORY);
+        temp.add(IntervalBinDescriptor.FACTORY);
 
         // Interval constructor
         temp.add(AIntervalFromDateConstructorDescriptor.FACTORY);
@@ -953,9 +941,9 @@
         return AqlBinaryHashFunctionFamilyProvider.INSTANCE;
     }
 
-	@Override
-	public IPredicateEvaluatorFactoryProvider getPredicateEvaluatorFactoryProvider() {
-		return AqlPredicateEvaluatorFactoryProvider.INSTANCE;
-	}
+    @Override
+    public IPredicateEvaluatorFactoryProvider getPredicateEvaluatorFactoryProvider() {
+        return AqlPredicateEvaluatorFactoryProvider.INSTANCE;
+    }
 
 }
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 9271ebf..db3b177 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
@@ -42,7 +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.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
 import edu.uci.ics.asterix.om.base.ABoolean;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
@@ -375,7 +375,7 @@
 
     private void parseYearMonthDuration(String duration, DataOutput out) throws AsterixException {
         try {
-            AYearMonthDurationerializerDeserializer.parse(duration, out);
+            AYearMonthDurationSerializerDeserializer.parse(duration, out);
         } catch (HyracksDataException e) {
             throw new AsterixException(e);
         }