asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [57/58] [abbrv] incubator-asterixdb git commit: Temporal update based on a merge from an old branch.
Date Fri, 24 Apr 2015 18:43:23 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-doc/src/site/markdown/aql/allens.md
----------------------------------------------------------------------
diff --git a/asterix-doc/src/site/markdown/aql/allens.md b/asterix-doc/src/site/markdown/aql/allens.md
index a07e287..9fd6015 100644
--- a/asterix-doc/src/site/markdown/aql/allens.md
+++ b/asterix-doc/src/site/markdown/aql/allens.md
@@ -38,40 +38,50 @@ A detailed description of Allen's relations can be found from its [wikipedia ent
 
         { "interval-before": true, "interval-after": true }
 
-### interval-meets, interval-met-by ###
+
+### interval-covers, interval-covered-by ###
 
  * Syntax:
 
-        interval-meets(interval1, interval2)
-        interval-met-by(interval1, interval2)
+        interval-covers(interval1, interval2)
+        interval-covered-by(interval1, interval2)
 
- * These two functions check whether an interval meets with another interval. 
+ * These two functions check whether one interval covers the other interval.
  * Arguments:
     * `interval1`, `interval2`: two intervals to be compared
  * Return Value:
    
-    A `boolean` value. Specifically, `interval-meets(interval1, interval2)` is true if and only if `interval1.end = interval2.start`, and `interval-met-by(interval1, interval2)` is true if and only if `interval1.start = interval2.end`. If any of the two inputs is `null`, `null` is returned.
+    A `boolean` value. Specifically, `interval-covers(interval1, interval2)` is true if and only if
+
+        interval1.start <= interval2.start
+        AND interval1.end >= interval2.end
+
+    `interval-covered-by(interval1, interval2)` is true if and only if
+
+        interval2.start <= interval1.start
+        AND interval2.end >= interval1.end
+
+    For both functions, if any of the two inputs is `null`, `null` is returned.
 
  * Examples:
 
         let $itv1 := interval-from-date("2000-01-01", "2005-01-01")
-        let $itv2 := interval-from-date("2005-01-01", "2012-09-09")
+        let $itv2 := interval-from-date("2000-03-01", "2004-09-09")
         let $itv3 := interval-from-date("2006-08-01", "2007-03-01")
-        let $itv4 := interval-from-date("2004-09-10", "2006-08-01")
-        return {"meets": interval-meets($itv1, $itv2), "metby": interval-met-by($itv3, $itv4)}
-
+        let $itv4 := interval-from-date("2004-09-10", "2012-08-01")
+        return {"interval-covers": interval-covers($itv1, $itv2), "interval-covered-by": interval-covered-by($itv3, $itv4)}
+        
  * The expected result is:
  
-        { "meets": true, "metby": true }
+        { "interval-covers": true, "interval-covered-by": true }
 
 
-### interval-overlaps, interval-overlapped-by, overlap ###
+### interval-overlaps, interval-overlapped-by ###
 
  * Syntax:
 
         interval-overlaps(interval1, interval2)
         interval-overlapped-by(interval1, interval2)
-        overlap(interval1, interval2)
 
  * These functions check whether two intervals overlap with each other.
  * Arguments:
@@ -90,17 +100,9 @@ A detailed description of Allen's relations can be found from its [wikipedia ent
         AND interval1.end > interval2.end
         AND interval2.end > interval1.start
 
-    `overlap(interval1, interval2)` is true if
-
-        (interval2.start >= interval1.start
-        AND interval2.start < interval1.end)
-        OR
-        (interval2.end > interval1.start
-        AND interval2.end <= interval.end)
-
     For all these functions, if any of the two inputs is `null`, `null` is returned.
 
-    Note that `interval-overlaps` and `interval-overlapped-by` are following the Allen's relations on the definition of overlap. `overlap` is a syntactic sugar for the case that the intersect of two intervals is not empty.
+    Note that `interval-overlaps` and `interval-overlapped-by` are following the Allen's relations on the definition of overlap.
 
  * Examples:
 
@@ -109,87 +111,111 @@ A detailed description of Allen's relations can be found from its [wikipedia ent
         let $itv3 := interval-from-date("2006-08-01", "2007-03-01")
         let $itv4 := interval-from-date("2004-09-10", "2006-12-31")
         return {"overlaps": interval-overlaps($itv1, $itv2), 
-                "overlapped-by": interval-overlapped-by($itv3, $itv4), 
-                "overlapping1": overlap($itv1, $itv2), 
-                "overlapping2": overlap($itv3, $itv4)}
+                "overlapped-by": interval-overlapped-by($itv3, $itv4)}
         
  * The expected result is:
  
-        { "overlaps": true, "overlapped-by": true, "overlapping1": true, "overlapping2": true }
+        { "overlaps": true, "overlapped-by": true }
 
 
-### interval-starts, interval-started-by ###
+###  interval-overlapping ###
+Note that `interval-overlapping` is not an Allen's Relation, but syntactic sugar we added for the case that the intersect of two intervals is not empty. Basically this function returns true if any of these functions return true: `interval-overlaps`, `interval-overlapped-by`, `interval-covers`, or `interval-covered-by`.
 
  * Syntax:
 
-        interval-starts(interval1, interval2)
-        interval-started-by(interval1, interval2)
+        interval-overlapping(interval1, interval2)
 
- * These two functions check whether one interval starts with the other interval.
+ * This functions check whether two intervals share any points with each other. 
  * Arguments:
     * `interval1`, `interval2`: two intervals to be compared
  * Return Value:
    
-    A `boolean` value. Specifically, `interval-starts(interval1, interval2)` returns true if and only if
+    A `boolean` value. Specifically, `interval-overlapping(interval1, interval2)` is true if
 
