Temporal update based on a merge from an old branch.

Includes the following new functions: overlap-bins, get-overlapping-interval, get-interval-start-date, get-interval-start-datetime, get-interval-start-time, get-interval-end-date, get-interval-end-datetime, get-interval-end-time

Change-Id: Ie15ed39ae7de83ce71c63c4e7490f2ebf5911540
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/244
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ildar Absalyamov <ildar.absalyamov@gmail.com>
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index 84a01da..51fef41 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -88,6 +88,8 @@
         SequentialFixpointRuleController seqCtrlFullDfs = new SequentialFixpointRuleController(true);
         SequentialOnceRuleController seqOnceCtrl = new SequentialOnceRuleController(true);
         defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrl,
+                RuleCollections.buildInitialTranslationRuleCollection()));
+        defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrl,
                 RuleCollections.buildTypeInferenceRuleCollection()));
         defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrl,
                 RuleCollections.buildAutogenerateIDRuleCollection()));
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/replace22/replace22.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/replace22/replace22.3.query.aql
index df67481..fb000b4 100644
--- a/asterix-app/src/test/resources/runtimets/queries/string/replace22/replace22.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/string/replace22/replace22.3.query.aql
@@ -1,11 +1,11 @@
 use dataverse test;
 
-let $c1 := replace("abracadabra","", null , null)
-let $c2 := replace("abracadabra","bra", "XXX" ,"")
-let $c3 := replace(null,"hello world", "XxXx" , "x")
-let $c4 := replace("abracadabra","bra", "XXX" ,null)
-let $c5 := replace("abracadabra",null, "XXX" ,null)
-let $c6 := replace("abracadabra","Bra", null ,"i")
-let $c7 := replace("abracadabra","Bra", "" ,"i")
-let $c8 := replace("abracadabra","", "XXX" ,"")
+let $c1 := replace("abracadabra", "", null, null)
+let $c2 := replace("abracadabra", "bra", "XXX", "")
+let $c3 := replace(null,"hello world", "XxXx", "x")
+let $c4 := replace("abracadabra", "bra", "XXX", null)
+let $c5 := replace("abracadabra", null, "XXX", null)
+let $c6 := replace("abracadabra", "Bra", null, "i")
+let $c7 := replace("abracadabra", "Bra", "", "i")
+let $c8 := replace("abracadabra", "", "XXX", "")
 return {"result1": $c1,"result2": $c2,"result3": $c3,"result4": $c4,"result5": $c5,"result6": $c6,"result7": $c7,"result8": $c8}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/accessors/accessors.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/accessors/accessors.3.query.aql
index 42cc4a6..da46b09 100644
--- a/asterix-app/src/test/resources/runtimets/queries/temporal/accessors/accessors.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/accessors/accessors.3.query.aql
@@ -8,5 +8,56 @@
 let $c6 := time("12:23:34.930+07:00")
 let $c7 := string("-0003-01-09T23:12:12.39-07:00")
 let $c8 := duration("P3Y73M632DT49H743M3948.94S")
+let $c9 := year-month-duration("P8Y12M")
+let $c10 := day-time-duration("P32DT49H743M3948.94S")
 