-        interval1.start = interval2.start
-        AND interval1.end <= interval2.end
+        (interval2.start >= interval1.start
+        AND interval2.start < interval1.end)
+        OR
+        (interval2.end > interval1.start
+        AND interval2.end <= interval1.end)
 
-    `interval-started-by(interval1, interval2)` returns true if and only if
+    If any of the two inputs is `null`, `null` is returned.
 
-        interval1.start = interval2.start
-        AND interval2.end <= interval1.end
+ * Examples:
 
-    For both functions, if any of the two inputs is `null`, `null` is returned.
+        let $itv1 := interval-from-date("2000-01-01", "2005-01-01")
+        let $itv2 := interval-from-date("2004-05-01", "2012-09-09")
+        let $itv3 := interval-from-date("2006-08-01", "2007-03-01")
+        let $itv4 := interval-from-date("2004-09-10", "2006-12-31")
+        return {"overlapping1": interval-overlapping($itv1, $itv2), 
+                "overlapping2": interval-overlapping($itv3, $itv4)}
+        
+ * The expected result is:
+ 
+        { "overlapping1": true, "overlapping2": true }
+
+
+### interval-meets, interval-met-by ###
+
+ * Syntax:
+
+        interval-meets(interval1, interval2)
+        interval-met-by(interval1, interval2)
+
+ * These two functions check whether an interval meets with another interval. 
+ * Arguments:
+    * `interval1`, `interval2`: two intervals to be compared
+ * Return Value:
+   
+    A `boolean` value. Specifically, `interval-meets(interval1, interval2)` is true if and only if `interval1.end = interval2.start`, and `interval-met-by(interval1, interval2)` is true if and only if `interval1.start = interval2.end`. If any of the two inputs is `null`, `null` is returned.
 
  * Examples:
 
         let $itv1 := interval-from-date("2000-01-01", "2005-01-01")
-        let $itv2 := interval-from-date("2000-01-01", "2012-09-09")
+        let $itv2 := interval-from-date("2005-01-01", "2012-09-09")
         let $itv3 := interval-from-date("2006-08-01", "2007-03-01")
-        let $itv4 := interval-from-date("2006-08-01", "2006-08-01")
-        return {"interval-starts": interval-starts($itv1, $itv2), "interval-started-by": interval-started-by($itv3, $itv4)}
+        let $itv4 := interval-from-date("2004-09-10", "2006-08-01")
+        return {"meets": interval-meets($itv1, $itv2), "metby": interval-met-by($itv3, $itv4)}
 
  * The expected result is:
  
-        { "interval-starts": true, "interval-started-by": true }
+        { "meets": true, "metby": true }
 
 
-### interval-covers, interval-covered-by ###
+### interval-starts, interval-started-by ###
 
  * Syntax:
 
-        interval-covers(interval1, interval2)
-        interval-covered-by(interval1, interval2)
+        interval-starts(interval1, interval2)
+        interval-started-by(interval1, interval2)
 
- * These two functions check whether one interval covers the other interval.
+ * These two functions check whether one interval starts with the other interval.
  * Arguments:
     * `interval1`, `interval2`: two intervals to be compared
  * Return Value:
    
-    A `boolean` value. Specifically, `interval-covers(interval1, interval2)` is true if and only if
+    A `boolean` value. Specifically, `interval-starts(interval1, interval2)` returns true if and only if
 
-        interval1.start <= interval2.start
-        AND interval2.end >= interval1.end
+        interval1.start = interval2.start
+        AND interval1.end <= interval2.end
 
-    `interval-covered-by(interval1, interval2)` is true if and only if
+    `interval-started-by(interval1, interval2)` returns true if and only if
 
-        interval2.start <= interval1.start
-        AND interval1.end >= interval2.end
+        interval1.start = interval2.start
+        AND interval2.end <= interval1.end
 
     For both functions, if any of the two inputs is `null`, `null` is returned.
 
  * Examples:
 
         let $itv1 := interval-from-date("2000-01-01", "2005-01-01")
-        let $itv2 := interval-from-date("2000-03-01", "2004-09-09")
+        let $itv2 := interval-from-date("2000-01-01", "2012-09-09")
         let $itv3 := interval-from-date("2006-08-01", "2007-03-01")
-        let $itv4 := interval-from-date("2004-09-10", "2012-08-01")
-        return {"interval-covers": interval-covers($itv1, $itv2), "interval-covered-by": interval-covered-by($itv3, $itv4)}
-        
+        let $itv4 := interval-from-date("2006-08-01", "2006-08-01")
+        return {"interval-starts": interval-starts($itv1, $itv2), "interval-started-by": interval-started-by($itv3, $itv4)}
+
  * The expected result is:
  
-        { "interval-covers": true, "interval-covered-by": true }
+        { "interval-starts": true, "interval-started-by": true }
 
 
 ### interval-ends, interval-ended-by ###

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-doc/src/site/markdown/aql/functions.md
----------------------------------------------------------------------
diff --git a/asterix-doc/src/site/markdown/aql/functions.md b/asterix-doc/src/site/markdown/aql/functions.md
index 89f6f64..d0a1e0a 100644
--- a/asterix-doc/src/site/markdown/aql/functions.md
+++ b/asterix-doc/src/site/markdown/aql/functions.md
@@ -449,13 +449,15 @@ Asterix provides various classes of functions to support operations on numeric,
 ### replace ###
  * Syntax:
 
-        replace(string_expression, string_pattern, string_replacement)
+        replace(string_expression, string_pattern, string_replacement[, string_flags])
 
  * Checks whether the string `string_expression` matches the given pattern `string_pattern`, and replace the matched pattern `string_pattern` with the new pattern `string_replacement`.
  * Arguments:
     * `string_expression` : A `string` that might contain the pattern.
     * `string_pattern` : A pattern `string` to be matched.
     * `string_replacement` : A pattern `string` to be used as the replacement.
+    * `string_flag` : (Optional) A `string` with flags to be used during replace.
+       * The following modes are enabled with these flags: dotall (s), multiline (m), case-insenitive (i), and comments and whitespace (x).
  * Return Value:
     * Returns a `string` that is obtained after the replacements.
 
@@ -1509,72 +1511,6 @@ edit-distance-contains(expression1, expression2, threshold)
 ## <a id="TemporalFunctions">Temporal Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
 
 
-### interval-from-date ###
- * Syntax:
-
-        interval-from-date(string_expression1, string_expression2)
-
- * Constructor function for the `interval` type by parsing two date strings.
- * Arguments:
-    * `string_expression1` : The `string` value representing the starting date.
-    * `string_expression2` : The `string` value representing the ending date.
- * Return Value:
-    * An `interval` value between the two dates.
-
- * Example:
-
-        {"date-interval": interval-from-date("2012-01-01", "2013-04-01")}
-
-
- * The expected result is:
-
-        { "date-interval": interval-date("2012-01-01, 2013-04-01") }
-
-
-### interval-from-time ###
- * Syntax:
-
-        interval-from-time(string_expression1, string_expression2)
-
- * Constructor function for the `interval` type by parsing two time strings.
- * Arguments:
-    * `string_expression1` : The `string` value representing the starting time.
-    * `string_expression2` : The `string` value representing the ending time.
- * Return Value:
-    * An `interval` value between the two times.
-
- * Example:
-
-        {"time-interval": interval-from-time("12:23:34.456Z", "233445567+0800")}
-
-
- * The expected result is:
-
-        { "time-interval": interval-time("12:23:34.456Z, 15:34:45.567Z") }
-
-
-### interval-from-datetime ###
- * Syntax:
-
-        interval-from-datetime(string_expression1, string_expression2)
-
- * Constructor function for `interval` type by parsing two datetime strings.
- * Arguments:
-    * `string_expression1` : The `string` value representing the starting datetime.
-    * `string_expression2` : The `string` value representing the ending datetime.
- * Return Value:
-    * An `interval` value between the two datetimes.
-
- * Example:
-
-        {"datetime-interval": interval-from-datetime("2012-01-01T12:23:34.456+08:00", "20130401T153445567Z")}
-
-
- * The expected result is:
-
-        { "datetime-interval": interval-datetime("2012-01-01T04:23:34.456Z, 2013-04-01T15:34:45.567Z") }
-
-
 ### get-year/get-month/get-day/get-hour/get-minute/get-second/get-millisecond ###
  * Syntax:
 
@@ -1744,10 +1680,10 @@ edit-distance-contains(expression1, expression2, threshold)
         67
 
 
-### duration-from-months/duration-from-milliseconds ###
+### duration-from-months/duration-from-ms ###
 * Syntax:
 
-        duration-from-months/duration-from-milliseconds(number_expression)
+        duration-from-months/duration-from-ms(number_expression)
 
 * Creates a `duration` from `number_expression`.
 * Arguments:
@@ -1760,12 +1696,41 @@ edit-distance-contains(expression1, expression2, threshold)
         let $i := duration-from-months(8)
         return $i;
 
-
 * The expected result is:
 
         duration("P8M")
 
 
+### duration-from-interval ###
+* Syntax:
+
+        duration-from-interval(interval_expression)
+
+* Creates a `duration` from `interval_expression`.
+* Arguments:
+    * `interval_expression` : An `interval` value
+* Return Value:
+    * A `duration` repesenting the time in the `interval_expression`
+
+* Example:
+
+        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) }
+          
+* The expected result is:
+
+        { "dr1": day-time-duration("P52D"),
+          "dr2": day-time-duration("P31DT1H1M1.111S"),
+          "dr3": day-time-duration("PT7H56M42S"),
+          "dr4": null }
+
+
 ### current-date ###
  * Syntax:
 
@@ -1798,8 +1763,6 @@ edit-distance-contains(expression1, expression2, threshold)
 
  * Example:
 
-        use dataverse TinySocial;
-
         {"current-date": current-date(),
         "current-time": current-time(),
         "current-datetime": current-datetime()}
@@ -1951,8 +1914,19 @@ parse-date/parse-time/parse-datetime(date_expression,formatting_expression)
 
 * Creates a `date/time/date-time` value by treating `date_expression` with formatting `formatting_expression`
 * Arguments:
-    * `date_expression`: A `string` value representing the `date/time/datetime`
-    * `formatting_expression` A `string` value providing the formatting for `date_expression`
+    * `date_expression`: A `string` value representing the `date/time/datetime`. 
+    * `formatting_expression` A `string` value providing the formatting for `date_expression`.Characters used to create date expression:
+       * `h` hours
+       * `m` minutes
+       * `s` seconds
+       * `n` milliseconds
+       * `a` am/pm
+       * `z` timezone
+       * `Y` year
+       * `M` month
+       * `D` day
+       * `W` weekday
+       * `-`, `'`, `/`, `.`, `,`, `T` seperators for both time and date
 * Return Value:
     * A `date/time/date-time` value corresponding to `date_expression`
 
@@ -1961,35 +1935,43 @@ parse-date/parse-time/parse-datetime(date_expression,formatting_expression)
         let $i := parse-time("30:30","m:s")
         return $i;
 
-
 * The expected result is:
 
         time("00:30:30.000Z")
 
 
+### print-date/print-time/print-datetime ###
+* Syntax:
 
-### interval-start-from-date/time/datetime ###
- * Syntax:
+print-date/print-time/print-datetime(date_expression,formatting_expression)
 