-return {"year1": get-year($c1), "year2": get-year($c2), "year3": get-year($c3), "year4": get-year($c4), "year5": get-year($c5), "year6": get-year($c7), "year7": get-year($c8), "year-null": get-year(null), "month1": get-month($c1), "month2": get-month($c2), "month3": get-month($c3), "month4": get-month($c4), "month5": get-month($c5), "month6": get-month($c8), "month-null": get-month(null), "day1": get-day($c1), "day2": get-day($c2), "day3": get-day($c3), "day4": get-day($c4), "day5": get-day($c5), "day6": get-day($c8), "day-null": get-day(null), "hour1": get-hour($c2), "hour2": get-hour($c5), "hour3": get-hour($c6), "hour4": get-hour($c8), "hour-null": get-hour(null), "min1": get-minute($c2), "min2": get-minute($c5), "min3": get-minute($c6), "min4": get-minute($c8), "min-null": get-minute(null), "second1": get-second($c2), "second2": get-second($c5), "second3": get-second($c6), "second4": get-second($c8), "second-null": get-second(null), "ms1": get-millisecond($c2), "ms2": get-millisecond($c5), "ms3": get-millisecond($c6), "ms4": get-millisecond($c8), "ms-null": get-millisecond(null) }
+return {
+  "year1": get-year($c1), 
+  "year2": get-year($c2), 
+  "year3": get-year($c3), 
+  "year4": get-year($c4), 
+  "year5": get-year($c5), 
+  "year6": get-year($c7), 
+  "year7": get-year($c8), 
+  "year8": get-year($c9), 
+  "year-null": get-year(null), 
+  "month1": get-month($c1), 
+  "month2": get-month($c2), 
+  "month3": get-month($c3), 
+  "month4": get-month($c4), 
+  "month5": get-month($c5), 
+  "month6": get-month($c8), 
+  "month7": get-month($c9), 
+  "month-null": get-month(null), 
+  "day1": get-day($c1), 
+  "day2": get-day($c2), 
+  "day3": get-day($c3), 
+  "day4": get-day($c4), 
+  "day5": get-day($c5), 
+  "day6": get-day($c8), 
+  "day7": get-day($c10), 
+  "day-null": get-day(null), 
+  "hour1": get-hour($c2), 
+  "hour2": get-hour($c5), 
+  "hour3": get-hour($c6), 
+  "hour4": get-hour($c8), 
+  "hour5": get-hour($c10), 
+  "hour-null": get-hour(null), 
+  "min1": get-minute($c2), 
+  "min2": get-minute($c5), 
+  "min3": get-minute($c6), 
+  "min4": get-minute($c8), 
+  "min5": get-minute($c10), 
+  "min-null": get-minute(null), 
+  "second1": get-second($c2), 
+  "second2": get-second($c5), 
+  "second3": get-second($c6), 
+  "second4": get-second($c8), 
+  "second5": get-second($c10), 
+  "second-null": get-second(null), 
+  "ms1": get-millisecond($c2), 
+  "ms2": get-millisecond($c5), 
+  "ms3": get-millisecond($c6), 
+  "ms4": get-millisecond($c8), 
+  "ms5": get-millisecond($c10), 
+  "ms-null": get-millisecond(null) }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.1.ddl.aql
new file mode 100644
index 0000000..6cc19a9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.1.ddl.aql
@@ -0,0 +1,15 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Schema as closed{
+  id: int32,
+  time: time,
+  date: date,
+  datetime: datetime,
+  dtduration: day-time-duration,
+  ymduration: year-month-duration
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.2.update.aql
new file mode 100644
index 0000000..bc0cf89
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.2.update.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+ 
+insert into dataset tsdata({"id": 1, "time": time("23:49:23.938"), "date": date("1904-01-06"), "datetime": datetime("2012-01-12T12:31:39"), "dtduration": day-time-duration("PT5M"), "ymduration": year-month-duration("P5M")}) 
+insert into dataset tsdata({"id": 2, "time": time("12:37:10"), "date": date("2194-07-06"), "datetime": datetime("2013-01-12T12:31:39"), "dtduration": day-time-duration("PT5.329S"), "ymduration": year-month-duration("P1Y")}) 
+insert into dataset tsdata({"id": 3, "time": time("09:28:10.9"), "date": date("-1904-01-06"), "datetime": datetime("2012-01-12T18:31:39"), "dtduration": day-time-duration("P3DT2S"), "ymduration": year-month-duration("P29M")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.3.query.aql
new file mode 100644
index 0000000..9985349
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_max/agg_max.3.query.aql
@@ -0,0 +1,8 @@
+use dataverse test;
+
+let $m0 := max(for $i in dataset tsdata return $i.time)
+let $m1 := max(for $i in dataset tsdata return $i.date)
+let $m2 := max(for $i in dataset tsdata return $i.datetime)
+let $m3 := max(for $i in dataset tsdata return $i.dtduration)
+let $m4 := max(for $i in dataset tsdata return $i.ymduration)
+return {"m0": $m0, "m1": $m1, "m2": $m2, "m3": $m3, "m4": $m4}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.1.ddl.aql
new file mode 100644
index 0000000..6cc19a9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.1.ddl.aql
@@ -0,0 +1,15 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type Schema as closed{
+  id: int32,
+  time: time,
+  date: date,
+  datetime: datetime,
+  dtduration: day-time-duration,
+  ymduration: year-month-duration
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.2.update.aql
new file mode 100644
index 0000000..bc0cf89
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.2.update.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+ 
+insert into dataset tsdata({"id": 1, "time": time("23:49:23.938"), "date": date("1904-01-06"), "datetime": datetime("2012-01-12T12:31:39"), "dtduration": day-time-duration("PT5M"), "ymduration": year-month-duration("P5M")}) 
+insert into dataset tsdata({"id": 2, "time": time("12:37:10"), "date": date("2194-07-06"), "datetime": datetime("2013-01-12T12:31:39"), "dtduration": day-time-duration("PT5.329S"), "ymduration": year-month-duration("P1Y")}) 
+insert into dataset tsdata({"id": 3, "time": time("09:28:10.9"), "date": date("-1904-01-06"), "datetime": datetime("2012-01-12T18:31:39"), "dtduration": day-time-duration("P3DT2S"), "ymduration": year-month-duration("P29M")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.3.query.aql
new file mode 100644
index 0000000..91b2dba
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/agg_min/agg_min.3.query.aql
@@ -0,0 +1,8 @@
+use dataverse test;
+
+let $m0 := min(for $i in dataset tsdata return $i.time)
+let $m1 := min(for $i in dataset tsdata return $i.date)
+let $m2 := min(for $i in dataset tsdata return $i.datetime)
+let $m3 := min(for $i in dataset tsdata return $i.dtduration)
+let $m4 := min(for $i in dataset tsdata return $i.ymduration)
+return {"m0": $m0, "m1": $m1, "m2": $m2, "m3": $m3, "m4": $m4}
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.1.ddl.aql
new file mode 100644
index 0000000..5b52155
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description      :   Check temporal functions for duration
+ * Expected Result  :   Success
+ * Date             :   08/22/2013
+ */
+
+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/duration_functions/duration_functions.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.3.query.aql
new file mode 100644
index 0000000..9252213
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/duration_functions/duration_functions.3.query.aql
@@ -0,0 +1,16 @@
+/*
+ * Description      :   Check temporal functions for duration
+ * Expected Result  :   Success
+ * Date             :   08/22/2013
+ */
+
+use dataverse test;
+
+let $itv1 := interval-from-date("2010-10-30", "2010-12-21")
+let $itv2 := interval-from-datetime("2012-06-26T01:01:01.111", "2012-07-27T02:02:02.222")
+let $itv3 := interval-from-time("12:32:38", "20:29:20")
+
+return { "dr1" : duration-from-interval($itv1),
+         "dr2" : duration-from-interval($itv2),
+         "dr3" : duration-from-interval($itv3),
+         "dr4" : duration-from-interval(null) }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.3.query.aql
new file mode 100644
index 0000000..5167f2a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/get_overlapping_interval/get_overlapping_interval.3.query.aql
@@ -0,0 +1,11 @@
+/**
+ * get-overlapping-interval test case
+ * Expected result: success
+ **/
+
+{ "overlap1": get-overlapping-interval(interval-from-time(time("11:23:39"), time("18:27:19")), interval-from-time(time("12:23:39"), time("23:18:00"))), 
+  "overlap2": get-overlapping-interval(interval-from-time(time("12:23:39"), time("18:27:19")), interval-from-time(time("07:19:39"), time("09:18:00"))),
+  "overlap3": get-overlapping-interval(interval-from-date(date("1980-11-30"), date("1999-09-09")), interval-from-date(date("2013-01-01"), date("2014-01-01"))),
+  "overlap4": get-overlapping-interval(interval-from-date(date("1980-11-30"), date("2099-09-09")), interval-from-date(date("2013-01-01"), date("2014-01-01"))),
+  "overlap5": get-overlapping-interval(interval-from-datetime(datetime("1844-03-03T11:19:39"), datetime("2000-10-30T18:27:19")), interval-from-datetime(datetime("1989-03-04T12:23:39"), datetime("2009-10-10T23:18:00"))),
+  "overlap6": get-overlapping-interval(interval-from-datetime(datetime("1989-03-04T12:23:39"), datetime("2000-10-30T18:27:19")), interval-from-datetime(datetime("1844-03-03T11:19:39"), datetime("1888-10-10T23:18:00")))  }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.1.ddl.aql
new file mode 100644
index 0000000..fc82cbe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.1.ddl.aql
@@ -0,0 +1,4 @@
+/**
+ * overlap_bins test case: test the overlap_bins
+ * Expected result: success
+ **/
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.2.update.aql
new file mode 100644
index 0000000..fc82cbe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.2.update.aql
@@ -0,0 +1,4 @@
+/**
+ * overlap_bins test case: test the overlap_bins
+ * Expected result: success
+ **/
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.3.query.aql
new file mode 100644
index 0000000..ae9058f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins/overlap_bins.3.query.aql
@@ -0,0 +1,11 @@
+/**
+ * overlap_bins test case: test the overlap_bins
+ * Expected result: success
+ **/
+
+let $itv1 := interval-from-time(time("17:23:37"), time("18:30:21"))
+let $itv2 := interval-from-date(date("1984-03-17"), date("2013-08-22"))
+let $itv3 := interval-from-datetime(datetime("1800-01-01T23:59:48.938"), datetime("2015-07-26T13:28:30.218"))
+return { "timebins": overlap-bins($itv1, time("00:00:00"), day-time-duration("PT30M")),
+         "datebins": overlap-bins($itv2, date("1990-01-01"), year-month-duration("P20Y")),
+         "datetimebins": overlap-bins($itv3, datetime("1900-01-01T00:00:00.000"), year-month-duration("P100Y")) }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.ddl.aql
new file mode 100644
index 0000000..652f81c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.ddl.aql
@@ -0,0 +1,17 @@
+/**
+ * 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,
+  time: time,
+  duration: day-time-duration
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.2.update.aql
new file mode 100644
index 0000000..4e9c1e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.2.update.aql
@@ -0,0 +1,17 @@
+/**
+ * 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, "time": time("23:49:23.938"), "duration": day-time-duration("PT5M")}) 
+insert into dataset tsdata({"id": 2, "time": time("00:27:13.432"), "duration": day-time-duration("PT1H")}) 
+insert into dataset tsdata({"id": 3, "time": time("18:00:00"), "duration": day-time-duration("PT2H")}) 
+insert into dataset tsdata({"id": 4, "time": time("234933938"), "duration": day-time-duration("PT30S")}) 
+insert into dataset tsdata({"id": 5, "time": time("23:58:17.038"), "duration": day-time-duration("PT39.382S")}) 
+insert into dataset tsdata({"id": 6, "time": time("23:30:00"), "duration": day-time-duration("PT2M")}) 
+insert into dataset tsdata({"id": 7, "time": time("23:22:38"), "duration": day-time-duration("PT20M")}) 
+insert into dataset tsdata({"id": 8, "time": time("17:28:13.900"), "duration": day-time-duration("PT19S")}) 
+insert into dataset tsdata({"id": 9, "time": time("07:49:23.938"), "duration": day-time-duration("PT3H")}) 
+insert into dataset tsdata({"id": 10, "time": time("09:35:28.039"), "duration": day-time-duration("PT10H50M")}) 
+insert into dataset tsdata({"id": 11, "time": time("12:49:23.938"), "duration": day-time-duration("PT3H")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.query.aql
new file mode 100644
index 0000000..42defd6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_0/overlap_bins_gby_0.3.query.aql
@@ -0,0 +1,15 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+use dataverse test;
+
+for $i in dataset tsdata
+  order by $i.time
+  for $j in overlap-bins(interval-start-from-time($i.time, $i.duration), time("00:00:00"), day-time-duration("PT1H30M"))
+    group by $bin := $j with $i 
+    order by get-interval-start($bin)
+    for $x in $i
+      let $itv := interval-start-from-time($x.time, $x.duration)
+      return { "tbin": $bin, "interval": $itv, "overlap": get-overlapping-interval($bin, $itv) }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.ddl.aql
new file mode 100644
index 0000000..652f81c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.ddl.aql
@@ -0,0 +1,17 @@
+/**
+ * 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,
+  time: time,
+  duration: day-time-duration
+}
+
+create dataset tsdata(Schema)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.2.update.aql
new file mode 100644
index 0000000..4e9c1e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.2.update.aql
@@ -0,0 +1,17 @@
+/**
+ * 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, "time": time("23:49:23.938"), "duration": day-time-duration("PT5M")}) 
+insert into dataset tsdata({"id": 2, "time": time("00:27:13.432"), "duration": day-time-duration("PT1H")}) 
+insert into dataset tsdata({"id": 3, "time": time("18:00:00"), "duration": day-time-duration("PT2H")}) 
+insert into dataset tsdata({"id": 4, "time": time("234933938"), "duration": day-time-duration("PT30S")}) 
+insert into dataset tsdata({"id": 5, "time": time("23:58:17.038"), "duration": day-time-duration("PT39.382S")}) 
+insert into dataset tsdata({"id": 6, "time": time("23:30:00"), "duration": day-time-duration("PT2M")}) 
+insert into dataset tsdata({"id": 7, "time": time("23:22:38"), "duration": day-time-duration("PT20M")}) 
+insert into dataset tsdata({"id": 8, "time": time("17:28:13.900"), "duration": day-time-duration("PT19S")}) 
+insert into dataset tsdata({"id": 9, "time": time("07:49:23.938"), "duration": day-time-duration("PT3H")}) 
+insert into dataset tsdata({"id": 10, "time": time("09:35:28.039"), "duration": day-time-duration("PT10H50M")}) 
+insert into dataset tsdata({"id": 11, "time": time("12:49:23.938"), "duration": day-time-duration("PT3H")}) 
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.aql
new file mode 100644
index 0000000..797c351
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_1/overlap_bins_gby_1.3.query.aql
@@ -0,0 +1,22 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+use dataverse test;
+
+for $i2 in (
+  for $i1 in dataset tsdata
+  order by $i1.time
+  return { "interval": interval-start-from-time($i1.time, $i1.duration) })
+for $j in overlap-bins($i2.interval, time("00:00:00"), day-time-duration("PT1H30M"))
+group by $bin := $j with $i2
+order by get-interval-start($bin)
+return { 
+  "timebin": $bin, 
+  "count": count($i2), 
+  "total_ms": sum(
+    for $i3 in $i2 
+    return ms-from-day-time-duration(
+      duration-from-interval(
+        get-overlapping-interval($bin, $i3.interval)))) }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.ddl.aql
new file mode 100644
index 0000000..c5fa968
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.ddl.aql
@@ -0,0 +1,18 @@
+/**
+ * Interval_bin_gby test case: test the group-by using interval-bin function
+ * Expected result: success
+ **/
+
+drop dataverse multitask if exists;
+create dataverse multitask;
+use dataverse multitask;
+
+create type LogType as closed {
+        row_id: int32,
+        time: time,
+        duration: int32,
+        app: string
+};
+
+create dataset logs(LogType)
+primary key row_id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.2.update.aql
new file mode 100644
index 0000000..82d1fe6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.2.update.aql
@@ -0,0 +1,12 @@
+use dataverse multitask;
+
+insert into dataset logs { "row_id": 1, "time": time("10:27:12"), "duration": 5, "app": "Facebook" }
+insert into dataset logs { "row_id": 2, "time": time("10:27:18"), "duration": 6, "app": "Email" }
+insert into dataset logs { "row_id": 3, "time": time("10:27:25"), "duration": 26, "app": "Facebook" }
+insert into dataset logs { "row_id": 4, "time": time("10:27:52"), "duration": 19, "app": "Email" }
+insert into dataset logs { "row_id": 5, "time": time("10:28:12"), "duration": 47, "app": "Facebook" }
+insert into dataset logs { "row_id": 6, "time": time("10:29:00"), "duration": 33, "app": "Email" }
+insert into dataset logs { "row_id": 7, "time": time("10:29:10"), "duration": 18, "app": "Facebook" }
+insert into dataset logs { "row_id": 8, "time": time("10:29:29"), "duration": 159, "app": "Facebook" }
+insert into dataset logs { "row_id": 9, "time": time("11:07:15"), "duration": 30, "app": "Email" }
+insert into dataset logs { "row_id": 10, "time": time("11:07:47"), "duration": 31, "app": "Email" }
diff --git a/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.aql
new file mode 100644
index 0000000..0433b32
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/temporal/overlap_bins_gby_3/overlap_bins_gby_3.3.query.aql
@@ -0,0 +1,13 @@
+use dataverse multitask;
+
+for $bin in overlap-bins(interval-from-time(min(for $i in dataset logs return $i.time), max(for $i in dataset logs return $i.time + duration-from-ms($i.duration * 1000))), time("00:00:00.000"), day-time-duration("PT1M"))
+order by get-interval-start($bin)
+return {
+  "timebin": $bin,
+  "subgroups":
+        for $i in dataset logs
+        where interval-covers($bin, interval-start-from-time($i.time, duration-from-ms($i.duration)))
+        group by $subgid := $i.app with $i
+        order by $subgid, count($i)
+        return { "subgid": $subgid, "item_count": count($i) }
+}
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/string/replace22/replace22.1.adm b/asterix-app/src/test/resources/runtimets/results/string/replace22/replace22.1.adm
index a0e11d5..09d79cf 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/replace22/replace22.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/replace22/replace22.1.adm
@@ -1,2 +1,2 @@
-[ { "result1": "abracadabra", "result2": "aXXXcadaXXX", "result3": null, "result4": "aXXXcadaXXX", "result5": "XXXaXXXbXXXrXXXaXXXcXXXaXXXdXXXaXXXbXXXrXXXaXXX", "result6": "acada", "result7": "acada", "result8": "XXXaXXXbXXXrXXXaXXXcXXXaXXXdXXXaXXXbXXXrXXXaXXX" }
+[ { "result1": null, "result2": "aXXXcadaXXX", "result3": null, "result4": null, "result5": null, "result6": null, "result7": "acada", "result8": "XXXaXXXbXXXrXXXaXXXcXXXaXXXdXXXaXXXbXXXrXXXaXXX" }
  ]
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/accessors/accessors.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/accessors/accessors.1.adm
index 03a901e..33fb586 100644
--- a/asterix-app/src/test/resources/runtimets/results/temporal/accessors/accessors.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/accessors/accessors.1.adm
@@ -1,2 +1,3 @@
-[ { "year1": 2010, "year2": 1987, "year3": -1987, "year4": 928, "year5": 1937, "year6": -3, "year7": 9, "year-null": null, "month1": 10, "month2": 11, "month3": 11, "month4": 3, "month5": 12, "month6": 1, "month-null": null, "day1": 30, "day2": 19, "day3": 19, "day4": 29, "day5": 29, "day6": 634, "day-null": null, "hour1": 23, "hour2": 20, "hour3": 5, "hour4": 14, "hour-null": null, "min1": 49, "min2": 3, "min3": 23, "min4": 28, "min-null": null, "second1": 23, "second2": 6, "second3": 34, "second4": 48, "second-null": null, "ms1": 938, "ms2": 280, "ms3": 930, "ms4": 94, "ms-null": null }
+[ { "year1": 2010, "year2": 1987, "year3": -1987, "year4": 928, "year5": 1937, "year6": -3, "year7": 9, "year8": 9, "year-null": null, "month1": 10, "month2": 11, "month3": 11, "month4": 3, "month5": 12, "month6": 1, "month7": 0, "month-null": null, "day1": 30, "day2": 19, "day3": 19, "day4": 29, "day5": 29, "day6": 634, "day7": 34, "day-null": null, "hour1": 23, "hour2": 20, "hour3": 5, "hour4": 14, "hour5": 14, "hour-null": null, "min1": 49, "min2": 3, "min3": 23, "min4": 28, "min5": 28, "min-null": null, "second1": 23, "second2": 6, "second3": 34, "second4": 48, "second5": 48, "second-null": null, "ms1": 938, "ms2": 280, "ms3": 930, "ms4": 94, "ms5": 94, "ms-null": null }
  ]
+
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/agg_max/agg_max.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/agg_max/agg_max.1.adm
new file mode 100644
index 0000000..18ecc53
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/agg_max/agg_max.1.adm
@@ -0,0 +1,6 @@
+[ {"m0": time("23:49:23.938Z")
+, "m1": date("2194-07-06")
+, "m2": datetime("2013-01-12T12:31:39.000Z")
+, "m3": day-time-duration("P3DT2S")
+, "m4": year-month-duration("P2Y5M")}
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/agg_min/agg_min.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/agg_min/agg_min.1.adm
new file mode 100644
index 0000000..2eccb41
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/agg_min/agg_min.1.adm
@@ -0,0 +1,6 @@
+[ {"m0": time("09:28:10.900Z")
+, "m1": date("-1904-01-06")
+, "m2": datetime("2012-01-12T12:31:39.000Z")
+, "m3": day-time-duration("PT5.329S")
+, "m4": year-month-duration("P5M")}
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/duration_functions/duration_functions.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/duration_functions/duration_functions.1.adm
new file mode 100644
index 0000000..ab16741
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/duration_functions/duration_functions.1.adm
@@ -0,0 +1,2 @@
+[ { "dr1": day-time-duration("P52D"), "dr2": day-time-duration("P31DT1H1M1.111S"), "dr3": day-time-duration("PT7H56M42S"), "dr4": null }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/get_overlapping_interval/get_overlapping_interval.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/get_overlapping_interval/get_overlapping_interval.1.adm
new file mode 100644
index 0000000..175eccc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/get_overlapping_interval/get_overlapping_interval.1.adm
@@ -0,0 +1,2 @@
+[ { "overlap1": interval-time("12:23:39.000Z, 18:27:19.000Z"), "overlap2": null, "overlap3": null, "overlap4": interval-date("2013-01-01, 2014-01-01"), "overlap5": interval-datetime("1989-03-04T12:23:39.000Z, 2000-10-30T18:27:19.000Z"), "overlap6": null }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.1.adm
index cd19c38..74a7fb0 100644
--- a/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/insert_from_ext_ds_2/insert_from_ext_ds_2.1.adm
@@ -1,4 +1,4 @@
-[ { "date": date("-9971-09-24"), "time": time("11:38:17.154Z"), "datetime": datetime("1259-11-13T09:49:11.852Z"), "duration": duration("P473653Y9M4566143DT10H20M53.61S"), "year-month-duration": year-month-duration("P148233Y10M"), "day-time-duration": day-time-duration("-P7236357DT2H56M56.164S"), "date-interval": interval-date("-0255-09-06, 4925-05-03"), "time-interval": interval-time("23:10:45.169Z, 01:37:48.736Z"), "datetime-interval": interval-datetime("0534-12-08T08:20:31.487Z, 6778-02-16T22:40:21.653Z") }
+[ { "date": date("-9971-09-24"), "time": time("11:38:17.154Z"), "datetime": datetime("1259-11-13T09:49:11.852Z"), "duration": duration("P473653Y9M4566143DT10H20M53.61S"), "year-month-duration": year-month-duration("P148233Y10M"), "day-time-duration": day-time-duration("-P7236357DT2H56M56.164S"), "date-interval": interval-date("-0255-09-06, 4925-05-03"), "time-interval": interval-time("12:10:45.169Z, 15:37:48.736Z"), "datetime-interval": interval-datetime("0534-12-08T08:20:31.487Z, 6778-02-16T22:40:21.653Z") }
 , { "date": date("4619-11-23"), "time": time("14:29:36.786Z"), "datetime": datetime("2749-01-27T17:27:30.020Z"), "duration": duration("-P474133Y7M854630DT4H40M6.45S"), "year-month-duration": year-month-duration("P193989Y3M"), "day-time-duration": day-time-duration("P4477686DT4H49M31.87S"), "date-interval": interval-date("-9537-08-04, 9656-06-03"), "time-interval": interval-time("12:04:45.689Z, 12:41:59.002Z"), "datetime-interval": interval-datetime("-2640-10-11T17:32:15.675Z, 4104-02-01T05:59:11.902Z") }
-, { "date": date("7986-11-25"), "time": time("12:49:39.736Z"), "datetime": datetime("-8337-01-30T15:23:07.598Z"), "duration": duration("-P184484Y7M2241423DT10H42M49.500S"), "year-month-duration": year-month-duration("-P546031Y3M"), "day-time-duration": day-time-duration("P2623386DT10H32M31.983S"), "date-interval": interval-date("-4514-05-24, 3337-08-26"), "time-interval": interval-time("04:16:42.321Z, 02:22:56.816Z"), "datetime-interval": interval-datetime("2129-12-12T13:18:35.758Z, 8647-07-01T13:10:19.691Z") }
- ]
+, { "date": date("7986-11-25"), "time": time("12:49:39.736Z"), "datetime": datetime("-8337-01-30T15:23:07.598Z"), "duration": duration("-P184484Y7M2241423DT10H42M49.500S"), "year-month-duration": year-month-duration("-P546031Y3M"), "day-time-duration": day-time-duration("P2623386DT10H32M31.983S"), "date-interval": interval-date("-4514-05-24, 3337-08-26"), "time-interval": interval-time("04:16:42.321Z, 12:22:56.816Z"), "datetime-interval": interval-datetime("2129-12-12T13:18:35.758Z, 8647-07-01T13:10:19.691Z") }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins/overlap_bins.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins/overlap_bins.1.adm
new file mode 100644
index 0000000..054fdae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins/overlap_bins.1.adm
@@ -0,0 +1,2 @@
+[ { "timebins": [ interval-time("17:00:00.000Z, 17:30:00.000Z"), interval-time("17:30:00.000Z, 18:00:00.000Z"), interval-time("18:00:00.000Z, 18:30:00.000Z"), interval-time("18:30:00.000Z, 19:00:00.000Z") ], "datebins": [ interval-date("1970-01-01, 1990-01-01"), interval-date("1990-01-01, 2010-01-01"), interval-date("2010-01-01, 2030-01-01") ], "datetimebins": [ interval-datetime("1800-01-01T00:00:00.000Z, 1900-01-01T00:00:00.000Z"), interval-datetime("1900-01-01T00:00:00.000Z, 2000-01-01T00:00:00.000Z"), interval-datetime("2000-01-01T00:00:00.000Z, 2100-01-01T00:00:00.000Z") ] }
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.adm
new file mode 100644
index 0000000..457e54d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_0/overlap_bins_gby_0.1.adm
@@ -0,0 +1,24 @@
+[ { "tbin": interval-time("00:00:00.000Z, 01:30:00.000Z"), "interval": interval-time("00:27:13.432Z, 01:27:13.432Z"), "overlap": interval-time("00:27:13.432Z, 01:27:13.432Z") }
+, { "tbin": interval-time("07:30:00.000Z, 09:00:00.000Z"), "interval": interval-time("07:49:23.938Z, 10:49:23.938Z"), "overlap": interval-time("07:49:23.938Z, 09:00:00.000Z") }
+, { "tbin": interval-time("09:00:00.000Z, 10:30:00.000Z"), "interval": interval-time("07:49:23.938Z, 10:49:23.938Z"), "overlap": interval-time("09:00:00.000Z, 10:30:00.000Z") }
+, { "tbin": interval-time("09:00:00.000Z, 10:30:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("09:35:28.039Z, 10:30:00.000Z") }
+, { "tbin": interval-time("10:30:00.000Z, 12:00:00.000Z"), "interval": interval-time("07:49:23.938Z, 10:49:23.938Z"), "overlap": interval-time("10:30:00.000Z, 10:49:23.938Z") }
+, { "tbin": interval-time("10:30:00.000Z, 12:00:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("10:30:00.000Z, 12:00:00.000Z") }
+, { "tbin": interval-time("12:00:00.000Z, 13:30:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("12:00:00.000Z, 13:30:00.000Z") }
+, { "tbin": interval-time("12:00:00.000Z, 13:30:00.000Z"), "interval": interval-time("12:49:23.938Z, 15:49:23.938Z"), "overlap": interval-time("12:49:23.938Z, 13:30:00.000Z") }
+, { "tbin": interval-time("13:30:00.000Z, 15:00:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("13:30:00.000Z, 15:00:00.000Z") }
+, { "tbin": interval-time("13:30:00.000Z, 15:00:00.000Z"), "interval": interval-time("12:49:23.938Z, 15:49:23.938Z"), "overlap": interval-time("13:30:00.000Z, 15:00:00.000Z") }
+, { "tbin": interval-time("15:00:00.000Z, 16:30:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("15:00:00.000Z, 16:30:00.000Z") }
+, { "tbin": interval-time("15:00:00.000Z, 16:30:00.000Z"), "interval": interval-time("12:49:23.938Z, 15:49:23.938Z"), "overlap": interval-time("15:00:00.000Z, 15:49:23.938Z") }
+, { "tbin": interval-time("16:30:00.000Z, 18:00:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("16:30:00.000Z, 18:00:00.000Z") }
+, { "tbin": interval-time("16:30:00.000Z, 18:00:00.000Z"), "interval": interval-time("17:28:13.900Z, 17:28:32.900Z"), "overlap": interval-time("17:28:13.900Z, 17:28:32.900Z") }
+, { "tbin": interval-time("18:00:00.000Z, 19:30:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("18:00:00.000Z, 19:30:00.000Z") }
+, { "tbin": interval-time("18:00:00.000Z, 19:30:00.000Z"), "interval": interval-time("18:00:00.000Z, 20:00:00.000Z"), "overlap": interval-time("18:00:00.000Z, 19:30:00.000Z") }
+, { "tbin": interval-time("19:30:00.000Z, 21:00:00.000Z"), "interval": interval-time("09:35:28.039Z, 20:25:28.039Z"), "overlap": interval-time("19:30:00.000Z, 20:25:28.039Z") }
+, { "tbin": interval-time("19:30:00.000Z, 21:00:00.000Z"), "interval": interval-time("18:00:00.000Z, 20:00:00.000Z"), "overlap": interval-time("19:30:00.000Z, 20:00:00.000Z") }
+, { "tbin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "interval": interval-time("23:22:38.000Z, 23:42:38.000Z"), "overlap": interval-time("23:22:38.000Z, 23:42:38.000Z") }
+, { "tbin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "interval": interval-time("23:30:00.000Z, 23:32:00.000Z"), "overlap": interval-time("23:30:00.000Z, 23:32:00.000Z") }
+, { "tbin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "interval": interval-time("23:49:23.938Z, 23:54:23.938Z"), "overlap": interval-time("23:49:23.938Z, 23:54:23.938Z") }
+, { "tbin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "interval": interval-time("23:49:33.938Z, 23:50:03.938Z"), "overlap": interval-time("23:49:33.938Z, 23:50:03.938Z") }
+, { "tbin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "interval": interval-time("23:58:17.038Z, 23:58:56.420Z"), "overlap": interval-time("23:58:17.038Z, 23:58:56.420Z") }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.adm
new file mode 100644
index 0000000..241859d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_1/overlap_bins_gby_1.1.adm
@@ -0,0 +1,12 @@
+[ { "timebin": interval-time("00:00:00.000Z, 01:30:00.000Z"), "count": 1, "total_ms": 3600000 }
+, { "timebin": interval-time("07:30:00.000Z, 09:00:00.000Z"), "count": 1, "total_ms": 4236062 }
+, { "timebin": interval-time("09:00:00.000Z, 10:30:00.000Z"), "count": 2, "total_ms": 8671961 }
+, { "timebin": interval-time("10:30:00.000Z, 12:00:00.000Z"), "count": 2, "total_ms": 6563938 }
+, { "timebin": interval-time("12:00:00.000Z, 13:30:00.000Z"), "count": 2, "total_ms": 7836062 }
+, { "timebin": interval-time("13:30:00.000Z, 15:00:00.000Z"), "count": 2, "total_ms": 10800000 }
+, { "timebin": interval-time("15:00:00.000Z, 16:30:00.000Z"), "count": 2, "total_ms": 8363938 }
+, { "timebin": interval-time("16:30:00.000Z, 18:00:00.000Z"), "count": 2, "total_ms": 5419000 }
+, { "timebin": interval-time("18:00:00.000Z, 19:30:00.000Z"), "count": 2, "total_ms": 10800000 }
+, { "timebin": interval-time("19:30:00.000Z, 21:00:00.000Z"), "count": 2, "total_ms": 5128039 }
+, { "timebin": interval-time("22:30:00.000Z, 00:00:00.000Z"), "count": 5, "total_ms": 1689382 }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.adm b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.adm
new file mode 100644
index 0000000..a972c4d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/temporal/overlap_bins_gby_3/overlap_bins_gby_3.1.adm
@@ -0,0 +1,43 @@
+[ { "timebin": interval-time("10:27:00.000Z, 10:28:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 }, { "subgid": "Email", "item_count": 2 }, { "subgid": "Facebook", "item_count": 2 } ] } 
+, { "timebin": interval-time("10:28:00.000Z, 10:29:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 }, { "subgid": "Facebook", "item_count": 1 } ] }
+, { "timebin": interval-time("10:29:00.000Z, 10:30:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 }, { "subgid": "Email", "item_count": 1 }, { "subgid": "Facebook", "item_count": 2 } ] }
+, { "timebin": interval-time("10:30:00.000Z, 10:31:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:31:00.000Z, 10:32:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:32:00.000Z, 10:33:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:33:00.000Z, 10:34:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:34:00.000Z, 10:35:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:35:00.000Z, 10:36:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:36:00.000Z, 10:37:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:37:00.000Z, 10:38:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:38:00.000Z, 10:39:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:39:00.000Z, 10:40:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:40:00.000Z, 10:41:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:41:00.000Z, 10:42:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:42:00.000Z, 10:43:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:43:00.000Z, 10:44:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:44:00.000Z, 10:45:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:45:00.000Z, 10:46:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:46:00.000Z, 10:47:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:47:00.000Z, 10:48:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:48:00.000Z, 10:49:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:49:00.000Z, 10:50:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:50:00.000Z, 10:51:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:51:00.000Z, 10:52:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:52:00.000Z, 10:53:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:53:00.000Z, 10:54:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:54:00.000Z, 10:55:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:55:00.000Z, 10:56:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:56:00.000Z, 10:57:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:57:00.000Z, 10:58:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:58:00.000Z, 10:59:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("10:59:00.000Z, 11:00:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:00:00.000Z, 11:01:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:01:00.000Z, 11:02:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:02:00.000Z, 11:03:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:03:00.000Z, 11:04:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:04:00.000Z, 11:05:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:05:00.000Z, 11:06:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:06:00.000Z, 11:07:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+, { "timebin": interval-time("11:07:00.000Z, 11:08:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 }, { "subgid": "Email", "item_count": 2 } ] }
+, { "timebin": interval-time("11:08:00.000Z, 11:09:00.000Z"), "subgroups": [ { "subgid": null, "item_count": 0 } ] }
+ ]
\ 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 a22eb35..b571514 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6135,6 +6135,41 @@
     </test-group>
     <test-group name="temporal">
         <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_3">
+                <output-dir compare="Text">overlap_bins_gby_3</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="agg_01">
+                <output-dir compare="Text">agg_01</output-dir>
+            </compilation-unit>
+        </test-case>
+       <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_1">
+                <output-dir compare="Text">overlap_bins_gby_1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="duration_functions">
+                <output-dir compare="Text">duration_functions</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins_gby_0">
+                <output-dir compare="Text">overlap_bins_gby_0</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="get_overlapping_interval">
+                <output-dir compare="Text">get_overlapping_interval</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
+            <compilation-unit name="overlap_bins">
+                <output-dir compare="Text">overlap_bins</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="temporal">
             <compilation-unit name="parse_02">
                 <output-dir compare="Text">parse_02</output-dir>
             </compilation-unit>
@@ -6627,5 +6662,4 @@
             </compilation-unit>
         </test-case>
     </test-group>
-
 </test-suite>