-        interval-start-from-date/time/datetime(date/time/datetime, duration)
+* Creates a `string` representing a `date/time/date-time` value of the `date_expression` using the formatting `formatting_expression`
+* Arguments:
+    * `date_expression`: A `date/time/datetime` value.
+    * `formatting_expression` A `string` value providing the formatting for `date_expression`. Characters used to create date expression:
+       * `h` hours
+       * `m` minutes
+       * `s` seconds
+       * `n` milliseconds
+       * `a` am/pm
+       * `z` timezone
+       * `Y` year
+       * `M` month
+       * `D` day
+       * `W` weekday
+       * `-`, `'`, `/`, `.`, `,`, `T` seperators for both time and date
+* Return Value:
+    * A `string` value corresponding to `date_expression`
 
- * Construct an `interval` value by the given starting `date`/`time`/`datetime` and the `duration` that the interval lasts.
- * Arguments:
-    * `date/time/datetime`: a `string` representing a `date`, `time` or `datetime`, or a `date`/`time`/`datetime` value, representing the starting time point.
-    * `duration`: a `string` or `duration` value representing the duration of the interval. Note that duration cannot be negative value.
- * Return Value:
-    * An `interval` value representing the interval starting from the given time point with the length of duration.
+* Example:
 
- * Example:
+        let $i := print-time(time("00:30:30.000Z"),"m:s")
+        return $i;
 
-        let $itv1 := interval-start-from-date("1984-01-01", "P1Y")
-        let $itv2 := interval-start-from-time(time("02:23:28.394"), "PT3H24M")
-        let $itv3 := interval-start-from-datetime("1999-09-09T09:09:09.999", duration("P2M30D"))
-        return {"interval1": $itv1, "interval2": $itv2, "interval3": $itv3}
+* The expected result is:
 
- * The expectecd result is:
+        "30:30"
 
-        { "interval1": interval-date("1984-01-01, 1985-01-01"), "interval2": interval-time("02:23:28.394Z, 05:47:28.394Z"), "interval3": interval-datetime("1999-09-09T09:09:09.999Z, 1999-12-09T09:09:09.999Z") }
 
 ### get-interval-start, get-interval-end ###
  * Syntax:
@@ -2012,6 +1994,68 @@ parse-date/parse-time/parse-datetime(date_expression,formatting_expression)
 
         { "start": date("1984-01-01"), "end": date("1985-01-01") }
 
+
+### get-interval-start-date/get-interval-start-datetimeget-interval-start-time, get-interval-end-date/get-interval-end-datetime/get-interval-end-time ###
+ * Syntax:
+
+        get-interval-start-date/get-interval-start-datetime/get-interval-start-time/get-interval-end-date/get-interval-end-datetime/get-interval-end-time(interval)
+
+ * Gets the start/end of the given interval for the specific date/datetime/time type.
+ * Arguments:
+    * `interval`: the interval to be accessed.
+ * Return Value:
+    * A `time`, `date`, or `datetime` (depending on the function) representing the starting or ending time.
+
+ * Example:
+
+        let $itv1 := interval-start-from-date("1984-01-01", "P1Y")
+        let $itv2 := interval-start-from-datetime("1984-01-01T08:30:00.000", "P1Y1H")
+        let $itv3 := interval-start-from-time("08:30:00.000", "P1H")
+        return {"start": get-interval-start-date($itv1), "end": get-interval-end-date($itv1), "start": get-interval-start-datetime($itv2), "end": get-interval-end-datetime($itv2), "start": get-interval-start-time($itv3), "end": get-interval-end-time($itv3)}
+
+
+ * The expected result is:
+
+        { "start": date("1984-01-01"), "end": date("1985-01-01"), "start": datetime("1984-01-01T08:30:00.000"), "end": datetime("1984-02-01T09:30:00.000"), "start": date("08:30:00.000"), "end": time("09:30:00.000")  }
+
+
+### get-overlapping-interval ###
+ * Syntax:
+
+        get-overlapping-interval(interval_expression_1, interval_expression_2)
+
+ * Gets the start/end of the given interval for the specific date/datetime/time type.
+ * Arguments:
+    * `interval_expression_1`: an `interval` value
+    * `interval_expression_2`: an `interval` value
+ * Return Value:
+    * Returns an `interval` that is overlapping `interval_expression_1` and `interval_expression_2`. If `interval_expression_1` and `interval_expression_2` do not overlap `null` is returned. Note each interval must be of the same type.
+
+ * Example:
+
+        { "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")))  }
+
+ * The expected result is:
+
+        { "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 }
+
+
+### interval-before/interval-after/interval-meets/interval-met-by/interval-overlaps/interval-overlapped-by/interval-overlapping/interval-starts/interval-started-by/interval-covers/interval-covered-by/interval-ends/interval-ended-by ###
+
+
+See the [Allen's Relations](allens.html).
+
+
 ### interval-bin ###
  * Syntax:
 
@@ -2049,34 +2093,132 @@ parse-date/parse-time/parse-datetime(date_expression,formatting_expression)
           "bin3": interval-time("05:23:00.000Z, 05:24:00.000Z"),
           "bin4": interval-datetime("-1987-11-19T00:00:00.000Z, -1987-11-20T00:00:00.000Z")}
 
-### interval-before/interval-after/interval-meets/interval-met-by/interval-overlaps/interval-overlapped-by/interval-overlapping/interval-starts/interval-started-by/interval-covers/interval-covered-by/interval-ends/interval-ended-by ###
-* Syntax:
 
-        interval-before/interval-after/interval-meets/interval-met-by/interval-overlaps/interval-overlapped-by/interval-overlapping/interval-starts/interval-started-by/interval-covers/interval-covered-by/interval-ends/interval-ended-by(interval_expression_1, interval_expression_2)
+### interval-from-date ###
+ * Syntax:
 
-* Determines whether two `interval` values have a specific relationship
-* Arguments:
-    * `interval_expression_1`: an `interval` value
-    * `interval_expression_2`: an `interval` value
-* Return Value:
-    * An `boolean` value representing whether the relationship holds.
-* Possible Relationships:
-    * `before/after`: The two `interval` values never meet, and the first `interval` `preceeds/follows` the second
-    * `meets/met-by`: The `first/second` `interval` ends precisely where the `second/first` `interval` starts
-    * `overlaps/overlapped-by`: The `first/second` `interval` ends in a sub-interval that begins the `second/first`
-    * `overlapping`: The two `interval` values share a common sub-interval
-    * `starts/started-by`: The `first/second` `interval` is precisely the beginning of the `second/first` `interval`
-    * `ends/ended-by`: The `first/second` `interval` is precisely the end of the `second/first` `interval`
-    * `covers/covered-by`: The `first/second` `interval` completely contains the `second/first` `interval`
+        interval-from-date(string_expression1, string_expression2)
 
-* Example:
+ * Constructor function for the `interval` type by parsing two date strings.
+ * Arguments:
+    * `string_expression1` : The `string` value representing the starting date.
+    * `string_expression2` : The `string` value representing the ending date.
+ * Return Value:
+    * An `interval` value between the two dates.
 
-        let $i := interval-starts(interval-from-date(date("2013-01-01"), date("20130505")),interval-from-date(date("2013-01-01"), date("20130705")))
-        return $i;
+ * Example:
 
-* The expectecd result is:
+        {"date-interval": interval-from-date("2012-01-01", "2013-04-01")}
+
+
+ * The expected result is:
+
+        { "date-interval": interval-date("2012-01-01, 2013-04-01") }
+
+
+### interval-from-time ###
+ * Syntax:
+
+        interval-from-time(string_expression1, string_expression2)
+
+ * Constructor function for the `interval` type by parsing two time strings.
+ * Arguments:
+    * `string_expression1` : The `string` value representing the starting time.
+    * `string_expression2` : The `string` value representing the ending time.
+ * Return Value:
+    * An `interval` value between the two times.
+
+ * Example:
+
+        {"time-interval": interval-from-time("12:23:34.456Z", "233445567+0800")}
+
+
+ * The expected result is:
+
+        { "time-interval": interval-time("12:23:34.456Z, 15:34:45.567Z") }
+
+
+### interval-from-datetime ###
+ * Syntax:
+
+        interval-from-datetime(string_expression1, string_expression2)
+
+ * Constructor function for `interval` type by parsing two datetime strings.
+ * Arguments:
+    * `string_expression1` : The `string` value representing the starting datetime.
+    * `string_expression2` : The `string` value representing the ending datetime.
+ * Return Value:
+    * An `interval` value between the two datetimes.
+
+ * Example:
+
+        {"datetime-interval": interval-from-datetime("2012-01-01T12:23:34.456+08:00", "20130401T153445567Z")}
+
+
+ * The expected result is:
+
+        { "datetime-interval": interval-datetime("2012-01-01T04:23:34.456Z, 2013-04-01T15:34:45.567Z") }
+
+
+### interval-start-from-date/time/datetime ###
+ * Syntax:
+
+        interval-start-from-date/time/datetime(date/time/datetime, duration)
+
+ * Construct an `interval` value by the given starting `date`/`time`/`datetime` and the `duration` that the interval lasts.
+ * Arguments:
+    * `date/time/datetime`: a `string` representing a `date`, `time` or `datetime`, or a `date`/`time`/`datetime` value, representing the starting time point.
+    * `duration`: a `string` or `duration` value representing the duration of the interval. Note that duration cannot be negative value.
+ * Return Value:
+    * An `interval` value representing the interval starting from the given time point with the length of duration.
+
+ * Example:
+
+        let $itv1 := interval-start-from-date("1984-01-01", "P1Y")
+        let $itv2 := interval-start-from-time(time("02:23:28.394"), "PT3H24M")
+        let $itv3 := interval-start-from-datetime("1999-09-09T09:09:09.999", duration("P2M30D"))
+        return {"interval1": $itv1, "interval2": $itv2, "interval3": $itv3}
+
+ * The expectecd result is:
+
+        { "interval1": interval-date("1984-01-01, 1985-01-01"), "interval2": interval-time("02:23:28.394Z, 05:47:28.394Z"), "interval3": interval-datetime("1999-09-09T09:09:09.999Z, 1999-12-09T09:09:09.999Z") }
+
+
+### overlap-bins ###
+  * Return Value:
+    * A `interval` value representing the bin containing the `time-to-bin` value. Note that the internal type of this interval value should be the same as the `time-to-bin` type.
+
+ * Syntax:
+
+        overlap-bins(interval_expression, time-bin-anchor, duration-bin-size)
+
+ * Returns an ordered list of `interval` values representing each bin that is overlapping the `interval_expression`.
+ * Arguments:
+    * `interval_expression`: an `interval` value
+    * `time-bin-anchor`: a date/time/datetime value representing an anchor of a bin starts. The type of this argument should be the same as the first `time-to-bin` argument.
+    * `duration-bin-size`: the duration value representing the size of the bin, in the type of year-month-duration or day-time-duration. The type of this duration should be compatible with the type of `time-to-bin`, so that the arithmetic operation between `time-to-bin` and `duration-bin-size` is well-defined. Currently AsterixDB supports the following arithmetic operations:
+        * datetime +|- year-month-duration
+        * datetime +|- day-time-duration
+        * date +|- year-month-duration
+        * date +|- day-time-duration
+        * time +|- day-time-duration
+  * Return Value:
+    * A ordered list of `interval` values representing each bin that is overlapping the `interval_expression`. Note that the internal type as `time-to-bin` and `duration-bin-size`.
+
+  * Example:
+
+        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")) }
+          
+   * The expected result is:
 
-        true
+        { "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") ] }
 
 
 ## <a id="OtherFunctions">Other Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjects.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjects.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjects.java
index b9b4c41..191fda6 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjects.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjects.java
@@ -50,6 +50,7 @@ import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.AUnorderedListType;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public class JObjects {
@@ -304,8 +305,12 @@ public class JObjects {
             interval = new AMutableInterval(intervalStart, intervalEnd, (byte) 0);
         }
 
-        public void setValue(long intervalStart, long intervalEnd, byte typetag) {
-            interval.setValue(intervalStart, intervalEnd, typetag);
+        public void setValue(long intervalStart, long intervalEnd, byte typetag) throws AsterixException {
+            try {
+                interval.setValue(intervalStart, intervalEnd, typetag);
+            } catch (AlgebricksException e) {
+                throw new AsterixException(e);
+            }
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
index 655bb7f..6fb7d4a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
@@ -137,7 +137,11 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
             throw new HyracksDataException(e);
         }
 
-        aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.DATETIME.serialize());
+        try {
+            aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.DATETIME.serialize());
+        } catch (AlgebricksException e) {
+            throw new HyracksDataException(e);
+        }
 
         intervalSerde.serialize(aInterval, out);
     }
@@ -180,7 +184,11 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
             throw new HyracksDataException(e);
         }
 
-        aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.TIME.serialize());
+        try {
+            aInterval.setValue(chrononTimeInMsStart, chrononTimeInMsEnd, ATypeTag.TIME.serialize());
+        } catch (AlgebricksException e) {
+            throw new HyracksDataException(e);
+        }
         intervalSerde.serialize(aInterval, out);
     }
 
@@ -214,8 +222,12 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
             throw new HyracksDataException(e);
         }
 
-        aInterval.setValue((chrononTimeInMsStart / GregorianCalendarSystem.CHRONON_OF_DAY),
-                (chrononTimeInMsEnd / GregorianCalendarSystem.CHRONON_OF_DAY), ATypeTag.DATE.serialize());
+        try {
+            aInterval.setValue((chrononTimeInMsStart / GregorianCalendarSystem.CHRONON_OF_DAY),
+                    (chrononTimeInMsEnd / GregorianCalendarSystem.CHRONON_OF_DAY), ATypeTag.DATE.serialize());
+        } catch (AlgebricksException e) {
+            throw new HyracksDataException(e);
+        }
 
         intervalSerde.serialize(aInterval, out);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
----------------------------------------------------------------------
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 8d083ee..cd61730 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
@@ -49,6 +49,7 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AUUIDStringSerializerDe
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer;
 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.ANull;
 import edu.uci.ics.asterix.om.base.IAObject;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
 import edu.uci.ics.asterix.om.types.ARecordType;
@@ -193,8 +194,10 @@ public class AqlSerializerDeserializerProvider implements ISerializerDeserialize
             @Override
             public IAObject deserialize(DataInput in) throws HyracksDataException {
                 try {
-                    //deserialize the tag to move the  input cursor forward
-                    SerializerDeserializerUtil.deserializeTag(in);
+                    //deserialize the tag (move input cursor forward) and check if it's not NULL tag
+                    if (SerializerDeserializerUtil.deserializeTag(in) == ATypeTag.NULL) {
+                        return ANull.NULL;
+                    }
                 } catch (IOException e) {
                     throw new HyracksDataException(e);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableInterval.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableInterval.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableInterval.java
index f7f216b..f76add7 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableInterval.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/AMutableInterval.java
@@ -14,13 +14,18 @@
  */
 package edu.uci.ics.asterix.om.base;
 
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+
 public class AMutableInterval extends AInterval {
 
     public AMutableInterval(long intervalStart, long intervalEnd, byte typetag) {
         super(intervalStart, intervalEnd, typetag);
     }
 
-    public void setValue(long intervalStart, long intervalEnd, byte typetag) {
+    public void setValue(long intervalStart, long intervalEnd, byte typetag) throws AlgebricksException {
+        if (intervalStart >= intervalEnd) {
+            throw new AlgebricksException("Invalid interval: the starting time should be less than the ending time.");
+        }
         this.intervalStart = intervalStart;
         this.intervalEnd = intervalEnd;
         this.typetag = typetag;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/base/temporal/DurationArithmeticOperations.java
----------------------------------------------------------------------
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 d760292..ef87888 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
@@ -40,11 +40,13 @@ public class DurationArithmeticOperations {
     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;
+            long rtnChronon = pointChronon + dayTimeDuration;
+            if (rtnChronon < 0L || rtnChronon > GregorianCalendarSystem.CHRONON_OF_DAY) {
+                rtnChronon %= GregorianCalendarSystem.CHRONON_OF_DAY;
+                if (rtnChronon < 0L) {
+                    rtnChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
+                }
             }
-
             return rtnChronon;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 6b7b871..cfecd9c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -48,6 +48,7 @@ import edu.uci.ics.asterix.om.typecomputer.impl.CollectionToSequenceTypeComputer
 import edu.uci.ics.asterix.om.typecomputer.impl.ConcatNonNullTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.FieldAccessByIndexResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.FieldAccessNestedResultType;
+import edu.uci.ics.asterix.om.typecomputer.impl.GetOverlappingInvervalTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.InjectFailureTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedCollectionMemberResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.NonTaggedFieldAccessByNameResultType;
@@ -88,6 +89,7 @@ import edu.uci.ics.asterix.om.typecomputer.impl.OptionalAYearMonthDurationTypeCo
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListConstructorResultType;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAInt32TypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAInt64TypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAIntervalTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAPointTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAStringTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAnyTypeComputer;
@@ -526,7 +528,7 @@ public class AsterixBuiltinFunctions {
             "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,
+    public final static FunctionIdentifier INTERVAL_OVERLAPPING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "interval-overlapping", 2);
     public final static FunctionIdentifier INTERVAL_STARTS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "interval-starts", 2);
@@ -569,6 +571,8 @@ public class AsterixBuiltinFunctions {
             FunctionConstants.ASTERIX_NS, "get-year-month-duration", 1);
     public final static FunctionIdentifier GET_DAY_TIME_DURATION = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "get-day-time-duration", 1);
+    public final static FunctionIdentifier DURATION_FROM_INTERVAL = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "duration-from-interval", 1);
 
     // spatial
     public final static FunctionIdentifier CREATE_POINT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -626,8 +630,24 @@ public class AsterixBuiltinFunctions {
             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 ACCESSOR_TEMPORAL_INTERVAL_START_DATETIME = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-start-datetime", 1);
+    public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_END_DATETIME = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-end-datetime", 1);
+    public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_START_DATE = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-start-date", 1);
+    public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_END_DATE = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-end-date", 1);
+    public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_START_TIME = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-start-time", 1);
+    public static final FunctionIdentifier ACCESSOR_TEMPORAL_INTERVAL_END_TIME = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-interval-end-time", 1);
     public static final FunctionIdentifier INTERVAL_BIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "interval-bin", 3);
+    public static final FunctionIdentifier OVERLAP_BINS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "overlap-bins", 3);
+    public static final FunctionIdentifier GET_OVERLAPPING_INTERVAL = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-overlapping-interval", 2);
 
     // Temporal functions
     public static final FunctionIdentifier DATE_FROM_UNIX_TIME_IN_DAYS = new FunctionIdentifier(
@@ -990,6 +1010,12 @@ public class AsterixBuiltinFunctions {
         addFunction(ACCESSOR_TEMPORAL_MILLISEC, OptionalAInt64TypeComputer.INSTANCE, true);
         addFunction(ACCESSOR_TEMPORAL_INTERVAL_START, OptionalATemporalInstanceTypeComputer.INSTANCE, true);
         addFunction(ACCESSOR_TEMPORAL_INTERVAL_END, OptionalATemporalInstanceTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_START_DATETIME, OptionalADateTimeTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_END_DATETIME, OptionalADateTimeTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_START_DATE, OptionalADateTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_END_DATE, OptionalADateTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_START_TIME, OptionalATimeTypeComputer.INSTANCE, true);
+        addFunction(ACCESSOR_TEMPORAL_INTERVAL_END_TIME, OptionalATimeTypeComputer.INSTANCE, true);
 
         // temporal functions
         addFunction(DATE_FROM_UNIX_TIME_IN_DAYS, OptionalADateTypeComputer.INSTANCE, true);
@@ -1009,7 +1035,7 @@ public class AsterixBuiltinFunctions {
         addFunction(INTERVAL_MET_BY, OptionalABooleanTypeComputer.INSTANCE, true);
         addFunction(INTERVAL_OVERLAPS, OptionalABooleanTypeComputer.INSTANCE, true);
         addFunction(INTERVAL_OVERLAPPED_BY, OptionalABooleanTypeComputer.INSTANCE, true);
-        addFunction(OVERLAP, OptionalABooleanTypeComputer.INSTANCE, true);
+        addFunction(INTERVAL_OVERLAPPING, OptionalABooleanTypeComputer.INSTANCE, true);
         addFunction(INTERVAL_STARTS, OptionalABooleanTypeComputer.INSTANCE, true);
         addFunction(INTERVAL_STARTED_BY, OptionalABooleanTypeComputer.INSTANCE, true);
         addFunction(INTERVAL_COVERS, OptionalABooleanTypeComputer.INSTANCE, true);
@@ -1038,6 +1064,9 @@ public class AsterixBuiltinFunctions {
         addFunction(PRINT_DATE, OptionalAStringTypeComputer.INSTANCE, true);
         addFunction(PRINT_TIME, OptionalAStringTypeComputer.INSTANCE, true);
         addFunction(PRINT_DATETIME, OptionalAStringTypeComputer.INSTANCE, true);
+        addFunction(OVERLAP_BINS, OrderedListOfAIntervalTypeComputer.INSTANCE, true);
+        addFunction(GET_OVERLAPPING_INTERVAL, GetOverlappingInvervalTypeComputer.INSTANCE, true);
+        addFunction(DURATION_FROM_INTERVAL, OptionalADayTimeDurationTypeComputer.INSTANCE, true);
 
         // interval constructors
         addFunction(INTERVAL_CONSTRUCTOR_DATE, OptionalAIntervalTypeComputer.INSTANCE, true);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
index 6464c4a..c13d6ed 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/base/TypeComputerUtilities.java
@@ -67,7 +67,7 @@ public class TypeComputerUtilities {
             return null;
     }
 
-    public static boolean nullableType(ILogicalExpression expression, IVariableTypeEnvironment env)
+    public static boolean inputInferednullableType(ILogicalExpression expression, IVariableTypeEnvironment env)
             throws AlgebricksException {
         AbstractFunctionCallExpression func = (AbstractFunctionCallExpression) expression;
         if (!(func instanceof ScalarFunctionCallExpression)) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AIntervalTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AIntervalTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AIntervalTypeComputer.java
new file mode 100644
index 0000000..a6c3d1c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AIntervalTypeComputer.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class AIntervalTypeComputer implements IResultTypeComputer {
+
+    public static final AIntervalTypeComputer INSTANCE = new AIntervalTypeComputer();
+
+    private AIntervalTypeComputer() {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer#computeType(edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression, edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment, edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider)
+     */
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        return BuiltinType.AINTERVAL;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/GetOverlappingInvervalTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/GetOverlappingInvervalTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/GetOverlappingInvervalTypeComputer.java
new file mode 100644
index 0000000..52b13f4
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/GetOverlappingInvervalTypeComputer.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class GetOverlappingInvervalTypeComputer implements IResultTypeComputer {
+
+    public static final GetOverlappingInvervalTypeComputer INSTANCE = new GetOverlappingInvervalTypeComputer();
+
+    private GetOverlappingInvervalTypeComputer() {
+
+    }
+
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        List<IAType> unionList = new ArrayList<IAType>();
+        unionList.add(BuiltinType.ANULL);
+        unionList.add(BuiltinType.AINTERVAL);
+        return new AUnionType(unionList, "IntervalOrNullResult");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
index 86d3ffa..a4a460d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/NonTaggedMinMaxAggTypeComputer.java
@@ -81,6 +81,21 @@ public class NonTaggedMinMaxAggTypeComputer implements IResultTypeComputer {
             case STRING:
                 unionList.add(BuiltinType.ASTRING);
                 break;
+            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;
+            case DAYTIMEDURATION:
+                unionList.add(BuiltinType.ADAYTIMEDURATION);
+                break;
             case ANY:
                 return BuiltinType.ANY;
             default: {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABinaryTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABinaryTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABinaryTypeComputer.java
index 01d507f..68e9b63 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABinaryTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABinaryTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalABinaryTypeComputer implements IResultTypeComputer {
 
     @Override public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ABINARY);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABooleanTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABooleanTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABooleanTypeComputer.java
index 764624f..a274a49 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABooleanTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalABooleanTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalABooleanTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ABOOLEAN);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalACircleTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalACircleTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalACircleTypeComputer.java
index 92e26e0..69cb3a8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalACircleTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalACircleTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalACircleTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ACIRCLE);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTimeTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTimeTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTimeTypeComputer.java
index f0d2caf..d66e794 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTimeTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTimeTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalADateTimeTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ADATETIME);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTypeComputer.java
index 093849d..b61d116 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADateTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalADateTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ADATE);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
index c3c7c25..c1e7e80 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADayTimeDurationTypeComputer.java
@@ -41,7 +41,7 @@ public class OptionalADayTimeDurationTypeComputer implements IResultTypeComputer
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ADAYTIMEDURATION);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADoubleTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADoubleTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADoubleTypeComputer.java
index 324e078..10f6ab0 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADoubleTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADoubleTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalADoubleTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ADOUBLE);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADurationTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADurationTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADurationTypeComputer.java
index 85556ed..e12e173 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADurationTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalADurationTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalADurationTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ADURATION);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAFloatTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAFloatTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAFloatTypeComputer.java
index d9da2b8..9b7f571 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAFloatTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAFloatTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAFloatTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AFLOAT);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt16TypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt16TypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt16TypeComputer.java
index a737ed2..b26f41a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt16TypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt16TypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAInt16TypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AINT16);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt32TypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt32TypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt32TypeComputer.java
index c666d36..77735e7 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt32TypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt32TypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAInt32TypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AINT32);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt64TypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt64TypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt64TypeComputer.java
index 701b1ae..7d967d8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt64TypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt64TypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAInt64TypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AINT64);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt8TypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt8TypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt8TypeComputer.java
index ad6b130..e6bf314 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt8TypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAInt8TypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAInt8TypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AINT8);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAIntervalTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAIntervalTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAIntervalTypeComputer.java
index 9c5a7d5..69bccc0 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAIntervalTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAIntervalTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAIntervalTypeComputer implements IResultTypeComputer {
 
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AINTERVAL);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalALineTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalALineTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalALineTypeComputer.java
index e692dbd..0da2d4c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalALineTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalALineTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalALineTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ALINE);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPoint3DTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPoint3DTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPoint3DTypeComputer.java
index 8f0bf7a..8ab5eb7 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPoint3DTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPoint3DTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAPoint3DTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.APOINT3D);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPointTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPointTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPointTypeComputer.java
index 1a93ee6..f558274 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPointTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPointTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAPointTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.APOINT);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPolygonTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPolygonTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPolygonTypeComputer.java
index 405608c..bbc6fad 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPolygonTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAPolygonTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAPolygonTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.APOLYGON);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalARectangleTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalARectangleTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalARectangleTypeComputer.java
index c6a8026..d9cf904 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalARectangleTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalARectangleTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalARectangleTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ARECTANGLE);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAStringTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAStringTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAStringTypeComputer.java
index 5b0642d..b24ebb6 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAStringTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAStringTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalAStringTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ASTRING);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalATimeTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalATimeTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalATimeTypeComputer.java
index 4d466e7..7a8406f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalATimeTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalATimeTypeComputer.java
@@ -37,7 +37,7 @@ public class OptionalATimeTypeComputer implements IResultTypeComputer {
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.ATIME);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
index 3350674..b05bece 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OptionalAYearMonthDurationTypeComputer.java
@@ -41,7 +41,7 @@ public class OptionalAYearMonthDurationTypeComputer implements IResultTypeComput
     @Override
     public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
             IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        if (TypeComputerUtilities.nullableType(expression, env)) {
+        if (TypeComputerUtilities.inputInferednullableType(expression, env)) {
             List<IAType> unionList = new ArrayList<IAType>();
             unionList.add(BuiltinType.ANULL);
             unionList.add(BuiltinType.AYEARMONTHDURATION);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListOfAIntervalTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListOfAIntervalTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListOfAIntervalTypeComputer.java
new file mode 100644
index 0000000..4e5a354
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/OrderedListOfAIntervalTypeComputer.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class OrderedListOfAIntervalTypeComputer implements IResultTypeComputer {
+
+    public static final OrderedListOfAIntervalTypeComputer INSTANCE = new OrderedListOfAIntervalTypeComputer();
+
+    private OrderedListOfAIntervalTypeComputer() {
+    }
+
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        return new AOrderedListType(BuiltinType.AINTERVAL, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4a9a7d99/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
index 38edf28..e889c0b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
@@ -46,7 +46,7 @@ public class CircleCenterAccessor extends AbstractScalarFunctionDynamicDescripto
 
     private static final FunctionIdentifier FID = AsterixBuiltinFunctions.GET_CIRCLE_CENTER_ACCESSOR;
     private static final byte SER_CICLE_TAG = ATypeTag.CIRCLE.serialize();
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+    private static final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
 


Mime
View raw message